Skip to content

Instantly share code, notes, and snippets.

def thing(params = {})
params ||= {}
# ...
end
#!/usr/bin/env ruby
ports = `port installed | grep -v active`.split("\n")[1..-1]
ports.each do |port|
system('sudo', 'port', 'uninstall', *port.split)
end
def address(separator)
"#{billing_address1}#{separator}#{billing_address2}#{separator}#{billing_city}#{separator}#{billing_state} #{billing_zip}#{separator}#{billing_phone}"
end
11:04 <aniero> suss: case statements on class?
11:05 <aniero> aww
11:06 <Defiler> those are handy
11:06 <Defiler> unless you mean case foo.class in which case that is dumb
11:06 <Defiler> but if you mean case foo;when String;when Array... those are nice
state_machine :initial => :unpaid do
event :pay do
transition :unpaid => :paid
end
end
class Blah
def blah
puts 'hey'
extend Feh
blah
puts 'x'
end
end
module Feh
gist_ql()
{
GIST=$1
TMPFILE=~/tmp/gist_$GIST
gist $GIST > ~/tmp/gist_$GIST
qlmanage -c public.plain-text -p $TMPFILE >& /dev/null
}
class Visit
# has date, place
def check_something(blah)
# do stuff, very similar to Place#check_something
# and in fact using my own date instead of the argument
end
end
class Place
#!/usr/bin/env ruby
$:.unshift(File.expand_path('~/dev/projects/others/cinch/lib/'))
require 'cinch'
bot = Cinch::Base.new
bot.options.server = 'irc.freenode.org'
bot.options.nick = 'cardroid'
bot.options.channels = %w[#namaste_bitches]
tell application "iTunes"
set x to {user playlist "motown", user playlist "blues"}
set y to {}
repeat with t in x
copy name of t as string to end of y
end repeat
-- set y to name of every item of x
y
end tell