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) |
View generate_id_rsa.pub
ssh-keygen -y -f id_rsa > id_rsa.pub |
View SublimeKey.py
[ | |
{ "keys": ["ctrl+tab"], "command": "next_view" }, | |
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }, | |
{ "keys": ["ctrl+shift+r"], "command": "refresh_folder_list" } | |
] |
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 gitlog.rb
require 'date' | |
logs = {} | |
hash = nil | |
`git log`.each_line do |line| | |
if line =~ /^commit (\w+)/ | |
hash = $1 | |
end |
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) |
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 |