Send email asynchroniously using Sidekiq.
Create your mailer us usual:
class MoveAttachmentsToNewLocation < ActiveRecord::Migration | |
def initialize(name = self.class.name, version = nil) | |
access_key = Rails.application.secrets.g3_access_key_id | |
secret_key = Rails.application.secrets.g3_secret_access_key | |
storage = Fog::Storage::Google.new google_storage_access_key_id: access_key, | |
google_storage_secret_access_key: secret_key | |
@bucket_name = Rails.application.secrets.g3_bucket | |
@bucket = storage.directories.get(@bucket_name) | |
super(name, version) |
# Ruby Array's "-" (minus) method removes elements from the receiver which exist in the parameter Array | |
[5, 6, 1] - [2, 3, 5] | |
# => [6, 1] | |
# this #subtract method will subtract the value of the parameter Array from the value of the receiver Array, defined by the actual index. | |
# type mismatch, Nil, and different Array length are not handled | |
class Array |
class Child extends React.Component { | |
render () { | |
return (<div>I'm the child</div>); | |
} | |
} | |
class ShowHide extends React.Component { | |
constructor () { | |
super (); | |
this.state = { |
%w(john paul ringo george).map { |p| p.capitalize } | |
# => ["John", "Paul", "Ringo", "George"] |
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime |
# app/models/user.rb | |
class User < ActiveRecord::Base | |
validates :zip_code, presence: true, zip_code: true | |
end |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
module RenderingHelper | |
# Override Rails' #render helper to fix an issue with it not honoring objects | |
# with #to_partial_path definitions that return absolute paths, which is | |
# problematic when rendering partials within a namespaced controller. | |
def render(options={}, locals={}, &block) | |
return super unless options.respond_to?(:to_partial_path) | |
object = options | |
path = object.to_partial_path |
##How Homakov hacked GitHub and the line of code that could have prevented it
Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.
If you'd like to follow me on twitter my handle is @peternixey