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
// Package csrf provides session based CSRF protection for the gin framework. | |
// This library is a heavily modified version of https://github.com/utrack/gin-csrf | |
// The primary differences of this library are that tokens are persisted for the | |
// life of the session (back button support), the secret is not stored in any | |
// form on the client side, and much of the code has been refactored for clarity. | |
package csrf | |
import ( | |
"crypto/sha1" | |
"encoding/base64" |
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
<%= form_tag "", :method => "get" do %> | |
<div class="toolbar"> | |
<div class="left"> | |
<%= label_tag(:from, "From:") %> | |
<%= text_field_tag :from, params[:from], :class => "datepicker" %> | |
<%= label_tag(:to, "to") %> | |
<%= text_field_tag :to, params[:to], :class => "datepicker" %> | |
</div> | |
<div class="right"> |
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
1.9.3-p0 :017 > Statistic.where(:id=>234, :website_id=>12) | |
Statistic Load (0.4ms) SELECT "statistics".* FROM "statistics" WHERE "statistics"."id" = 234 AND "statistics"."website_id" = 12 | |
=> [#<Statistic id: 234, organic_visits: 55, paid_visits: nil, organic_conversions: 0, paid_conversions: nil, organic_conversion_rate: #<BigDecimal:7ff1abe91890,'0.0',9(36)>, paid_conversion_rate: nil, date: "2012-01-05 00:00:00", website_id: 12, created_at: "2012-02-07 17:27:21", updated_at: "2012-02-07 17:27:21">] | |
1.9.3-p0 :018 > Statistic.find_by_website_id_and_date(12,Time.now-35.days) | |
Statistic Load (0.5ms) SELECT "statistics".* FROM "statistics" WHERE "statistics"."website_id" = 12 AND "statistics"."date" = '2012-01-05 00:20:40.456598' LIMIT 1 | |
=> nil |
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
mod = Module.new do | |
Junk = 123 | |
end | |
mod.const_defined?(:Junk) #=> false | |
mod.const_defined?(:Junk, false) #=> ArgumentError | |
mod.constants #=> [] | |
module Foo | |
Junk = 123 | |
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
#some_div{:class => baz ? 'foo' : 'bar'} |
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
# File: spec/support/capybara_patch.rb | |
# | |
# This patch attempts to fix a race condition in the selenium web driver | |
# Reference: https://code.google.com/p/selenium/issues/detail?id=2099 | |
class Capybara::Selenium::Driver | |
def find(selector) | |
browser.find_elements(:xpath, selector).map { |node| Capybara::Selenium::Node.new(self, node) } | |
rescue Selenium::WebDriver::Error::UnhandledError => e | |
e.message =~ /nsIDOMXPathEvaluator.createNSResolver/ ? retry : raise |
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
$.fn.preventDoubleSubmit = function() { | |
$(this).submit(function(event) { | |
if ($(this).hasClass('submitted')){ | |
event.preventDefault(); | |
return false; | |
}else{ | |
$(this).addClass('submitted'); | |
return true; | |
} | |
}); |
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
Last login: Thu May 26 12:47:24 on ttys002 | |
tr~ $ traceroute d3nwyuy0nl342s.cloudfront.net | |
traceroute: Warning: d3nwyuy0nl342s.cloudfront.net has multiple addresses; using 216.137.37.9 | |
traceroute to d3nwyuy0nl342s.sfo4.cloudfront.net (216.137.37.9), 64 hops max, 52 byte packets | |
1 192.168.3.1 (192.168.3.1) 0.919 ms 0.562 ms 0.594 ms | |
2 70-35-55-161.static.wiline.com (70.35.55.161) 1.165 ms 1.001 ms 0.799 ms | |
3 sfopa0030r352401-v23.pa.wiline.com (70.35.52.97) 1.157 ms 1.221 ms 1.090 ms | |
4 67-207-106-170.static.wiline.com (67.207.106.170) 1.416 ms 1.454 ms 1.496 ms | |
5 sfomv0189r352401-v26.wiline.com (67.207.103.70) 1.950 ms 1.696 ms 1.697 ms | |
6 sfomv0211r352401-v27.sj.wiline.com (67.207.103.118) 1.856 ms 1.824 ms 1.958 ms |
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 'http://rubygems.org' | |
gem 'rails', '3.0.3' | |
gem 'mysql2' | |
gem 'unicorn' | |
gem 'capistrano' | |
gem 'haml' | |
gem 'ar_mailer_rails3' | |
gem 'state_machine' | |
gem 'will_paginate' |
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
Action: :new | |
Args: {:blah=>4} | |
----- | |
Action: nil | |
Args: {:blah=>3} | |
----- | |
Action: :foo | |
Args: {:errors=>4} | |
----- | |
Action: nil |
NewerOlder