Skip to content

Instantly share code, notes, and snippets.

module Publishers
class HTTP
attr_accessor :key
attr_reader :hosts
def initialize attributes = nil
attributes ||= {}
self.event = attributes[:event]
self.hosts = attributes.fetch(:hosts) do
[github]
user = coop
[user]
name = Tim Cooper
email = [email protected]
[alias]
c = commit -v
co = checkout
put = push origin HEAD
s = status --short
module API
module Private
class IncomingController < ApplicationController
attr_writer :payload
respond_to :json
def receive
key = payload.keys.first
object = {'charity' => Charity}.fetch(key).new payload[key]
client = Client.new RedisWhere.new
client.track event
class RedisWhere
def name
'redis'
end
def track message
$redis.rpush *message
namespace :app do
desc <<-DESC
Change application permissions.
Because the user deploying the application is different to the user
running the application we need to ensure that the permissions on
directories are what we expect.
DESC
task :permissions do
run "chown -R #{user}:www-data #{latest_release}"
@coop
coop / hosts
Created August 5, 2012 07:35
Everyday Hero hosts file
core: 'http://localhost:3000'
heroix: 'http://localhost:3001'
admin: 'http://localhost:3002'
passport: 'http://localhost:3003'
fundraiser: 'http://localhost:3004'
financials: 'http://localhost:3005'
recruitment: 'http://localhost:3006'
@coop
coop / view.handlebars
Created July 23, 2012 09:17
Getting access to form properties in Ember.js
<form>
<div>
<label for="name">Name</label>
{{view Ember.TextField valueBinding="view.name"}}
</div>
<div>
<label for="application">Application</label>
{{view Ember.TextField valueBinding="view.file" type="file"}}
</div>
#!/usr/bin/env ruby
fork do
Process.setsid
exit if fork
if File.exists?('/path/to/pid.pid')
puts 'Pidfile already exists, not starting.'
exit 1
end
#!/bin/sh
if ! [ `which brew` > /dev/null ]; then
echo "Installing Homebrew" >&2
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
PACKAGES=( redis memcached rabbitmq mysql imagemagick )
for PACKAGE in ${PACKAGES[@]}
do
App = Ember.Application.create()
App.store = DS.Store.create({
revision: 4,
adapter: DS.RESTAdapter.create({bulkCommit: false})
});
App.User = DS.Model.extend({
name: DS.attr('string'),
email: DS.attr('string')
})