Skip to content

Instantly share code, notes, and snippets.

View takuma-saito's full-sized avatar

takuma.saito takuma-saito

  • 04:12 (UTC +09:00)
View GitHub Profile
@ndarville
ndarville / diff.mdown
Created July 23, 2012 20:33
Paul Heckel's Diff Algorithm

[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.

@masquaremo
masquaremo / str_num_sample.rb
Last active May 30, 2021 06:56
Rubyで文字列と数値を相互に変換するメソッドとかのまとめ
#!/usr/bin/ruby
#数値を16進数文字列に
p 65.to_s(16) #=> "41"
#数値をASCII文字に
p 65.chr #=> "A"
#文字列を16進数とみなして数値に
p "41".hex #=> 65
@TravelingTechGuy
TravelingTechGuy / get_history.sh
Created May 9, 2016 14:10
Get your Chrome history as a CSV file
#!/bin/bash
# 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

Rails

  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なオプションは削除する。
@matsukaz
matsukaz / application.rb
Last active January 8, 2024 14:30
Rails connection management to handle Amazon Aurora's failover
module xxx
class Application < Rails::Application
#(中略)
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
'ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement'
end
end