This file contains 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
# Gemfile: | |
# gem 'aws-sdk-rails' | |
# | |
credentials = Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']) | |
Aws::Rails.add_action_mailer_delivery_method( | |
:aws_sdk, | |
credentials: credentials, region: 'us-west-2' | |
) | |
ActionMailer::Base.delivery_method = :aws_sdk |
This file contains 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
# Gemfile: | |
# gem 'aws-sdk-rails' | |
# | |
credentials = Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']) | |
Aws::Rails.add_action_mailer_delivery_method( | |
:aws_sdk, | |
credentials: credentials, region: 'us-west-2' | |
) | |
ActionMailer::Base.delivery_method = :aws_sdk |
This file contains 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
#!/bin/bash | |
read -p "Do you wish to remove merged branches? " yn | |
case $yn in | |
[Yy]* ) echo "Removing merged branches..."; break;; | |
* ) echo "Nothing to do."; exit;; | |
esac | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |
This file contains 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
# save pry history separated by current directory. | |
require 'digest/md5' | |
require 'fileutils' | |
history_base = File.join(ENV['HOME'], '.pry', 'histories') | |
FileUtils.mkdir_p history_base unless Dir.exist? history_base | |
pwd_hash = Digest::MD5.hexdigest(`pwd`.chomp) | |
Pry.config.history.file = File.join(history_base, pwd_hash) |
This file contains 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
# include BarcodeHelper | |
# call svg_barcode method in view | |
# e.g. <p><%= svg_barcode('12345') %></p> | |
# You shouuld implement Barcode class whith returns barcode encoding from string. | |
module BarcodeHelper | |
def svg_barcode(token, options = {}) | |
xdim = (options[:xdim] || 2).to_i | |
margin = pick_margin_from(options) |
This file contains 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
//= require d3 | |
var height = 500; | |
var width = 800; | |
var margin_left = 20; | |
var xdim = 2; | |
var svgContianer = d3.select("body") | |
.append("svg") | |
.attr("width", width) |
This file contains 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
/* usage | |
if (!$.looper.is_running()) { | |
$.looper.initialize({ | |
action: function() { | |
$('#notification-marker') | |
.animate({opacity: 1}, 800) | |
.animate({opacity: 0}, 800); | |
}, | |
timeout: 1600 |
This file contains 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
#!/bin/sh | |
pfx='rel' | |
d=`date +%Y%m%d%H%M%S` | |
git flow release start $pfx-$d | |
git flow release finish -m"Release:$d" $pfx-$d |
This file contains 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 'google-api-client' | |
# gem 'mime-types' | |
# | |
# prepare config/ocr.yml | |
# default: &default | |
# google: | |
# auth_passphrase: <passphrase> | |
# auth_email: <email> | |
# permission: e.g. https://www.googleapis.com/auth/drive | |
# |
This file contains 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 WebPay | |
alias_method :original_initialize, :initialize | |
Configuration = Struct.new :public_key, :secret_key | |
@@default_configuration = Configuration.new | |
def self.configuration; @@default_configuration end | |
def self.configure(&block) | |
block.call(@@default_configuration) | |
end | |
def initialize(options = {}) | |
original_initialize(@@default_configuration.secret_key, options) |