Skip to content

Instantly share code, notes, and snippets.

View ryan-allen's full-sized avatar
🐢
Turtles

Ryan Allen ryan-allen

🐢
Turtles
View GitHub Profile
dr nic! dr nic!
his custom codes are really shwick!
laziness he gives the flick!
dr nic! dir nic!
dr nic! coding boom!
queenslander presence in the room!
he'll move to tassie some day soon
dr nic! coding boom!
gnome-terminal --geometry="120x60"
// i was wondering...
var stu = {name:'stu'}
var ry = {name:'ry'}
var namer = function () {
print("wtf is this? it's " + this.name + "!!!")
}
stu.wtf = namer
// just how my cute lua test thingo worked, without setup and
// teardown and nesting :) in javascript!
var testrunner = {
run: function(tests) {
for (var test in tests) {
if (tests[test].call()) {
print(test + " passed.")
} else {
print(test + " FAILED!")
Instead of every person in the extended family buying a present for every person
in the extended family, which is like, totally crap, this year we played The
Present Game.
The game works by each participant buying some random gift, to the tune of a
budget (ours was $20 AUD), and they are wrapped and all put in a pile.
Every participants name is put in a bowl and someone draws and names the person
drawn. That person goes and picks a present, unwraps it in front of everyone
and shows them what it is.
# install the mysql gem on os x, when you have apple's ruby but macport's mysql:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/opt/local --with-mysql-lib=/opt/local/lib/mysql5/mysql \
--with-mysql-include=/opt/local/include/mysql5/mysql
class Withdrawal
workflow do
state :new do
event :request_amount, :transitions_to => :awaiting_payment
event :request_max, :transitions_to => :pending_end_of_month
end
state :awaiting_payment do
event :pay, :transitions_to => :paid
@ryan-allen
ryan-allen / gist:100415
Created April 23, 2009 09:07
.vimrc, .gvimrc, .bash_profile
export EDITOR=vi
export HISTFILESIZE=1000000
alias ls="ls -laGh"
alias mysql="mysql5 -u root $1"
PS1="\w $ "
set -o vi
alias vim=vi
# I want to say all four tabs have the same set of fields
has_dialog :add_reagent_dialog do
@common_bits = lambda do
has_drop_down :default_staining_protocol1
has_drop_down :default_staining_protocol2
has_drop_down :default_staining_protocol3
has_drop_down :default_staining_protocol4
end
# I don't tend to like writing this kind of code:
if Rails.env == 'development' or Rails.env == 'staging'
# ...
end
# So, an alternative Ruby way to do this is:
if %w(development staging).include?(Rails.env)
# ...