Skip to content

Instantly share code, notes, and snippets.

View aflatter's full-sized avatar

Alexander Flatter aflatter

View GitHub Profile
require 'rubygems'
require 'eventmachine'
class Handler
include EventMachine::Deferrable
def takes_long_time(seconds = 5)
sleep(seconds)
puts "Awoke after #{seconds} seconds."
succeed(seconds)
[14:09] steveb: hah! i had that problem
[14:09] steveb: and you're going to ask me how i fixed it
[14:09] steveb: and i dont know
[14:09] kamalfariz_: steveb: how did you fix it?
#
# Chef Client Config File
#
log_level :info
log_location STDOUT
ssl_verify_mode :verify_none
registration_url "http://localhost:4000"
openid_url "http://localhost:4001"
template_url "http://localhost:4000"
We couldn’t find that file to show.
var common = require('../common'),
assert = common.assert;
var Script = process.binding("evals").Script;
var sandbox = Script.createContext({x: "x"});
sandbox.window = sandbox;
//Script.runInContext("window = this;", sandbox);
@aflatter
aflatter / inter.js
Created April 4, 2011 19:59 — forked from phreax/inter.js
var app = require('app')
var assert = require('assert')
var db = app.db;
var get_state = function(callback) {
db.get('_state', function(err,doc) {
if(err) {
@aflatter
aflatter / inter.js
Created April 4, 2011 20:55 — forked from phreax/inter.js
var app = require('app')
var assert = require('assert')
var db = app.db;
var get_state = function(cb) {
db.get('_state', function(err,doc) {
if(err) {
@aflatter
aflatter / test.html
Created December 15, 2011 14:40
Webkit transitions on a newly attached element don't work. Probably related to http://code.google.com/p/chromium/issues/detail?id=82500
<html>
<head>
<title>Test</title>
<style type="text/css">
div {
position: absolute;
height: 200px;
}
.slide {
@aflatter
aflatter / future_plexer.rb
Created May 8, 2013 00:52
The FuturePlexer for Celluloid :-)
require 'celluloid'
class FuturePlexer
class DrainedError < StandardError; end
attr_accessor :futures
def initialize(futures)
self.futures = futures
end
require 'celluloid'
def pusher(condition)
sleep 5
condition.signal 'Wibble'
end
def puller(condition)
value = condition.wait
puts "Pulled: #{value}"