Skip to content

Instantly share code, notes, and snippets.

############# THIS IS WITHIN THE LIBRARY #############
class Foo
def initialize(a, b, c, opts={})
#do some stuff
end
end
######################################################
var foo = {
bar: 3,
baz: function(){ /* a function body */}
}
foo.quxx = function(){ /* a function body */}
class Chocolate
def white?; ...; end;
def caffeinated?; ...; end;
def imported?; ...; end;
end
#main script
@eqdw
eqdw / gist:1336975
Created November 3, 2011 16:32
EASIEST MERGEFIX EVER
<<<<<<< HEAD
=======
>>>>>>> payroll
@eqdw
eqdw / life.rb
Created December 3, 2011 20:13
Conway's Game of Life
infile = ARGV[0]
@gridsize = ARGV[1].to_i
@world = Array.new(@gridsize+2){|i| Array.new(@gridsize+2){"."}}
File.open(infile, "r") do |f|
(1..@gridsize).each do |i|
row = f.gets
rowarr = row.split(" ")
@eqdw
eqdw / gist:1894268
Created February 23, 2012 18:39
CS STUDENTS? Y U NO ESCAPE PARAMS
<?php
// Get team ID from url
$teamID = $_GET["team"];
// - SQL Queries
// Get university and team name
$query = "SELECT * FROM `delegations` WHERE delegID = " . $teamID;
// I used to write like this
int foo(int herp, int derp)
{
if(herp > derp)
{
bar();
}
}
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
MICROSOFT.COM.ZZZZZZZZZZZZZZZZZZ.IM.ELITE.WANNABE.TOO.WWW.PLUS613.NET
MICROSOFT.COM.ZZZZZZ.MORE.DETAILS.AT.WWW.BEYONDWHOIS.COM
@eqdw
eqdw / pre-commit
Created June 4, 2012 18:40
Prevent committing debugger statements
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@eqdw
eqdw / parse_order.rb
Created July 19, 2012 20:29
parse_order.rb
foo.is_a? Bar && condition
#parses as
foo.is_a?( Bar && condition)