Skip to content

Instantly share code, notes, and snippets.

View tritonrc's full-sized avatar

Brian McKinney tritonrc

View GitHub Profile
@tritonrc
tritonrc / example_stack.js
Created February 10, 2012 18:13
Example Dreadnot stack with Rails 3.2 and Heroku
var async = require('async')
var git = require('util/git')
var misc = require('util/misc')
exports.get_deployedRevision = function(args, callback) {
git.revParse(this.config.program_creator_dir, 'HEAD', function(err, stdout) {
callback(null, stdout.replace(/^\s+|\s+$/g, ''))
})
}
@tritonrc
tritonrc / config.ru
Created May 11, 2011 15:01
Simple rackup file that serves static files only
app = proc do |env|
Rack::File.new('.').call(env)
end
run app
@tritonrc
tritonrc / github_jabber_hook.rb
Created April 21, 2011 17:22
Sinatra based Github hook that sends commit information to a Jabber chat room
require 'rubygems'
require 'sinatra'
require 'xmpp4r'
require 'xmpp4r/muc'
require 'json'
CONFIG = YAML.load_file('config.yml')
jid = Jabber::JID::new(CONFIG['user_jid'])
client = Jabber::Client::new(jid)
@tritonrc
tritonrc / ldap_admin.rb
Created January 17, 2011 19:55
Simple Sinatra based LDAP admin tool
require 'rubygems'
require 'sinatra'
require 'net-ldap'
require 'digest/sha1'
require 'base64'
require 'haml'
LDAP_HOST = 'localhost'
ADMIN_DN = 'cn=admin,dc=company,dc=com'
@tritonrc
tritonrc / config.yml
Created January 17, 2011 18:51
Sinatra based Github hook that appends commit information to JIRA tickets
prefix: /github_hook
www:
username: github
password: github
url: http://localhost:7080/jira
key: WEB
class SinatraApp < Sinatra::Base
get '/' do
'Hello from Sinatra'
end
end
RailsApp::Application.routes.draw do |map|
match '/applications/sinatra/*path' :to => proc { |env|
#BTM - PATH_INFO contains the full path (e.g. '/applications/sinatra/...')
#which we don't want to pass along to the sinatra app since we want
@tritonrc
tritonrc / longpoll.js
Created November 15, 2009 21:59
Javascript XPCOM Long-poll Singleton
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gLongPollInstance = null;
function LongPoll() {
if(gLongPollInstance)
return gLongPollInstance;
gLongPollInstance = this;
this.wrappedJSObject = this;