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
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 |
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
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 |
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
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}[]" |
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
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 |
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
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 |
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
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) |
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
#!/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. |
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
# 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 | |
# |
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
require 'net/http' | |
require 'json' | |
class GithubAPI | |
HOST = "github.com" | |
API = "/api/v2" | |
attr_accessor :format | |
attr_reader :response, :user | |
OlderNewer