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
| rails_root = "/data/github/current" | |
| 20.times do |num| | |
| God.watch do |w| | |
| w.name = "dj-#{num}" | |
| w.group = 'dj' | |
| w.interval = 30.seconds | |
| w.start = "rake -f #{rails_root}/Rakefile production jobs:work" | |
| w.uid = 'git' |
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
| class ActiveRecord::Base | |
| def self.find_values opts | |
| sql = self.send(:construct_finder_sql, opts) | |
| self.connection.select_values(sql) | |
| end | |
| end | |
| >> Tagging.find_values(:select => :taggable_id, :limit => 30, :order => 'tagged_at asc') | |
| => ["1", "3", "6", "6", "6", "10", "10", "10", "11", "11", "11", "10", "10", "10", "10", "10", "13", "13", "13", "13", "13", "13", "15", "15", "15", "15", "15", "15", "15", "15"] |
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
| require 'rubygems' | |
| require 'sinatra' | |
| require 'redis' | |
| # To use, simply start your Redis server and boot this | |
| # example app with: | |
| # ruby example_note_keeping_app.rb | |
| # | |
| # Point your browser to http://localhost:4567 and enjoy! | |
| # |
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
| require 'redis' | |
| module Nanite | |
| class State | |
| include Enumerable | |
| # this class encapsulates the state of a nanite system using redis as the | |
| # data store. here is the schema, for each agent we store a number of items, | |
| # for a nanite with the identity: nanite-foobar we store the following things: | |
| # |
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
| require 'net/http' | |
| module Net | |
| class HTTP | |
| alias :orig_initialize :initialize | |
| # Override HTTP#initialize to set a default @open_timeout to 10 secs. Original | |
| # initialize method sets @open_timeout to nil, causing connect to wait until |
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
| # SUPER DARING APP TEMPLATE 1.0 | |
| # By Peter Cooper | |
| # Link to local copy of edge rails | |
| inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
| # Delete unnecessary files | |
| run "rm README" | |
| run "rm public/index.html" | |
| run "rm public/favicon.ico" |
NewerOlder