This file contains hidden or 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 ActiveRecord::Base | |
# Bulk merge a bunch of records | |
# | |
# we expect most of the records to import to represent updates | |
# so this method tries to be efficent with database queries | |
# by using a single query to find any existing records matching the key_attributes | |
# updating those records and finally inserting each remaining record | |
# | |
# It DOEST NOT use a transaction or lock. callers responsibilty to | |
# add that if desired |
This file contains hidden or 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
# Bulk merge a bunch of records | |
# | |
# we expect most of the records to import to represent updates | |
# so this method tries to be efficent with database queries | |
# by using a single query to find any existing records matching the key_attributes | |
# updating those records and finally inserting each remaining record | |
# | |
# It DOEST NOT use a transaction or lock. callers responsibilty to | |
# add that if desired | |
# |
This file contains hidden or 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
/* | |
drawDial( | |
value: | |
renderTo: | |
) | |
*/ | |
function drawDial(options) { | |
var renderTo = options.renderTo, | |
value = options.value, |
This file contains hidden or 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
To use on OSX: | |
1.allow extension installs from github | |
$defaults write com.google.Chrome ExtensionInstallSources -array "https://*.github.com/*" | |
2. restart Chrome | |
3. come back here and click the 'raw' link for github_gr.user.js | |
4. allow Chrome to install the script above as a user extension | |
5. go to github issues list. |
This file contains hidden or 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
#asset pipeline on | |
config.assets.enabled = true | |
#dont load the whole damn app and connect to the db to precompile | |
config.assets.initialize_on_precompile = false | |
# turn off compression entirely | |
config.assets.compress = false | |
#OR for css/js explicitly |
This file contains hidden or 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 Select2Input < SimpleForm::Inputs::CollectionSelectInput | |
def input | |
options[:include_hidden] ||= false | |
options[:include_blanks] ||= false | |
options[:input_html][:id] ||= "#{@builder.options[:as]}_#{attribute_name}" | |
dom_selector = "##{options[:input_html][:id]}" | |
if select2_options = options.delete(:select2) | |
options[:collection] = [] + Array(@builder.object.send(attribute_name)) | |
end |
This file contains hidden or 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
<?php | |
$survey = array( | |
'Q0' => array( | |
'number' => false, | |
'prompt' => 'Email Address:', | |
'type' => 'email', | |
'input_attribs' => 'type="email" placeholder="e.g. [email protected]" required autofocus' | |
), | |
'Q1' => array( |
This file contains hidden or 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
before_filter do | |
if request.user_agent =~ /bingbot/ | |
render :status => 503, :text=>'Too busy to server spiders now' | |
return false | |
end | |
end |
This file contains hidden or 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
gem 'lograge' |
This file contains hidden or 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 ApplicationController | |
around_filter :track_with_google_analytics | |
private def track_with_google_analytics | |
start = Time.now | |
yield | |
# Track API hits server-side using Google's Measurement Protocol | |
# https://developers.google.com/analytics/devguides/collection/protocol/v1/ | |
if ENV['GA_TRACKING_CODE'].present? | |
finish = Time.now |
OlderNewer