Skip to content

Instantly share code, notes, and snippets.

View marclove's full-sized avatar

Marc Love marclove

View GitHub Profile
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
# be sure to replace "app_name" with the name of your application.
run_for_app("maloca") do |app_name, data|
@marclove
marclove / oauth2_example.rb
Created April 23, 2010 03:32 — forked from technoweenie/oauth2_example.rb
oauth2 facebook
# crappy server implementation using technoweenie/oauth2 (server branch)
# http://github.com/technoweenie/oauth2/compare/master...server
#
# ruby oauth2_example.rb -p 4568
# ruby oauth2_example.rb
# open http://localhost:4567/auth/facebook
require 'rubygems'
require 'sinatra'
require 'oauth2/client'
namespace :harmony do
desc "Munges the data"
task :munge => :environment do
docs_with_publish = Item.collection.find({'publish' => {'$exists' => true}}).to_a
puts "Item count: #{Item.count}"
puts "Items with publish key: #{docs_with_publish.size}"
docs_with_publish.each do |hash|
hash.delete('publish')
@marclove
marclove / iterator.rb
Created October 31, 2009 16:00 — forked from tmm1/iterator.rb
EventMachine::Iterator
module EventMachine
# A simple iterator for concurrent asynchronous work.
#
# Unlike ruby's built-in iterators, the end of the current iteration cycle is signaled manually,
# instead of happening automatically after the yielded block finishes executing. For example:
#
# (0..10).each{ |num| }
#
# becomes:
#
@marclove
marclove / sinatra_metal.rb
Created August 3, 2009 05:18 — forked from raggi/sinatra_metal.rb
How to mount Sinatra as Rails Metal
require 'sinatra/metal'
class SinatraMetal < Sinatra::Base
include Sinatra::Metal
get '/sinatra' do
'hello sinatra!'
end
end