This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def include?(value) | |
self.each do |range| | |
return true if range.include?(value) | |
end | |
return false | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo couchdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/telnet' | |
soundbridge = Net::Telnet.new( | |
'Host' => '192.168.2.105','Port' => '5555' | |
) | |
soundbridge.puts "SetPowerState on yes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fbsession.activate_with_previous_session(:key => saved_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbcc checkident (tablename, reseed, 0) |
OlderNewer