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 | |
require 'netrc' | |
require 'octokit' | |
org_name = ARGV[0] | |
unless org_name | |
abort "Usage #{$0} org_name" | |
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
# encoding: utf-8 | |
module Mongoid #:nodoc: | |
module Associations #:nodoc: | |
module EmbeddedCallbacks | |
# bubble callbacks to embedded associations | |
def run_callbacks(kind, *args, &block) | |
# now bubble callbacks down | |
self.associations.each_pair do |name, meta| | |
if meta.association == Mongoid::Associations::EmbedsMany |
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
# Basic tagging system for mongoid documents. | |
# jpemberthy 2010 | |
# | |
# class User | |
# include Mongoid::Document | |
# include Mongoid::Document::Taggable | |
# end | |
# | |
# @user = User.new(:name => "Bobby") | |
# @user.tag_list = "awesome, slick, hefty" |
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
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
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
# Neater Github gem dependencies for Rails | |
module GithubGem | |
def github_gem(gem_name, opts={}) | |
lib_name = gem_name.split('-', 2)[1] | |
self.gem gem_name, {:lib => lib_name, :source => 'http://gems.github.com'}.merge(opts) | |
end | |
end | |
Rails::Initializer.run do |config| |
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
# Lighter -- Campfire from the command line | |
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail | |
require "rubygems" | |
require "tinder" | |
require "readline" | |
require "highline/import" | |
class Lighter | |
def initialize(room) | |
@room = room |