Skip to content

Instantly share code, notes, and snippets.

View dasch's full-sized avatar
💭
LOOKING INTENTLY INTO THE VOID

Daniel Schierbeck dasch

💭
LOOKING INTENTLY INTO THE VOID
View GitHub Profile
test:
adapter: sqlite3
database: ":memory:"
@dasch
dasch / compl1.rb
Created September 10, 2010 17:59 — forked from antirez/compl1.rb
Redis auto-completion
# compl1.rb - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
require 'rubygems'
require 'redis'
r = Redis.new
# Create the completion sorted set
if !r.exists(:compl)
@dasch
dasch / compl1.rb
Created September 10, 2010 17:59 — forked from antirez/compl1.rb
# compl1.rb - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
require 'rubygems'
require 'redis'
r = Redis.new
# Create the completion sorted set
if !r.exists(:compl)
@dasch
dasch / gist:1130665
Created August 7, 2011 19:09 — forked from dkubb/gist:1130086
case with predicates
require 'rubygems'
require 'backports' # aliases Proc#=== to Proc#call
rs = (0..10000).to_a.sample(30)
rs.each do |r|
case r
when lambda { |n| n.zero? } then puts "#{r} is zero"
when lambda { |n| (n % 5).zero? } then puts "#{r} is fiven"
when lambda { |n| (n % 4).zero? } then puts "#{r} is fourven"
@dasch
dasch / faster_helper.rb
Created January 25, 2012 12:18 — forked from dnagir/faster_helper.rb
The spec helper I use to run faster specs
ENV["RAILS_ENV"] ||= 'test'
cur_dir = File.expand_path(File.dirname(__FILE__) + '/..')
$LOAD_PATH << "#{cur_dir}"
if defined? Bundler
# Most likely going with the full env
require 'spec_helper'
else
$LOAD_PATH << "#{cur_dir}/app/models"