Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Epictetus / explain_analyze_on_pg_adapter.rb
Created December 5, 2012 13:17 — forked from yuroyoro/explain_analyze_on_pg_adapter.rb
RailsでPostgreSQLを使うときに、"EXPLAIN"の代わりに"EXPLAIN ANALYZE"を使うようにする猿パッチ
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter < AbstractAdapter
def explain(arel, binds = [])
sql = "EXPLAIN ANALYZE #{to_sql(arel, binds)}"
ExplainPrettyPrinter.new.pp(exec_query(sql, 'EXPLAIN', binds))
end
end
end
end

WindowsでHerokuをセットアップする手順

こんにちは。最近あいさつで始まるエントリーをよく見かけるようになったので私も挨拶してみます。挨拶って大切ですよね。

私は、以前はさくらインターネットのホスティング・サーバーを使っていたのですが、Sinatraが使いたくてHerokuに乗り換えました。しばらくHerokuを使っていて、じゅうぶん便利だと感じたので、さくらインターネットの方は解約しました。

その後、職場でMacマシンからWindowsマシンへ移住するよう言われ、一時的にHerokuが使えない状況でした。しかしサーバー環境がないと検証できない案件が発生したため、WindowsでHerokuのセットアップにトライしてみました。会社のプロキシ内という条件もあり、厳しいかなと思ったのですが、意外とすんなりうまくいきました。

本稿ではHerokuに「Hello World!」と出力するだけのSinatraアプリケーションをデプロイします。Railsの場合も手順はほぼ同様だと思われます。

@Epictetus
Epictetus / creating-edgerails-app.sh
Created December 2, 2012 11:05 — forked from peter/creating-edgerails-app.sh
Creating and Deploying an EdgeRails (Rails 4) Application to Heroku
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
gem install bundler
# 1. Get edge Rails source (master branch)
git clone https://github.com/rails/rails.git
@Epictetus
Epictetus / traceable.rb
Created November 30, 2012 14:17 — forked from jugyo/traceable.rb
Kernel.traceable to find source location to be called specific method
# Usage:
#
# class Foo
# def foo
# p 'foo'
# end
# end
#
# Kernel.traceable(:p)
# Foo.new.foo
@Epictetus
Epictetus / 0-README.md
Created November 19, 2012 15:54 — forked from rummelonp/0-README.md
Nginx+Unicorn+Rails+Capistrano 用の設定の雛形
@Epictetus
Epictetus / why.md
Created November 19, 2012 15:20
Why Brit Ruby 2013 was cancelled and why this is not ok

Why Brit Ruby 2013 was cancelled and why this is not ok

This is my post-mortem of why the conference was cancelled - it isn't an official statement

  • It was pointed out on Twitter that the lineup so far is white males.
  • This became frenzied and shared with allegations of racism/sexism.
  • This put the sponsors in an awkward position regarding commitment to the conference.
  • This meant the venue contract couldn't be signed because of a potential lack of financial security.
  • Since the team can't be personally liable for the costs, there was a hard decision to be made.
  • That decision was: cancel.
@Epictetus
Epictetus / gist:4071815
Created November 14, 2012 12:22 — forked from jugyo/gist:4071551
how to import ekidata for rails

駅データ.jp から以下のようなファイルをダウンロードし、 db/seeds/ekidata とか適当な場所に置く:

  • station20121102free.csv
  • line20121030free.csv
  • company20121010.csv

マイグレーション:

# db/migrate/XXXXXXXXXXXXXX_create_ekidata_stations.rb
@Epictetus
Epictetus / 0-readme.md
Created November 5, 2012 06:53 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@Epictetus
Epictetus / gist:3990891
Created November 1, 2012 00:33 — forked from gardentree/gist:1342929
ローカルネットワーク上のRails(WEBrick)のレスポンスが遅い時に
#{RUBY_HOME}/lib/ruby/1.9.1/webrick/config.rb の
:DoNotReverseLookup => nil
:DoNotReverseLookup => true
に修正する。
@Epictetus
Epictetus / devise.ja.yml
Created October 21, 2012 22:45 — forked from Junsuke/devise.ja.yml
Japanese locale file for devise (For devise 1.5.3)
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
ja:
errors:
messages:
expired: "有効期限切れです。新規登録してください"
not_found: "見つかりませんでした"
already_confirmed: "既に登録済みです。ログインしてください"
not_locked: "ロックされていません"
not_saved: