This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# | |
# enumetric.rb | |
# | |
# Rough estimate of usage/non-usage of Enumerable methods | |
TRIVIAL_METHODS = [:first, :count, :to_a] | |
def count_usage(method, dir = '.') | |
method_delimiter = '[\s\.\{\(=]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
server = http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
server.close(); | |
}); | |
server.listen(8080, 0, function () { | |
console.log('Server running at http://localhost:8080/'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The stack I wrote for http://vimeo.com/26391171 | |
# Note that there is an intentional bug in the each method :) | |
class Stack | |
Node = Struct.new :data, :next | |
def push(data) | |
@head = Node.new data, @head | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
class Concern < ActiveRecord::Base | |
belongs_to :publication | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/ruby1.9 | |
#-*-encoding: utf-8-*- | |
class Env < Hash | |
def initialize(parms=[], args=[], outer=nil) | |
h = Hash[parms.zip(args)] | |
self.merge!(h) | |
@outer = outer | |
end | |
def find(key) |