Skip to content

Instantly share code, notes, and snippets.

View craigw's full-sized avatar
🦄

Craig R Webster craigw

🦄
View GitHub Profile
execute "create-application-database" do
command "/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} --exec='CREATE DATABASE IF NOT EXISTS `#{node[:company_name][:application_name][:database][:name]}`'"
end
# Get a list of all MPs as a CSV file
require 'rubygems'
require 'hpricot'
require 'open-uri'
doc = Hpricot(open('http://www.parliament.uk/mpslordsandoffices/mps_and_lords/alms.cfm').read)
mps = ((doc / "table").to_a[4] / "tr").to_a
mps.shift
Kernel.module_eval do
alias argh_eval eval
def eval(*args)
puts "QUIT USING EVAL DAMNIT"
argh_eval(*args)
end
end
%w{ apache2 apache2::mod_ssl apache2::mod_proxy_balancer apache2::mod_rewrite
apache2::mod_expires }.each do |cb|
depends cb
end
#! /bin/bash
GIT_BRANCH=$1
SVN_BRANCH=`basename $GIT_BRANCH`
git checkout master > /dev/null
git svn branch $SVN_BRANCH > /dev/null
git svn fetch > /dev/null
git branch -r |grep $SVN_BRANCH > /dev/null
if [ "$?" != "0" ]; then
actionmailer (2.3.2, 2.2.2, 2.1.0, 2.0.2, 1.3.3)
actionpack (2.3.2, 2.2.2, 2.1.0, 2.0.2, 1.13.3)
actionwebservice (1.2.3)
activerecord (2.3.2, 2.2.2, 2.1.0, 2.0.2, 1.15.3)
activeresource (2.3.2, 2.2.2, 2.1.0, 2.0.2)
activesupport (2.3.2, 2.2.2, 2.1.0, 2.0.2, 1.4.2)
ar_mailer (1.3.1)
archive-tar-minitar (0.5.1)
aws-s3 (0.4.0)
BlueCloth (1.0.0)
# app/models/physical/organisation.rb
module Physical
class Organisation < ActiveRecord::Base
validates :foo, :bar, :baz, :quuz
end
end
# app/models/physical/user.rb
module Physical
class User < ActiveRecord::Base
# how to test that this works?
# or would you even bother?
...
begin
require 'system_timer'
rescue LoadError
require 'timeout'
SystemTimer = Timeout
<li typeof="event:Event" id="lrug" about="http://lrug.org/#meeting">
<h2 rel="event:agent"><a typeof="foaf:Group" property="foaf:name" rel="foaf:homepage" href="http://lrug.org/">LRUG</a></h2>
<p class="who">Rubyists</p>
<p property="event:Time" class="when">Second Wednesday</p>
</li>
# subscr_eot: When a subscription has been cancelled you'll get this
# after the paid up term is finished. If the subscription is
# cancelled because the client can't pay on the renewal date
# (perhaps their credit card has expired, or their funding
# source is somehow removed) then you'll get this straight
# away.
#
# subscr_cancel: When a client cancels their subscription you'll imediately
# receive a subscr_cancel IPN. The paid-for term hasn't ended
# yet though (that's a subscr_eot), so don't cancel their