Skip to content

Instantly share code, notes, and snippets.

View 1Rhino's full-sized avatar

1rhino 1Rhino

View GitHub Profile

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@1Rhino
1Rhino / list_for_select.rb
Last active December 20, 2015 05:19
list for select, select tag from model, use in views
#model
def self.list_for_select_by_code
find(:all).collect {|t| [t.name, t.code]}
end
#view file
select "search", "area", [["こだわらない", @default_area.code]].concat(SearchArea.list_for_select_by_code)
def self.list_attributes_for_select
return [
packages:
yum:
rsyslog: []
rsyslog-gnutls: []
files:
"/etc/rsyslog.d/01-udp.conf":
mode: "000640"
owner: root
group: root
content: |
@1Rhino
1Rhino / result.log
Last active November 4, 2016 04:36
Nov 03 20:26:38 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="26962" x-info="http://www.rsyslog.com"] exiting on signal 15.
Nov 03 20:26:38 api-staging kernel: imklog 5.8.10, log source = /proc/kmsg started.
Nov 03 20:26:38 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="27112" x-info="http://www.rsyslog.com"] start
Nov 03 20:27:05 api-staging kernel: Kernel logging (proc) stopped.
Nov 03 20:27:05 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="27112" x-info="http://www.rsyslog.com"] exiting on signal 15.
Nov 03 20:27:14 api-staging kernel: imklog 5.8.10, log source = /proc/kmsg started.
Nov 03 20:27:14 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="27180" x-info="http://www.rsyslog.com"] start
Nov 03 20:29:14 api-staging kernel: imklog 5.8.10, log source = /proc/kmsg started.
Nov 03 20:29:14 api-staging rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="27297" x-info="http:
module ProductDetailServices
class CalculateShippingFee
def initialize(product_data)
@product_data = product_data
end
def get
SHIPPING_RULES.map{ |rule_name, rule| shipping_fee_object_for(rule, @product_data) }.compact.max.shipping_fee
end
@1Rhino
1Rhino / gist:82d112edacef7f0630693675c551bdbc
Created March 16, 2017 09:42 — forked from jgorset/gist:1747655
How Sprockets works with JST and EJS templates
// This document distills the magic that happens when you create a file with the ".jst"
// and ".ejs" extensions anywhere on your asset path in Ruby on Rails, courtesy of the
// Sprockets library (https://github.com/sstephenson/sprockets).
//
// For the purpose of this example, imagine that you have created a template for
// messages in `app/assets/javascripts/backbone/templates/messages/message.jst.ejs`
// with the following contents:
//
// <h1><%= user.full_name %></h1>
// <p><%= body %></p>
@1Rhino
1Rhino / deploy.rb
Created April 10, 2017 03:16 — forked from stas/deploy.rb
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
module TaxServices
class ItemPrice
def initialize(total_price, has_tax, has_service_tax)
@total_price = total_price
@service_tax_rate = has_tax ? Settings.tax.service_tax_rate : 0
@tax_rate = has_service_tax ? Settings.tax.tax_rate : 0
end
def perform
OpenStruct(
@1Rhino
1Rhino / cloudSettings
Last active December 20, 2017 02:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-12-20T02:10:36.078Z","extensionVersion":"v2.8.7"}
@1Rhino
1Rhino / cloudSettings
Created December 24, 2017 07:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-12-24T07:38:53.099Z","extensionVersion":"v2.8.7"}