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
/** @jsx React.DOM */ | |
(function() { | |
var GuideUnit, GuidesList, OfferedGuides, | |
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | |
GuideUnit = React.createClass({ | |
render: function() { | |
return React.DOM.div( {className:"row"}, |
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
/** @jsx React.DOM */ | |
var ReadingTimeWidget = React.createClass({ | |
getInitialState: function() { | |
return ({ | |
secondsRequired: null, | |
}); | |
}, | |
componentWillMount: function() { | |
var cdiv = this.props.contentDiv; |
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 'net/http' | |
class FeedDetector | |
# return the feed url for a url | |
# for example: http://blog.dominiek.com/ => http://blog.dominiek.com/feed/atom.xml | |
# only_detect can force detection of :rss or :atom | |
def self.fetch_feed_url(page_url, only_detect=:any) | |
url = URI.parse(page_url) | |
host_with_port = url.host | |
host_with_port << ":#{url.port}" unless url.port == 80 |
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
namespace :datarm do | |
desc "Run Trip Wires" | |
task :run_trip_wires => :environment do |rake_task| | |
proceed(rake_task) do | |
TripWireEngine.proceed_all_active | |
end | |
end | |
desc 'Empty action for report. Requirements: REPORT_ID' | |
task :empty_report => :environment do |rake_task| |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /> | |
<title><%= yield :title || "Philtro" %></title> | |
<%= yield :head -%> | |
</head> | |
<body> |
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
describe FooController do | |
describe "route generation" do | |
it "should map { :controller => 'foo', :action => 'index' } to /foo" do | |
route_for(:controller => "foo", :action => "index").should == "/foo" | |
end | |
end | |
describe "route recognition" do | |
it "should generate params { :controller => 'foo', action => 'index' } from GET /foo" do | |
params_from(:get, "/foo").should == {:controller => "foo", :action => "index"} |
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 ActionController::Base | |
private | |
def rescue_action_in_public(exception) | |
respond_to do |want| | |
want.html { | |
super(exception) | |
} | |
want.js { | |
render :update do |page| |
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
if Rails.env.development? | |
ActiveRecord::Base.class_eval do | |
def log_protected_attribute_removal(*attributes) | |
raise "Can't mass-assign these protected attributes: #{attributes.join(', ')}" | |
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
module ActiveRecord | |
class Errors | |
# Redefine the ActiveRecord::Errors::full_messages method: | |
# E.g. validates_acceptance_of :accepted_terms, :message => 'Please accept the terms of service' | |
def full_messages | |
full_messages = [] | |
@errors.each_key do |attr| | |
@errors[attr].each do |msg| |
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 ActionController::Base | |
private | |
def rescue_action_in_public(exception) | |
respond_to do |want| | |
want.html { | |
super(exception) | |
} | |
want.js { | |
render :update do |page| |
OlderNewer