Skip to content

Instantly share code, notes, and snippets.

View m0wfo's full-sized avatar

Chris Mowforth m0wfo

  • Planet Earth
View GitHub Profile
class Array
def include?(value)
self.each do |range|
return true if range.include?(value)
end
return false
end
end
class Account
def initialize(balance)
@balance = balance
end
def transfer_money(to,amount)
p "Sender now has #{balance - amount}"
p "Recipient now has #{to.balance + amount}"
end
class Account
def initialize(balance)
@balance = balance
end
def transfer_money(to,amount)
p "Sender now has #{balance - amount}"
p "Recipient now has #{to.balance + amount}"
end
curl -O http://www.smudge-it.co.uk/pub/apache/incubator/couchdb/0.8.1-incubating/apache-couchdb-0.8.1-incubating.tar.gz
tar -xzvf apache-couchdb-0.8.1-incubating.tar.gz; cd !$
sudo port install automake autoconf libtool help2man spidermonkey taglib icu
./configure
make
sudo couchdb
class Integer
def round_to_nearest(*args)
most = self % args[0]
most > (args[0]/2)? self - most + args[0] : self - most
end
end
anumber = 349
p anumber.round_to_nearest(50)
require 'net/telnet'
soundbridge = Net::Telnet.new(
'Host' => '192.168.2.105','Port' => '5555'
)
soundbridge.puts "SetPowerState on yes"
require 'rubygems'
require 'webrick'
require 'webrick/httpservlet/webdavhandler'
require 'icalendar'
require 'googlecalendar'
class WEBrick::HTTPServlet::WebDAVHandler
def do_PUT(req,resp)
c = File.new(req.path.delete('/$'), 'w+') # Open / create the file iCal has given us {File::RDWR|File::CREAT}
previous_file = ''
fbsession.activate_with_previous_session(:key => saved_key)
dbcc checkident (tablename, reseed, 0)