Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
kinsteronline / rack_example.ru
Created December 8, 2011 16:12 — forked from mattetti/rack_example.ru
Very basic rack application showing how to use a router based on the uri and how to process requests based on the HTTP method used.
#########################################
# Very basic rack application showing how to use a router based on the uri
# and how to process requests based on the HTTP method used.
#
# Usage:
# $ rackup rack_example.ru
#
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas
# $ curl localhost:9292/ideas
def complete_facebook_connect
within_window "Log In | Facebook" do
fill_in 'Email:', with: fb_user.email
fill_in 'Password:', with: fb_user.password
click_button "Log In"
# syncronization makes this never return, maybe because
# it's running in a different window?
without_resyncronize { click_button "Allow" }
end
end
@kinsteronline
kinsteronline / async.coffee
Created November 29, 2011 04:23 — forked from deedubs/async.coffee
Using coffeescript vowsjs for Async tests
vows = require 'vows'
assert = require 'assert'
cb = (callback) ->
setTimeout ->
callback(null, 'callback')
, 2000
andWaitForCallback = undefined
@kinsteronline
kinsteronline / gist:1285151
Created October 13, 2011 18:57 — forked from dhh/gist:1284958
Smart use of #tap by dhh
def revoke(user)
proxy_association.owner.tap do |project|
# You can't remove the last user with access (someone has to have access to the project!)
if project.users.many?
if user.pending? && user.projects.one?
user.destroy
else
project.users.delete(user)
user.touch
end
@kinsteronline
kinsteronline / gist:1078947
Created July 12, 2011 20:47
One word bundle exec rake
alias brake="bundle exec rake $1"
var pitBoss = require('pit_boss');
// How about...
pitBoss.listen(29999);
// Or...
pitBoss.set(port: 29999).start();
// Getting worse...
pitBoss.set(port: 29999, tables: 4).onDone(function() { alert('oh noes'); }).start();
function Player() {
this.totalChips = 0.0;
}
Player.prototype.chipCount = function() {
return this.totalChips;
};
module.exports = Player;
function Player() {
this.totalChips = 0.0;
}
Player.prototype.chipCount = function() {
@kinsteronline
kinsteronline / gist:906963
Created April 7, 2011 03:15
Inspiration Imagery
http://en.wikipedia.org/wiki/File:Casino_Atari_cover.jpg