preetjdp / blog Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://preetjdp.dev
License: MIT License
Home Page: https://preetjdp.dev
License: MIT License
I've been looking towards getting into Ethereum
Have been using using Hasura for Production at Devfolio for about 2 months now, here are my unfiltered thoughts.
Alright, Hey there I'm gonna tell you how to set up this blog powered by Github Issues.
But before that the backstory. Ah heck Skip it
So on the 20th of June, Viranchee shared that he's building his blog entirely powered by Github Issues and linked to this blog as a reference.
The Blog | My Reaction |
---|---|
And I really liked the idea, and immediately set out to get this working.
Step 0 was to figure out what frontend to use, Gatbsy stood out because it favors GraphQL for data querying and I thought pairing it with the Github API should be seamless.
Arguably one of the best blogs out there is Overreacted By Dan Abramov. So step 1 was to just fork it out and figure it how it's working internally.
Overreacted uses The Remark Transformer Plugin to look for all the Markdown files in the project, process them and make them available to consume under GraphQL.
Well that's useless for us because we want to fetch markdown from Github, not from files on our computer.
Conveniently Gatsby has a Plugin to easily add external GrapqQL Datasources.
It was fairly simple to get data from the Github API. Pipe that with the Gatsby createPage
Function, and that's basically the working of the blog.
// Fetch issues from GraphQL.
const result = await graphql(
`
{
github {
viewer {
repository(name: "Blog") {
issues(first: 20) {
nodes {
id
title
bodyHTML
}
}
}
}
}
}
`
)
// Generate Pages for each Post.
const posts = result.data.github.viewer.repository.issues.nodes
posts.forEach((post, index) => {
createPage({
path: post.number.toString(),
component: blogPost,
context: {
slug: post.number
},
})
})
Clone the project and install the dependencies.
git clone https://github.com/preetjdp/Blog
cd Blog
npm install
# If you get a libpng error while running this
# run `npm rebuild`
Something like
https://github.com/YOUR_NAME/Blog
A token can be obtained from this URL. Here are the options that I used.
Now that you've obtained your token just use it to run the app.
# If you're running Windows / Powershell
$env:GITHUB_TOKEN="GITHUB_TOKEN"
npm run develop
# If you're using Linux / MacOS
GITHUB_TOKEN="GITHUB_TOKEN" npm run develop
And that's it ๐๐. You should have a gatsby project running on http://localhost:8000
Line 79 in 530dfbb
Most of the configuration is done through the gatsby-config.js
file.
You can change the fields here's as per your liking.
Lines 2 to 12 in 530dfbb
Wait Whaaaat?? What does this mean?
When you change the content of an issue (In the pursuit of editing a blog post). It won't work unless you build it afterward and publish it.
This is a blessing in disguise, this allows the blog to be ridiculously fast.
Tldr.
I wrote a file system in rust, with the primary mode of interaction over GraphQL
All operations are to be executed over graphQL
Things to cover
_HTTP 3 _
Dear Preet,
There will be moments in your life where you feel that everything has stagnated, you'll feel extremely bored and dumbed down.
At such a moment remember what pumps you up.
Remember that money is not important, it is essential to survival, but don't be pulled into something just because you're getting paid, and may mean you can buy something for yourself / purchase something for your mom.
Remember always you love to break things apart. You're the kind of person who before even fully understanding something takes a screw-driver to it -> Open's it apart and tries to piece it back together.
Whatever decision you make, make it with eccentricity, be pumped up to do it, or don't do it at all. The true value of you lies somewhere in there.
You're not good at studies, you're in a fucked up college, but there things that bring you up. You've met some remarkable people over time. And remember baba is always there.
If You DO read this, here are a couple of things that are interesting to do!
Turn your old cycle to an electric cycle.
Work at a Hydroponic Farm / Like freaking builds, patent, and license tech.
How would this work? you ask.
There's a ton of fucking potential in terms of tech that can be built for Hydroponics.
"The truck thing that Kimbal Musk has built is pretty amazing" and I don't see any startups in India doing something similar to that. The real opportunity is when you realize that your family (kinda) is involved in the "Shipping" business.
This could be a great source of containers for the plants.
Stay Eccentric
Also setup Github or TravisCI to automate the deployment when a new issue is added/removed
The feeling of being lethargic and not being able to gain the energy to do something, to get work done is the worst feeling of all
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.