Skip to content

Instantly share code, notes, and snippets.

View babatakao's full-sized avatar

Takao Baba babatakao

View GitHub Profile
@babatakao
babatakao / generate_id_rsa.pub
Created July 17, 2013 01:57
id_rsaからid_rsa.pubを作る
ssh-keygen -y -f id_rsa > id_rsa.pub
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_white_space": "all",
"font_face": "Source Code Pro",
"font_size": 11,
"highlight_line": true,
"highlight_modified_tabs": true,
"theme": "Phoenix Dark.sublime-theme",
"phoenix_color_blue": true,
"phoenix_highlight_current_tab": true,
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+shift+r"], "command": "refresh_folder_list" }
]
@babatakao
babatakao / gitlog.rb
Created December 7, 2012 05:56
git logを一覧便利なTSVで表示
require 'date'
logs = {}
hash = nil
`git log`.each_line do |line|
if line =~ /^commit (\w+)/
hash = $1
end
@babatakao
babatakao / config.ru
Created October 30, 2012 11:20
Rails 3.2でproduction環境の時にHEADメソッド(request.head?)が動作しない不具合を修正するパッチ
# This file is used by Rack-based servers to start the application.
class SaveOriginalHttpMethod
def initialize(app)
@app = app
end
def call(env)
env['rack.methodoverride.original_method'] = env['REQUEST_METHOD']
@app.call(env)
@babatakao
babatakao / Sinatra_WEBrick_DoNotReverseLookup.rb
Created October 18, 2012 07:50
SinatraでWEBrickのDNS逆引きを抑制するサンプル
require 'sinatra'
class Rack::Handler::WEBrick
class << self
alias_method :run_original, :run
end
def self.run(app, options={})
options[:DoNotReverseLookup] = true
run_original(app, options)
end
@babatakao
babatakao / extract_fixtures.rake
Created May 13, 2012 07:47
[Ruby on Rails] Extract database to fixture yaml file.
# -*- coding: utf-8 -*-
# DBからデータを取り出してYAMLにする。生成したYAMLはtmp/fixturesに保存される
namespace :db do
namespace :fixtures do
desc "Extract database data to tmp/fixtures directory."
task :extract => :environment do
fixtures_dir = "#{Rails.root}/tmp/fixtures/"
skip_tables = ["schema_info", "schema_migrations", "sessions"]
ActiveRecord::Base.establish_connection
FileUtils.mkdir_p(fixtures_dir)