##Open Source multiplies New Relic awesomeness Nathan Humbert
Senior Software Engineer, New Relic
Presented on July 23 at OSCON 2014
##Links From the talk
##Open Source multiplies New Relic awesomeness Nathan Humbert
Senior Software Engineer, New Relic
Presented on July 23 at OSCON 2014
##Links From the talk
class MyApp < Sinatra::Base | |
get '/' do | |
'Hello world!' | |
end | |
end |
require 'rubygems' | |
require 'bundler' | |
Bundler.require | |
require './myapp' | |
run MyApp |
source :rubygems | |
gem 'sinatra' |
require 'test_helper' | |
class CachedMetarTest < ActiveSupport::TestCase | |
context 'self.metar' do | |
should 'call get_metar when cache is empty' do | |
Rails.cache.delete('cached_metar_test_icao') | |
CurrentMetar::Metar.expects(:get_metar).with('test_icao').returns('test') | |
assert_equal 'test', CachedMetar.metar('test_icao') | |
end |
class CachedMetar | |
def self.metar(icao) | |
Rails.cache.fetch("cached_metar_#{icao}", :expires_in => 5.minutes) do | |
CurrentMetar::Metar.get_metar(icao) | |
end | |
end | |
end |
$(document).ready(function() { | |
var latlng = new google.maps.LatLng(39.98, -98.26); | |
var myOptions = { | |
zoom: 4, | |
center: latlng, | |
mapTypeId: google.maps.MapTypeId.HYBRID | |
}; | |
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |
var infowindow = new google.maps.InfoWindow({content: ''}); |
<div class='field'> | |
<h3><a href="http://www.checkthesock.com/fields/walla-walla-valley-proptwisters">Walla Walla Valley Proptwisters</a></h3> | |
<p>Walla Walla, WA</p> | |
<p> | |
Coordinates: | |
<span class='lat'>46.04959</span> | |
<span class='lon'>-118.363727</span> | |
</p> | |
</div> |
context "create user" do | |
setup { post :create, :user => {:username => "foo"} } | |
should assign_to( :user ).with_kind_of(User) | |
should "save user to database" do | |
assert_equal false, assigns(:user).new_record? | |
end | |
end |
should "create user" do | |
assert_difference('User.count') do | |
post :create, :user => {:username => "foo"} | |
end | |
end |