Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
matsukaz / application.rb
Last active Oct 23, 2020
Rails connection management to handle Amazon Aurora's failover
View application.rb
module xxx
class Application < Rails::Application
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
View Rails5


  1. Gemをアップデート
  • Railsをアップデートしずに、バージョンをあげられるgemはあらかじめアップデートしておく
  • Gemfileを編集する。gemによってはRails5に対応していない場合があるので、一旦Rails以外をコメントアウト → ひとつずつコメントインしてinstallする → 最後にDiffをチェックする(downgradeしてないか) これが一番速い
    • vim Gemfile → 編集する → bundle install → 繰り返す
  • いくつかのgemは修正版がリリースされていないのでgithubから直接DLしてる 例: gem 'sinatra', github: 'sinatra/sinatra', ref: 'a5da6fa82c...'
  • Deprecatedなエラーが出るgemは直してPR送ってあげる
  1. この段階ではおそらく./bin/rails consoleがwarningやエラーを吐きまくるので、一つずつ直していく。
  • deprecatedなオプションは削除する。
TravelingTechGuy /
Created May 9, 2016
Get your Chrome history as a CSV file
# Locate the history file in your profile, and copy it to the same folder as this script.
# On Mac: ~/Library/Application\ Support/Google/Chrome/Default/History
# On Windows: C:\Users\YOUR USER NAME\AppData\Local\Google\Chrome\User Data\Default\History
sqlite3 History <<!
.headers on
.mode csv
.output out.csv
masquaremo / str_num_sample.rb
Last active Dec 12, 2019
View str_num_sample.rb
p 65.to_s(16) #=> "41"
p 65.chr #=> "A"
p "41".hex #=> 65
ndarville / diff.mdown
Created Jul 23, 2012
Paul Heckel's Diff Algorithm
View diff.mdown

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

You can’t perform that action at this time.