Home

Preview

HTML

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title></title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <header></header>
  <div role="main"></div>
  <footer></footer>
  <script src="js/script.js"></script>
</body>
</html>

CSS

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 18px;
  color: #333333;
  background-color: #ffffff;
}

a {
  color: #0088cc;
  text-decoration: none;
}

a:hover {
  color: #005580;
  text-decoration: underline;
}

JavaScript

var Account;

Account = function(customer, cart) {
  var _this = this;
  this.customer = customer;
  this.cart = cart;
  return $('.shopping_cart').bind('click', function(event) {
    return _this.customer.purchase(_this.cart);
  });
};

CoffeeScript

class Animal
  constructor: (@name) ->

  move: (meters) ->
    alert @name + " moved #{meters}m."

class Snake extends Animal
  move: ->
    alert "Slithering..."
    super 5

class Horse extends Animal
  move: ->
    alert "Galloping..."
    super 45

sam = new Snake "Sammy the Python"
tom = new Horse "Tommy the Palomino"

sam.move()
tom.move()

Ruby

class Person
  include ActiveModel::Conversion
  include ActiveMode::Validations
  
  validates_presence_of :name
  
  attr_accessor :name
  
  def initialize(attributes = {})
    @name = attributes[:name]
  end
  
  def persist
    @persisted = true
  end
  
  def persisted?
    @persisted
  end
  
  person1 = Person.new(:name => "mats")
  p person1.valid?

Python

class Reporter(models.Model):
    full_name = models.CharField(max_length=70)

    def __unicode__(self):
        return self.full_name

class Article(models.Model):
    pub_date = models.DateTimeField()
    headline = models.CharField(max_length=200)
    content = models.TextField()
    reporter = models.ForeignKey(Reporter)

    def __unicode__(self):
        return self.headline

Perl

#!/usr/bin/perl

use strict;
use integer;

# the nth element of the fibonacci series
# param n - an int >= 0
# return an int >= 0
sub fib($) {
  my $n = shift, $a = 1, $b = 1;
  ($a, $b) = ($a + $b, $a) until (--$n < 0);
  return $a;
}

print fib(10);

Java

public class Demo {
  private static final String CONSTANT = "String";
  private Object o;
  /**
   * Creates a new demo.
   * @param o The object to demonstrate.
   */
  public Demo(Object o) {
    this.o = o;
    String s = CONSTANT;
    int i = 1;
  }
  public static void main(String[] args) {
    Demo demo = new Demo();
  }
}

Usage

It's pretty simple.

  1. Setup the Google Code Prettify.
  2. Load a downloaded CSS file instead of prettify.css.
  3. Beautiful.

Issues or Feedback

Have any requests or problems? Please report them to the GitHub issue tracker. Feel free to contact me through GitHub, fork the project and send a pull request.