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
module God | |
module Conditions | |
class RestartFileTouched < PollCondition | |
attr_accessor :restart_file | |
def initialize | |
super | |
end | |
def process_start_time | |
Time.parse(`ps -o lstart -p #{self.watch.pid} --no-heading`) |
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
should "create user" do | |
assert_difference('User.count') do | |
post :create, :user => {:username => "foo"} | |
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
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 |
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
<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> |
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
$(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: ''}); |
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 CachedMetar | |
def self.metar(icao) | |
Rails.cache.fetch("cached_metar_#{icao}", :expires_in => 5.minutes) do | |
CurrentMetar::Metar.get_metar(icao) | |
end | |
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
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 |
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
source :rubygems | |
gem 'sinatra' |
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 'bundler' | |
Bundler.require | |
require './myapp' | |
run MyApp |
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 MyApp < Sinatra::Base | |
get '/' do | |
'Hello world!' | |
end | |
end |
OlderNewer