Skip to content

Instantly share code, notes, and snippets.

View flada-auxv's full-sized avatar
🎯
Focusing

flada-auxv flada-auxv

🎯
Focusing
View GitHub Profile
@flada-auxv
flada-auxv / enumetric.rb
Created September 15, 2012 19:14 — forked from l15n/enumetric.rb
Roughly estimate usage of Enumerable methods
#! /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\.\{\(=]'
@flada-auxv
flada-auxv / hello.js
Created November 23, 2012 08:51 — forked from shigeki/hello.js
第1回Node.js入門勉強会 レポート課題
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/');
});
@flada-auxv
flada-auxv / stack.rb
Created December 4, 2012 03:15 — forked from JoshCheek/stack.rb
The stack from my Pry screencast
# 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
# coding: utf-8
class Concern < ActiveRecord::Base
belongs_to :publication
end
#!/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)