Skip to content

Instantly share code, notes, and snippets.

@onigra
onigra / bar.rb
Last active August 29, 2015 14:02
# 基底クラス
class Payment
def payment_class(payment_type)
"#{payment_type}Payment"
end
def pay(payment_type)
Object.const_get(payment_class payment_type).new.commit
end
end
@onigra
onigra / gist:622922408477ea636781
Last active August 29, 2015 14:02
飲み物リクエスト

飲み物リクエスト

あるもの

  • 麦茶 * 2
  • 爽健美茶 * 1.5

買った

@onigra
onigra / man_ifconfig
Last active May 2, 2025 16:29
man ifconfig mac OSX
IFCONFIG(8) BSD System Manager's Manual IFCONFIG(8)
NAME
ifconfig -- configure network interface parameters
SYNOPSIS
ifconfig [-L] [-m] [-r] interface [create] [address_family] [address
[dest_address]] [parameters]
ifconfig interface destroy
ifconfig -a [-L] [-d] [-m] [-r] [-u] [-v] [address_family]
@onigra
onigra / man_ipconfig
Last active December 3, 2015 19:00
man ipconfig mac OSX
IPCONFIG(8) BSD System Manager's Manual IPCONFIG(8)
NAME
ipconfig -- view and control IP configuration state
SYNOPSIS
ipconfig waitall
ipconfig getifaddr interface-name
ipconfig ifcount
ipconfig getoption interface-name (option-name | option-code)
@onigra
onigra / gist:67f1d1e758ca5a08cf6f
Last active April 29, 2016 10:24
markdown to redmine style
function! MarkdownToRedmine()
%s/######/h6./g
%s/#####/h5./g
%s/####/h4./g
%s/###/h3./g
%s/##/h2./g
%s/#/h1./g
%s/```\(.\+\)/<pre><code class=\"\1\">/g
%s/```/<\/pre>/g
endfunction
/Users/onigra/sandbox/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-13/2.1.0/nokogiri-1.6.1/nokogiri/nokogiri.bundle: [BUG] Segmentation fault at 0x00000000000438
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
@onigra
onigra / gist:9829563
Last active August 29, 2015 13:57
社内勉強会用rails&herokuハンズオン資料

railsコマンド叩く用のディレクトリ作成

$ gem i bundler --no-rdoc --no-ri
$ rbenv rehash
$ mkdir ror
$ cd ror
$ bundle init

# Gemfileのrailsのコメントアウト外す
@onigra
onigra / ayp.rb
Last active August 29, 2015 13:57
ギャル文字変更スクリプトruby版 https://twitter.com/upgrade_ayp/status/449036965619310592
class String
def to_ayp
ayp_dic = {
'あ' => 'ぁ',
'い' => 'ぃ',
'う' => 'ぅ',
'え' => 'ぇ',
'お' => 'ぉ',
'や' => 'ゃ',
'ゆ' => 'ゅ',
@onigra
onigra / gist:9780358
Last active August 29, 2015 13:57
mac環境構築
@onigra
onigra / generate_brewfile.rb
Last active January 2, 2016 16:09
brew listからBrewfileを作るスクリプトだけどそもそもbrewdlerを使った事が無かった
require 'open3'
formula = Open3.capture3("brew list")
File.open("Brewfile", "w") do |file|
file << "update\n"
file << "upgrade\n"
file << "\n"
formula[0].split(/\n/).each do |f|