How to share code on your blog using github.

Suppose that you have a piece of code that you want to share on your blog (or other source). If you have a github account, than you can easily share it.

Go to gist.gitbub.com and type the piece of code you want to share. Then, just copy and paste the address. The end result is something like this.

#include <iostream>
int main()
{
std::cout << "Hello world!\n";
return 0;
}
view raw helloworld.cpp hosted with ❤ by GitHub

That’s all. A full explanation for wordpress sites can be found here https://wordpress.com/support/gist/.

Happy coding!

Leave a comment