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
gem install curb | |
Building native extensions. This could take a while... | |
ERROR: Error installing curb: | |
ERROR: Failed to build gem native extension. | |
/usr/bin/ruby extconf.rb install curb | |
checking for main() in -lcurl... yes | |
checking for curl/curl.h... yes | |
creating Makefile | |
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
Test |
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
#!/usr/local/bin/ruby | |
require 'rubygems' | |
require 'mongrel' | |
# Add the request handler directory to the load path. | |
# Files in the 'app/controllers' dir will be mapped against the first segment | |
# of a URL | |
$LOAD_PATH.unshift( File.join( File.dirname( __FILE__ ) , 'app/controllers' ) ) | |
PORT = 4000 |
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
Tester |
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 'twitter' # sudo gem install twitter --#-- http://twitter.rubyforge.org/ | |
require 'open-uri' | |
require 'eeml' # sudo gem install Floppy-eeml --#-- http://github.com/Floppy/eeml-ruby/tree/master | |
loop do | |
# Pull in feed from pachube | |
data = REXML::Document.new(open("http://www.pachube.com/api/YOUR_FEED.xml?key=YOUR_SECRET_KEY")).to_s | |
# Parse the data |
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
# Insertion Sorting Algorithm for array of number | |
def sorter(*args) | |
args.each_with_index do |number, index| | |
b = index - 1 | |
while b >= 0 | |
break if args[b] <= number | |
args[b + 1] = args[b] | |
b -= 1 | |
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 FWrapper | |
attr_reader :function, :params, :name | |
def initialize(function, params, name) | |
@function = function | |
@params = params | |
@name = name | |
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
Command: | |
it "should return 422 if score does not save" do | |
post :create, :post => {:title => 'Some title'}, :user => 'asd' | |
response.response_code.should == 422 | |
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
[0,0] [1,1] [1,0] [0,1] |
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
def example(a,b) | |
a || b | |
end | |
example(1,0) | |
#=> true | |
example(0,0) | |
#=> false |
OlderNewer