Skip to content

Instantly share code, notes, and snippets.

View dstrelau's full-sized avatar

Dean Strelau dstrelau

View GitHub Profile
[parallel] time coffee usage.coffee
{ '0': 'response for /movies'
, '1': 'response for /books'
}
{ '0': 'response for /tv-shows'
, '1': 'response for /blogs'
}
real 0m1.234s
user 0m0.178s
@dstrelau
dstrelau / README
Created July 20, 2010 01:54
Delegation with send(m,*a) { yield }
== DELEGATING WITH method_missing ==
= This works:
send(method, *args, &block)
...but it can use lots of memory: see http://blog.pluron.com/2008/02/rails-faster-as.html
= This works:
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
source :rubygems
gem 'rack-test', :require => 'rack/test'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
@dstrelau
dstrelau / app.rb
Created November 22, 2010 20:36
Gollum protected by HTTP Basic
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash)
before { authenticate! }
helpers do
def authenticate!
@dstrelau
dstrelau / beer.coffee
Created April 20, 2011 14:02
server.coffee
exports.alcohol = true
exports.go = ->
require module for module in findModules()
boot()
@dstrelau
dstrelau / a.rb
Created May 10, 2011 18:04 — forked from rondevera/results.txt
#define_method vs ActiveSupport::StringInquirer
class A
attr_accessor :kind
def initialize(kind)
self.kind = kind
end
def one? ; self.kind == 'one' ; end
def two? ; self.kind == 'two' ; end
def three? ; self.kind == 'three' ; end
This file has been truncated, but you can view the full file.
A
a
aa
aal
aalii
aam
Aani
aardvark
aardwolf
Aaron
@dstrelau
dstrelau / captcha.mkd
Created June 3, 2011 15:44
Hipster CAPTCHA

hipster captcha

Yah, it's quite an obscure word, you probably haven't heard of it

Yah, that captcha was cool, until everyone found out about it

I preferred that captcha's earlier work

All the cool captcha's have already gone on to triangle waves

Writing objects: 100% (1/1), 165 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Push worked, but post-receive failed: Connection reset by peer
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:234:in `ensure_connected'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:114:in `process'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:183:in `logging'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:113:in `process'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:38:in `call'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis.rb:428:in `sadd'
remote: /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'