Skip to content

Instantly share code, notes, and snippets.

View Sutto's full-sized avatar

Darcy Laycock Sutto

View GitHub Profile
#rule, another.rule
{
property: value;
property: value;
xlproperty: value;
}
# Let IRB notify you of a long running task,
# using blocks.
def say(text)
system "say", text.to_s
end
def growl(msg, title = "hallo thar!", sticky = false)
args = ["growlnotify", "-n", "irb", "-m", msg, title]
args << "-s" if sticky
task :check_revision do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts ""
puts " \033[1;33m**************************************************\033[0m"
puts " \033[1;33m* WARNING: HEAD is not the same as origin/master *\033[0m"
puts " \033[1;33m**************************************************\033[0m"
puts ""
end
end
@Sutto
Sutto / a.rb
Created January 13, 2009 03:28
# Require RubyGems by default.
require 'rubygems'
# Require UtilityBelt for lots of functionality
# http://utilitybelt.rubyforge.org/
require 'utility_belt'
UtilityBelt::Equipper.equip(:defaults)
UtilityBelt::Equipper.equip(:with, :string_to_proc, :pipe, :pastie, :not,
:language_greps, :is_an, :google,
:convertable_to_file, :clipboard,
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the transceivers plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
require 'uri'
require 'net/http'
require 'xmlsimple'
# A Nice wikipedia blabber extension for your amusement
module MatzBot::Commands
# eh?
# needs_gem 'xml-simple' => ['lookup_request']
# gem 'xml-simple'
Goal is => Client.first.items... Can do with finder_sql, but want an activerecord way!
class Client < ActiveRecord::Base
has_many :contacts
has_many :tasks, :through => :contacts
has_many :items, :through => :contacts # THIS DOESNT WORK
end
class Contact < ActiveRecord::Base
belongs_to :client
require 'gruff'
class GitCommitGraph
Author = Struct.new(:name, :email)
Commit = Struct.new(:hash, :author, :time, :insertions, :deletions, :files_changed)
attr_accessor :time_spacing, :built, :repository, :since, :name, :commit_hash
attr_accessor :scale_type, :width, :height, :graph, :graph_type
gpb2 = "General Purpose Building 2: Lecture Theatre"
cssr = "Computer Science Seminar Room"
csl1 = "Computer Science Lab 2.01"
unit "CITS3201", "Human Computer Interaction" do |u|
u.has "Lecture", gpb2 do |e|
e.at "Monday, 13:00 for 1 hour"
e.at "Wednesday, 14:00 for 1 hour"
end
task :check_revision do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts ""
puts " \033[1;33m**************************************************\033[0m"
puts " \033[1;33m* WARNING: HEAD is not the same as origin/master *\033[0m"
puts " \033[1;33m**************************************************\033[0m"
puts ""
end
end