Skip to content

Instantly share code, notes, and snippets.

require "bundler"
Bundler.require
def client
@client ||= Aws::AutoScaling::Client.new(region: 'ap-southeast-1')
end
def launch_configurations
@launch_configurations ||= client.describe_launch_configurations.launch_configurations
end
@ryonext
ryonext / gist:2906f7bd9c865c2d8f1b
Created January 19, 2015 14:54
Hubotでpull reqつくるやつ
# Description:
# Create pull request from develop to master.
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_ORG
@ryonext
ryonext / gist:f0538f7bb6002d57f732
Created September 26, 2014 06:57
ランダム文字列
# uuid
SecureRandom.uuid
# 半角英数16文字
SecureRandom.hex(8)
@ryonext
ryonext / gist:efb5d89c1a1185b925b3
Last active August 29, 2015 14:05
ExceptionNotifierをRspecで検証する
it 'notify error message' do
allow(ExceptionNotifier).to receive(:notify_exception)
# call method that raise error
expect(ExceptionNotifier).to have_received(:notify_exception)
end
@ryonext
ryonext / gist:65fecd8f2842db5040af
Last active August 29, 2015 14:05
uuidが生成されていること、の検証
expect(variable).to match /^.{36}$/
@ryonext
ryonext / yaml2csv.rb
Last active August 29, 2015 14:02
yaml2csv
require 'yaml'
def read_hash(hash, path, f)
hash.keys.each do |k|
val = hash[k]
if val.class == Hash
read_hash(val, path + k + ".", f)
else
f.write "\"#{path}#{k}\",\"#{val}\"\n"
end
<source>
type twittersearch
consumer_key
consumer_secret
oauth_token
oauth_token_secret
tag input.twitter
keyword doorkeeper.jp
run_interval 300
count 100
@ryonext
ryonext / rails new with version
Created August 1, 2013 07:59
バージョン指定してRails new
rails _3.2.13_ new nanika
@ryonext
ryonext / rails_api_template
Last active December 20, 2015 12:09
Rails3でAPIを作るときのテンプレート
gem "thin"
gem_group :development, :test do
gem "rspec-rails"
gem "pry-rails"
gem "pry-debugger"
gem "spork"
gem "guard-spork"
gem "guard-rspec"
gem "factory_girl_rails"
@ryonext
ryonext / rails_ui_template
Created August 1, 2013 07:42
Rails3でUIを持ったapplicationを作るときのtemplate
gem "twitter-bootstrap-rails"
gem "thin"
gem_group :development, :test do
gem "rspec-rails"
gem "pry-rails"
gem "pry-debugger
gem "spork"
gem "guard-spork"
gem "guard-rspec"