Send email asynchroniously using Sidekiq.
Create your mailer us usual:
| // http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit | |
| // form_submit('/contact/', {name: 'Johnny Bravo'}); | |
| function form_submit(path, params, method) { | |
| method = method || "post"; // Set method to post by default if not specified. | |
| // The rest of this code assumes you are not using a library. | |
| // It can be made less wordy if you use one. | |
| var form = document.createElement("form"); | |
| form.setAttribute("method", method); | |
| form.setAttribute("action", path); |
| # Example Dockerfile | |
| FROM hello-world |
| # shortform git commands | |
| alias g='git' | |
| # push changes to an empty git repository for the first time | |
| git push --set-upstream origin master | |
| # remove untracked files in a git repository | |
| git status -su | cut -d' ' -f2- | tr '\n' '\0' | xargs -0 rm | |
| # get most modified files and counts |
This list is based on aliases_spec.rb.
You can see also Module: RSpec::Matchers API.
| matcher | aliased to | description |
|---|---|---|
| a_truthy_value | be_truthy | a truthy value |
| a_falsey_value | be_falsey | a falsey value |
| be_falsy | be_falsey | be falsy |
| a_falsy_value | be_falsey | a falsy value |
| # RSpec matcher for validates_with. | |
| # https://gist.github.com/2032846 | |
| # Usage: | |
| # | |
| # describe User do | |
| # it { should validate_with CustomValidator } | |
| # end | |
| # | |
| # describe User do | |
| # it do |
gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.bundleRAILS_ENV=production rake db:create db:migrate db:seedrake secret and copy the outputexport SECRET_KEY_BASE=output-of-rake-secretrake assets:precompile. This will create a folder public/assets that contains all of your assets.RAILS_ENV=production rails s and you should see your app.Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.
| # | |
| # enqueue with following parameters hash: | |
| # - headers | |
| # - work_at - time of execution | |
| # - work_queue - destination queue for actually doing the work | |
| # | |
| class DelayWorker | |
| include Sneakers::Worker | |
| from_queue :treadmill, { handler: Sneakers::Handlers::Delay } |
| # Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90 | |
| # Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6 | |
| # Benefits of: https://gist.github.com/e12e/e0c7d2cc1d30d18c8050b309a43450ac | |
| # And fixes of: https://gist.github.com/joelvh/f50b8462611573cf9015e17d491a8a92 | |
| namespace :db do | |
| desc 'Dumps the database to backups' | |
| task dump: :environment do | |
| dump_fmt = ensure_format(ENV['format']) | |
| dump_sfx = suffix_for_format(dump_fmt) | |
| backup_dir = backup_directory(Rails.env, create: true) |