Skip to content

Instantly share code, notes, and snippets.

Avatar

Takao Baba babatakao

View GitHub Profile
@babatakao
babatakao / generate_id_rsa.pub
Created Jul 17, 2013
id_rsaからid_rsa.pubを作る
View generate_id_rsa.pub
ssh-keygen -y -f id_rsa > id_rsa.pub
View SublimePreferences.py
{
"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,
View SublimeKey.py
[
{ "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 Dec 7, 2012
git logを一覧便利なTSVで表示
View gitlog.rb
require 'date'
logs = {}
hash = nil
`git log`.each_line do |line|
if line =~ /^commit (\w+)/
hash = $1
end
@babatakao
babatakao / config.ru
Created Oct 30, 2012
Rails 3.2でproduction環境の時にHEADメソッド(request.head?)が動作しない不具合を修正するパッチ
View config.ru
# 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 Oct 18, 2012
SinatraでWEBrickのDNS逆引きを抑制するサンプル
View Sinatra_WEBrick_DoNotReverseLookup.rb
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
[Ruby on Rails] Extract database to fixture yaml file.
View extract_fixtures.rake
# -*- 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)