View sada.html
<!DOCTYPE html>
<html>
<title>Sort a HTML List Alphabetically HB</title>
<style>
div{
border: solid;
padding: 1em;
margin: 1em;
}
</style>
View projects.rb
# find words that start with @
def find_project(str)
p str.scan(/\B@(\w+)/i)
end
find_project('this is @cpord ford.')
find_project('this is hi@cpord ford.')
View params.rb
def hello(attrs)
@vin = attrs[:vin]
@vin_is_fake = attrs[:vin_is_fake]
if @vin_is_fake
puts 'true'
else
puts 'false'
end
end
View gist:1ab07b55423e977b2d7a
johns-mbp:nrtest2 johnivanoff$ rspec
/Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/gems/sass-3.2.19/lib/sass/version.rb:5: warning: loading in progress, circular require considered harmful - /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/gems/sass-3.2.19/lib/sass.rb
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/bin/ruby_executable_hooks:15:in `<main>'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/bin/ruby_executable_hooks:15:in `eval'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/bin/rspec:23:in `<main>'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/bin/rspec:23:in `load'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/gems/rspec-core-3.0.3/exe/rspec:4:in `<top (required)>'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in `invoke'
from /Users/johnivanoff/.rvm/gems/ruby-2.1.2@nrtest2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in `run'
View gist:7950109
Johnny had half as many erasers as pencils.
He had nine times as many pinwheels as erasers.
He had a total os 120 peices.
How many pencils did Johnny have?
Show your work.
120 = x+(x*.5)+((x*.5)*9)
View gist:4274001
test$ ruby feed_aggregator_test.rb
Loaded suite feed_aggregator_test
Started
..
Finished in 0.112374 seconds.
2 tests, 3 assertions, 0 failures, 0 errors, 0 skips
View gist:4247690
require 'sinatra'
require 'nokogiri'
require 'open-uri'
feed = 'http://api.flickr.com/services/feeds/groups_pool.gne?id=1373979@N22&lang=en-us&format=rss_200'
def parse feed
doc = Nokogiri::XML(open(feed))
doc.search('item').map do |doc_item|
item = {}
View gist:4247677
require 'sinatra'
require 'nokogiri'
feed = File.read('test/fixtures/feed.xml')
def parse feed
doc = Nokogiri::XML feed
doc.search('item').map do |doc_item|
item = {}
item[:link] = doc_item.at('link').text
View gist:4247672
def test_it_says_feed_aggregator
get '/'
assert last_response.ok?
assert_match 'Feed Aggregator', last_response.body
end