Send email asynchroniously using Sidekiq.
Create your mailer us usual:
#!/usr/bin/env bash | |
set -o xtrace -o errexit -o pipefail -o nounset | |
######################################################################################## | |
# CircleCI's current recommendation for roughly serializing a subset | |
# of build commands for a given branch | |
# | |
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153 | |
# Code from - https://github.com/bellkev/circle-lock-test |
<%= form_for(@sundae) do |f| %> | |
<!-- | |
collection_check_boxes requires 4 parameters, the last two are methods that access | |
the value and text from the collection, respectively. Hence the need for | |
SundaesHelper.valid_flavors! | |
--> | |
<%= f.collection_check_boxes(:flavor_list, valid_flavors, :first, :first) do |b| %> | |
<!-- FYI: I use Bootstrap 4, so I customized how the checkboxes would render --> | |
<div class="form-check"> | |
<label class="form-check-label"><%= b.check_box class: 'form-check-input' %> <%= b.value %></label> |
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<!-- HBox and VBox layouts have been implementated with many libraries/toolkits on | |
different platforms and languages (like ExtJS,QT,GTK,.NET...). | |
This tries to achieve the same but with CSS only. | |
Supported browsers: IE 10+, Safari 6.1, Latest FF, Chrome --> | |
<style type="text/css"> | |
html, body { |
Read the blog at http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
# Sample implementation of quicksort and mergesort in ruby | |
# Both algorithm sort in O(n * lg(n)) time | |
# Quicksort works inplace, where mergesort works in a new array | |
def quicksort(array, from=0, to=nil) | |
if to == nil | |
# Sort the whole array, by default | |
to = array.count - 1 | |
end |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |