Send email asynchroniously using Sidekiq.
Create your mailer us usual:
(function(){ | |
// Input field given to n decimal places. Degrades gracefully to standard numeric input. | |
// Usage: <input type="number" is="decimal-number" data-places="2" name="..." value="..."> | |
try { | |
var proto = Object.create(HTMLInputElement.prototype); | |
proto.createdCallback = function() { | |
this.type = "number"; | |
this.addEventListener("change", this.decimate); | |
this.value = parseFloat(this.value).toFixed(this.getAttribute('data-places')); | |
}; |
# More robust version to update new or existing counter cache columns in your Rails app. | |
# See: https://gist.github.com/svyatov/4225663 | |
desc 'Update all cache counters' | |
task :update_cache_counters => :environment do | |
models_to_update = {} | |
# or: Rails.application.eager_load! | |
# Dir loads less, so it's faster | |
Dir.glob(Rails.root.join('app/models/**/*')).each { |model| require model if File.file?(model) } |
ruby -e 'system("heroku create z#{29.times.map{ (("a".."z").to_a + ("0".."9").to_a).sample }.join}")' |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.
OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.
custom |