Skip to content

Instantly share code, notes, and snippets.

/** @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"},
/** @jsx React.DOM */
var ReadingTimeWidget = React.createClass({
getInitialState: function() {
return ({
secondsRequired: null,
});
},
componentWillMount: function() {
var cdiv = this.props.contentDiv;
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
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|
<!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>
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"}
@olkeene
olkeene / ajax_rescues.rb
Created April 4, 2009 03:05
ajax_rescues
class ActionController::Base
private
def rescue_action_in_public(exception)
respond_to do |want|
want.html {
super(exception)
}
want.js {
render :update do |page|
@olkeene
olkeene / noisy_protected_attribute_removal.rb
Created April 4, 2009 03:02
mass-assign errors display for dev env
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
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|
class ActionController::Base
private
def rescue_action_in_public(exception)
respond_to do |want|
want.html {
super(exception)
}
want.js {
render :update do |page|