Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
PH33R-Book:~/Documents/Exco Ventures/Clients/BioBusinessTV/Projects/biobusiness-tv jkatz$ cap production deploy:long
* executing `production'
* executing `deploy:long'
** transaction: start
* executing `deploy:update_code'
* executing "git clone -q git@github.com:jkatz/biobusiness-tv.git /data/bbtv/releases/20081009033659 && cd /data/bbtv/releases/20081009033659 && git checkout -q -b deploy 0145054d04010dae4adbde8c7d41340d9f634eb7 && git submodule -q init && git submodule -q update && (echo 0145054d04010dae4adbde8c7d41340d9f634eb7 > /data/bbtv/releases/20081009033659/REVISION)"
servers: ["65.74.139.2"]
[65.74.139.2:8272] executing command
** [65.74.139.2 :: out] D vendor/plugins/acts_as_tree
** D vendor/plugins/rspec-rails
class Array
def columnize(n=1)
rows = []
y = (self.size / n.to_f).ceil
nmulti = (0...n).map {|n| y * n}
y.times do |x|
rows << self.values_at(*nmulti.map {|z| z + x}).compact
end
rows
def query_string_encode(data)
query = []
data.each { |k,v| query << query_type(k, v) }
query.join('&')
end
def query_string_encode_array(key, array)
query = []
array.each do |v|
url_key = "#{key.to_s}[]"
SELECT avg(sub.c) FROM (
SELECT count(DISTINCT split_part(email_address, '@', 2)) AS c
FROM guests
JOIN events ON events.id = guests.event_id JOIN contacts ON guests.contact_id = contacts.id
GROUP BY events.id
) AS sub
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe Events::TrackingController, 'blah' do
integrate_views
describe 'GET show' do
before do
event = EventSim.create!
get :show, :event_id => event.to_param
end
@jkatz
jkatz / state_machine.rb
Created February 5, 2010 21:27
Simple State Machine for an ActiveRecord model (see "after_initialize")
module StateMachine
# assumption: just using "state" as our column. easy enough to change
def self.included(mod)
mod.extend ClassMethods
super
end
module ClassMethods
def initial_state(state)
#!/bin/bash
# Install ImageMagick on Snow Leopard (10.6)
# Reported to work also on Leopard (10.5)
#
# Created by Claudio Poli (http://www.icoretech.org)
# Configuration.
# Set the sourceforge.net's mirror to use.
SF_MIRROR="heanet"
# ImageMagick configure arguments.
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
require 'net/http'
require 'json'
class GithubAPI
HOST = "github.com"
API = "/api/v2"
attr_accessor :format
attr_reader :response, :user