Skip to content

Instantly share code, notes, and snippets.

View reddavis's full-sized avatar
💭
🍕

Red Davis reddavis

💭
🍕
View GitHub Profile
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
Test
#!/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
Tester
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
# 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
class FWrapper
attr_reader :function, :params, :name
def initialize(function, params, name)
@function = function
@params = params
@name = name
end
@reddavis
reddavis / gist:135276
Created June 24, 2009 13:50
Weird error
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
[0,0] [1,1] [1,0] [0,1]
def example(a,b)
a || b
end
example(1,0)
#=> true
example(0,0)
#=> false