Code coloring by any other color is… well.

So I think that I found the plugin that I will be using for code coloring. It is called WP-Syntax and it is based off of GeSHi, which is apparently some sort of code highlighter project made by Einstein’s head, space aliens, angels, and geniuses from the third dimension. Also, it is open source, and that makes me feel good inside. I love open source I LOVE OPEN SOURCE!

To try it out, I think I will give a couple implementations of FizzBuzz using some random languages that I know. If you don’t know what FizzBuzz is, may God have mercy on your soul. Let’s journey down the path together, gentle friend, and find out if this here plugin is a pot of gold, or a pile of horsesh_t!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/*Mediocre FizzBuzz Implementation in PHP*/ 
for( $i = 1; $i < 101; $i++ ){
	if( $i % 3 == 0 && $i % 5 == 0 ){
		echo 'FizzBuzz<br/>';
	} elseif(  $i % 3 == 0 ){
		echo 'Fizz<br/>';
	} elseif( $i % 5 == 0 ){
		echo 'Buzz<br/>';
	} else {
		echo $i . '<br/>';
	}
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
<!-- Mediocre FizzBuzz Implementation in Coldfusion -->
<cfloop from="1" to="100" index="i">
	<cfif i mod 3 AND i mod 5 EQ 0>
		FizzBuzz<br/>
	<cfelseif i mod 3 EQ 0>
		Fizz<br/>
	<cfelseif i mod 5 EQ 0>
		Buzz<br/>
	<cfelse>
		<cfoutput>#i#</cfoutput><br/>
	</cfif>
</cfloop>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* Mediocre FizzBuzz Implementation in javascript...
Anyone who calls javascript ecmascript is a pretentious ass */
 
for( i = 1; i < 101; i++ ){
	if( i % 3 == 0 && i % 5 == 0 ){
		console.log( 'FizzBuzz' );
	} else if(  i % 3 == 0 ){
		console.log( 'Fizz' );
	} else if( i % 5 == 0 ){
		console.log( 'Buzz' );
	} else {
		console.log( i );
	}
}
1
2
3
4
5
6
7
--This is not fizzbuzz, because I am too dumb to write FizzBuzz in SQL as a stored proc or function using TSQL or PSQL.
--If you know how, by all means enlighten us in the comments.
SELECT		column1, column2, SUM(column3) AS sumColumn
FROM		exampleTable
WHERE		someValue = '12345'
GROUP BY	column1, column2
ORDER BY	id

Well, folks, there you have it. Clearly, this plugin is a pot of gold. You can see that the code coloring looks freaking fantastic. Great job to the smarty smartpants that made this plugin, and also to the talented programmers that contribute to GeSHi! I’m still going to check out a javascript implementation of the same thing, just because I like also having the ability to copy and paste without line numbers, etc. But, this is pretty cool, eh? The formatting looks real purty.

UPDATE – 21 Feb 2011

Well, I’m kind of bummed. The code coloring for php looks pretty terrible in chrome and firefox. (Which are mostly the only browsers that I use.) Also, the SQL code coloring doesn’t appear to support SQL comments very nicely. Looks like I might have to do a little checking and find out if I can fix it, or if it might be something that is wrong with the plugin itself.

UPDATE to MY UPDATE- 21 Feb 2011

It looks like I can fix both of my problems. For the php issue, I was missing one double quote in the line attribute of the pre tag, so my bad! For the SQL comment issue, I just use — instead of // and all is peachy. Huzzah! I’m happy again! Also, copying and pasting works great even with line numbers, because of how they mark up the text. Brilliant. I think this is a keeper!

Hello world, indeed.

Welcome to WordPress the Lair of the Laser Chicken! I am having the most lovely time trying to fix this here “blank” template, while listening to Young Jeezy and drinking a diet pepsi.  Problem is, I got myself a ‘lil error in my WordPress installation.  I finally found what the problem was.  It seems that the forward-thinking programmers that came up with the template I am using included a function called “get_post_format()”.  However, that function is not usable until version 3.1 of WordPress.  Herp derp!

Don’t worry though, I fixed it!  Now I just have to apply a lil bit of trusty css and then my site can be super fantastic.  The first thing that I have to discover is how to show code in the blog with nice colors, etc.  If anyone has any tips on that, put it in the comments please.