Hi There, I decided to create a blog and share my experiences about software development. So this will be my first post to try out whether TUMBLR is good or not. First of all, along my posts I will share many pieces of codes for many different languages. To do that I decided to use a code highlighter to make the code pieces I share more pretty ;] There were many options I could use but most of them did not work for me and I was lazy as many of the developers, to upload bunch of JS files to my server. So i decided to use one that is already there.
You need to know a little about coding to start sharing code right? So I am guessing that it is pretty simple to load some JS files to your page. If you dont know, dont worry I will make it clear;] If you are using TUMBLR as I do, just click on settings menu and select your profile.
There you can select the THEME you will be using. You may get some free themes there. Does not matter which one you choose. All you need to do is after choosing the theme you like, click on the "Edit HTML" button to see the html source of the theme.
At this point below the <header> tag add the following :
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script> <script language='javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script>
After adding this to your header then you can come back to your text post. When ever you need to add a piece of code click on HTML tab on the right top corner and add the code like below:
<pre class="brush: java">// Comment public class Testing { public static void main(String args[]) { /* Another Comment on multiple lines */ int x = 9; } } </pre>
Here the important part is the <pre> tag. the code piece will go under <pre> tag and we will brush the code with the brush value we need.
The result will look like below:
public class Testing { public static void main(String args[]) { /* Another Comment on multiple lines */ int x = 9; } }
I bet it is pretty fantastic. ;]
Here you go I made my first post. Hope you enjoy it ;]









