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
Given this result set (this cannot be modified) that looks like: | |
[{"client name"=>"Adenbrook (Avalon Franchising Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"INTR - 1300 Phone Charges 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ADN2611"}, {"client name"=>"Adenbrook Homes (Morris Family Building Trust)", "job status wip c"=>"WIP", "job owner"=>"NSe", "job name"=>"PREL: Fixed Display Centre: Port Macquarie", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MBT2763"}, {"client name"=>"Media Shop", "job status wip c"=>"WIP", "job owner"=>"TCo", "job name"=>"Media Shop: Polypropylene folder - Contract & Documents", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"MED2801"}, {"client name"=>"Adenbrook Homes (Toolona NSW Pty Ltd)", "job status wip c"=>"WIP", "job owner"=>"CCo", "job name"=>"Media Shop: Tweed Richmond June 2010", "job billable"=>"Yes", "__uid"=>#, "invoice lock"=>nil, "job no"=>"ATR2817"}, {"client name"=>"Ad |
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
[github] | |
user = coop | |
token = 1234 | |
[user] | |
name = Tim Cooper | |
email = [email protected] | |
[apply] | |
whitespace = nowarn | |
[alias] | |
tug = pull |
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 'goliath' | |
class Hello < Goliath::API | |
def on_close(env) | |
env.logger.info "Connection closed." | |
end | |
def response(env) | |
i = 0 | |
pt = EM.add_periodic_timer(1) do |
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 LineItemObserver < ActiveRecord::Observer | |
def before_save record | |
current_date = record.order.start | |
reservations = record.product.reservations | |
while current_date < record.order.end | |
reservation = reservations.where(:day => current_date).first | |
if reservation.nil? | |
reservations.create :quantity => record.quantity, :day => current_date |
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 Order < ActiveRecord::Base | |
def each_day_in_period &block | |
current_date = start | |
while current_date < self.end | |
block.call current_date | |
current_date += 1.day | |
end | |
end | |
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
namespace :deploy do | |
desc "Deploy to Heroku" | |
task :heroku do | |
Rake::Task["deploy:precompile_assets_and_upload_to_s3"].invoke | |
Rake::Task["deploy:push_heroku"].invoke | |
end | |
desc "Precompile assets and upload to s3" | |
task :precompile_assets_and_upload_to_s3 do | |
storage = Fog::Storage.new :provider => 'AWS', :aws_access_key_id => "123", :aws_secret_access_key => "123" |
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
# ~/.zshrc | |
setopt auto_cd | |
cdpath=($HOME/Code) | |
$ pwd | |
/Users/timc | |
$ cd command_centre | |
$ pwd | |
/Users/timc/Code/command_centre |
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
// Controller for fetching the records | |
App.leaderboardController = SC.ArrayProxy.create({ | |
content: [], | |
loadUsers: function() { | |
var self = this; | |
$.getJSON('/leaderboard/username/year/month', function(data) { | |
data.forEach(function(leader) { | |
self.pushObject(leader.leader); |
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 FeaturesHash < HashWithIndifferentAccess | |
def with_features features | |
current = dup | |
replace features | |
yield | |
ensure | |
replace current | |
end | |
def method_missing method, *args, &block |
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
$ curl -i -H "Authorization: token my_token" https://api.github.com/orgs/everydayhero/repos | |
HTTP/1.1 200 OK | |
Server: nginx/1.0.4 | |
Date: Sun, 30 Oct 2011 01:02:50 GMT | |
Content-Type: application/json; charset=utf-8 | |
Connection: keep-alive | |
Status: 200 OK | |
X-RateLimit-Limit: 5000 | |
ETag: "55fef90d58683e3270408d09eae6ee71" | |
X-OAuth-Scopes: |
OlderNewer