Code and stuff!

Written by Shane Cooke

Syntax highlighting with highlight.js. The theme used is tomorrow, you can find more themes here.

JavaScript

function getRandomNumber() {
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

CoffeeScript

class Animal
  ### Intellegent design ###
  getDNA: ->
    print 'sequencing...'
    while true
      sleep 1

class Monkey extends Animal
  speak: ->
    print 'ah ah ah'

class Human extends Monkey
  speak: ->
    print ['yolo' unless i % 3] + ['swag' unless i % 5] or i for i in [1..100]

C

#include <stdio.h>

int main(void)
{
  printf("Hello world\n");
  return 0;
}

C++

#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}

C-sharp

class ExampleClass
{
    static void Main()
    {
        System.Console.WriteLine("Hello, world!");
    }
}

Erlang

io:format("~s~n", ["hello, world"])

Go

package main

import "fmt"

func main() {
   fmt.Println("Hello World!")
}

Java

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello world!");
   }
}

ObjectiveC

#import <stdio.h>

int main(void)
{
    printf("Hello, World!\n");
    return 0;
}

PHP

<?php echo 'Hello, world'; ?>

Python

print("Hello World")

Ruby

puts "Hello world!"