This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
next unless delivery_message = | |
begin | |
Message.find_by_id(message.id) | |
rescue SecurityContextException => ex | |
logger.warn{ "message_broadcaster Could not load message #{message.id} for user #{subscription.user.id}" } | |
end | |
if subscription.client.delivery_appropriate?(delivery_message) | |
# logger.debug{ "SENDING mid: #{message.id} to uid:#{subscription.client.user_id} client_id:#{subscription.client}" } | |
subscription.client.deliver_message(delivery_message) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compile the coffee in bare joined mode. | |
{exec, spawn} = require 'child_process' | |
fs = require 'fs' | |
util = require 'util' | |
print = (data) -> | |
console.log data.trimRight() | |
task 'build', 'Compile Coffeescript to Javascript', -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function House() { | |
this.vandalize = function() { | |
this.vandalized = true; | |
} | |
} | |
function Punk() { | |
this.onParty = function(handler) { | |
this.handler = handler; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stubs = [] | |
module.exports = | |
stub: (obj, name, fun) -> | |
stubs.push({'obj':obj, 'name':name, 'fun':obj[name]}) | |
obj[name] = if fun? then fun else -> | |
unstub: -> | |
for stubbed in stubs | |
stubbed.obj[stubbed.name] = stubbed.fun | |
stubs.length = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def run_testunit(runner, path) | |
path = path.gsub(/\/?test\/?/, '') | |
path.gsub!(/_test.rb/, '') | |
exec "#{runner} -I'test' test/#{path}_test.rb" | |
end | |
def run_unit(runner) | |
run_testunit runner, "unit/#{ARGV[1]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'tinder' | |
class Campfire | |
attr_reader :config | |
def initialize(config) | |
@config = config | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This plugin will deploy your app using capistrano. | |
# If the build fails the app won't de be deployed and if it passes it will try to deploy to a list of stages you can supply. | |
# | |
# Configuration | |
# In your project's cruise_config.rb file: | |
# | |
# Pass an array of stages you want to deploy to | |
# project.cap_deployer.stages = ['integration', 'staging'] | |
# | |
# source ~/.rvm/scripts/rvm before deployment? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def PostsController < ActionController::Base | |
def create | |
@post = Post.new(params[:post]) | |
if @post.save | |
redirect_to posts_path | |
else | |
render :action => "new" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def named_matches(rx) | |
m = rx.match(self) | |
[Hash[m.names.collect{|n| [n, m[n]]}]] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.inspect = function () { | |
function pad(depth) { | |
return Array(depth).join(" "); | |
} | |
function down(attr, val, depth) { | |
var output = pad(depth) + attr + ': '; | |
output += (typeof(val) == 'object' ? "{" : val); | |
return output + "\n"; | |
} |