This file contains hidden or 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
# usage: Process.alive? 1 | |
# > true | |
module Process | |
class << self | |
def alive?(pid) | |
return false if pid.nil? | |
begin | |
Process.kill(0, pid.to_i) | |
status = true | |
rescue Errno::ESRCH |
This file contains hidden or 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
source 'http://rubygems.org' | |
# app base | |
gem 'logger' | |
gem 'rack' | |
gem 'sinatra' | |
gem 'sinatra-assetpack' | |
gem 'sprockets' | |
gem 'sprockets-helpers' |
This file contains hidden or 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
# extend any ActiveRecord model with a fast method | |
# for selecting rows. | |
# | |
# this is useful for parallel processes that work on | |
# subsets of large tables. | |
# | |
# ex: | |
# process A needs to work on all odd numbered Posts, | |
# process B needs to work on all even numbered Posts. | |
# |
This file contains hidden or 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
// backbone-data-queue.js 1.0.0 | |
// extends the base Backbone Router class with a helper method to | |
// perform a batch data load. | |
// | |
// call this with an array of Backbone models/collections. it returns | |
// a function that accepts success and error callbacks. the appropriate | |
// callback will be fired when the batch operation is complete. | |
// | |
// usage (in a Backbone router): |