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 'blather/client' | |
setup 'hello@highgroove.com', '******', 'talk.google.com' | |
message :chat?, :body do |m| | |
write_to_stream "I am a robot!" | |
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
class EventsController < AdminController | |
def index | |
@days_with_events = Events.all.map(&:to_days).flatten.uniq | |
end | |
end | |
class Event < ActiveRecord::Base | |
def to_days | |
(started_at.to_date..ended_at.to_date).to_a | |
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
.... | |
requirements = scoped_requirements_for_index_or_export.page(page).per(params[:per_page]).all | |
requirements.map(&:id) #apparently makes this work.... | |
logger.debug "DEBUG: Requirement: #{@requirement.id}" | |
logger.debug "DEBUG: Last Requirement: #{requirements.last.id}" | |
if requirements.last.id == @requirement.id and requirements.num_pages != page | |
.... |
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 'rubygems' | |
require 'bundler' | |
Bundler.require | |
Ripple.client = Riak::Client.new(:host => "#{HOST}") | |
class Stat | |
include Ripple::Document | |
property :message, String | |
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
// Format for Stat objects (in json) | |
{ | |
"token": "cbbae92d897f244cf65104a574fb60afdf000ddb", | |
"timestamp": 1316134227, | |
"v": 2, | |
"employee_range": "Enterprise", | |
"company_size": "Enterprise", | |
"revenue_range": "Over $5B", | |
"ip": 219025168, |
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
# Input - Lunch Records | |
# { "date": "10-25-2011", "tasty": true, "food": "pizza", "restaurant": "Antico Pizza" } | |
# { "date": "10-24-2011", "tasty": true, "food": "tacos", "restaurant": "Taqueria del Sol" } | |
# { "date": "10-23-2011", "tasty": false, "food": "wings", "restaurant": "Wing Nuts" } | |
# { "date": "10-22-2011", "tasty": true, "food": "sandwiches", "restaurant": "Super Pan" } | |
# { "date": "10-22-2011", "tasty": true, "food": "pizza", "restaurant": "Fellini's Pizza" } | |
class TastyMapper < Wukong::Streamer::LineStreamer | |
def process(line) | |
lunch = JSON.parse(line) |
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
grouped_sessions = self.values.map do |token, requests| | |
requests_by_time = requests.sort_by { |r| r[:timestamp] } | |
previous_timestamp = nil | |
sessions_by_time = requests_in_order.chunk do |r| | |
r[:timestamp] != previous_timestamp | |
end.map(&:last) | |
sessions_by_user = sessions_by_time.map do |requests| | |
requests.group_by { |r| r[:user_agent] }.values |
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 'formula' | |
class Thrift < Formula | |
homepage 'http://incubator.apache.org/thrift/' | |
head 'http://svn.apache.org/repos/asf/incubator/thrift/trunk' | |
url 'http://archive.apache.org/dist/incubator/thrift/0.5.0-incubating/thrift-0.5.0.tar.gz' | |
md5 '14c97adefb4efc209285f63b4c7f51f2' | |
depends_on 'boost' |
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.exports = { | |
pivotal: { | |
TOKEN: 'TOKEN' | |
PID: 'PID', | |
}, | |
sprintly: { | |
USER: "USER_EMAIL", | |
ID: 'PRODUCT_ID', | |
KEY: 'API_KEY' | |
}, |
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
message :chat? do |message| | |
say message.from, "Oh hai!" | |
end |