Skip to content

Instantly share code, notes, and snippets.

@pietern
pietern / gist:304759
Created February 15, 2010 16:18 — forked from sandro/gist:204016
# ARCHFLAGS may or may not matter - I set mine up this way just in case.
~$ echo $ARCHFLAGS
-arch i386 -arch x86_64
# Be sure to compile ruby with --enable-shared
~$ rvm install 1.9.1 --debug --reconfigure -C --enable-shared=yes
# Test to ensure that --enable-shared worked
~$ ruby -e "require 'rbconfig'; puts Config::CONFIG['ENABLE_SHARED']"
yes
##
# test/spec/mini 3
# http://gist.github.com/25455
# chris@ozmm.org
# file:lib/test/spec/mini.rb
#
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
// this scopes the contents to the current spec
// doesn't matter if callback is fired way later than timeout
it "should work"
var contents
fs.readFile('foo', function(err, c){
contents = c
})
wait(-{
contents.should.eql 'bar'
@pietern
pietern / example.js
Created December 30, 2010 10:58 — forked from mranney/example.js
var client = require("redis").createClient(),
util = require("util");
client.set("some key", "A value with Unicode: ☕");
client.get("some key", function (err, reply) {
// a wise user also checks for errors
console.log("Reply: " + reply);
client.quit(function(err, reply) {
console.log("Quit: " + reply);
@pietern
pietern / bug.rb
Created May 5, 2011 14:04 — forked from antirez/bug.rb
require 'rubygems'
require 'redis'
def random_data
r = rand(2)
if r == 0
return rand(10000)
elsif r == 1
return "x"*rand(520)
end