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
/** | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { | |
return _.transform(object, function(result, value, key) { | |
if (!_.isEqual(value, base[key])) { |
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
# == Schema Information | |
# | |
# Table name: quota | |
# | |
# id :integer not null, primary key | |
# campaign_id :integer | |
# target :integer default("0") | |
# completed :integer default("0") | |
# parent_ids :text default("{}"), not null, is an Array | |
# settings :json default("{}") |
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 Mechanize | |
class Page | |
def initialize(uri=nil, response=nil, body=nil, code=nil, mech=nil) | |
@encoding = nil | |
method = response.respond_to?(:each_header) ? :each_header : :each | |
re_test = /charset\s*=/i | |
re_select = /charset\s*=\s*([^; "]+)/i | |
response.send(method) do |header,v| | |
next unless v =~ re_test |
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 <%= controller_class_name %>Controller < ApplicationController | |
# GET <%= route_url %> | |
# GET <%= route_url %>.xml | |
def index | |
@<%= plural_table_name %> = <%= orm_class.all(class_name) %> | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @<%= plural_table_name %> } |