Skip to content

Instantly share code, notes, and snippets.

View ppworks's full-sized avatar
🏠
Working from home

Naoto Koshikawa ppworks

🏠
Working from home
View GitHub Profile
@udzura
udzura / fgcs.git.sh
Last active October 7, 2015 10:17
Fxcking git cheet sheet
# stage の操作
git add . # stage に加える
git add -p # stage にインタラクティブに加える
git add -N . # stage にファイルだけ加える
git rm hoge/hoge.rb # stage から消す
git rm -f hoge/hoge.rb # stage から無理矢理消す、先にファイルを消してしまった場合
git mv hoge/hoge.rb hoge/hoge2.rb # ファイル名変える
# 差とか状態を確認する系
git diff # HEADとunstagedの差分を確認する
@naoty
naoty / gists.rb
Created June 2, 2012 16:18
「#minatork01 gist.github.com -rt」で検索した結果からURLを展開・抽出
@naoty_k https://gist.github.com/2859031
@june29 https://gist.github.com/2856957
@Kirika_K2 https://gist.github.com/2856695
@r7kamura https://gist.github.com/2856841
@sugamasao https://gist.github.com/2856811
@naoty_k http://gist.github.com/2856817
@kei_s https://gist.github.com/2856767
@tdtds https://gist.github.com/2856767
@ymorimo https://gist.github.com/2856767
@nari3 https://gist.github.com/2856773
@rtekie
rtekie / subdomains.rb
Created May 14, 2012 13:14
Support for Rspec / Capybara subdomain integration testing
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@paneq
paneq / rails.rb
Created April 9, 2012 17:34
My fix for local database definition in rails
namespace :db do
def local_database?(config, &block)
if config['host'].in?(['127.0.0.1', 'localhost', '192.168.30.1']) || config['host'].blank?
yield
else
$stderr.puts "This task only modifies local databases. #{config['database']} is on a remote host."
end
end
end
@ayumin
ayumin / git-dojo.md
Created March 2, 2012 10:59
Git道場実行委員募集

Git道場実行委員募集

3月下旬~4月くらいにGit道場を開催したいと思います。

講義メインではなくてなるべく手を動かす時間をたくさんとり、参加者全員が”怖がらずにmerge/rebaseをできるようになる”というのが目標です。

このイベントに実行委員として参加してくれる方は、下記の形式のメールを送信してください。

To: git-dojo_at_qwik.jp

Cc: ayumu.aizawa_at_gmail.com

@hakobera
hakobera / rails32_on_heroku_cedar.md
Created February 23, 2012 03:29
Rails 3.2 on Heroku (cedar)

Rails 3.2 on Heroku (cedar)

環境

  • ruby 1.9.2
  • rails 3.2.1

作成フロー

SPモードメールプロトコル
------------------------
< サーバーのレスポンス
> クライアントのリクエスト
---
< 220 ESMTP Server Ready
> EHLO mail.spmode.ne.jp
@scotu
scotu / solarized.css
Created October 8, 2011 18:27 — forked from tdreyno/solarized.css
Solarized Light Pygments CSS
.highlight { background-color: #ffffcc }
.highlight .c { color: #586E75 } /* Comment */
.highlight .err { color: #93A1A1 } /* Error */
.highlight .g { color: #93A1A1 } /* Generic */
.highlight .k { color: #859900 } /* Keyword */
.highlight .l { color: #93A1A1 } /* Literal */
.highlight .n { color: #93A1A1 } /* Name */
.highlight .o { color: #859900 } /* Operator */
.highlight .x { color: #CB4B16 } /* Other */
.highlight .p { color: #93A1A1 } /* Punctuation */
@nateware
nateware / migrate.rb
Created September 23, 2011 23:25
Task for Rakefile to hook into mini_record
# For Sinatra, put this a the top-level Rakefile directly:
namespace :db do
desc "Use model properties to auto-migrate"
task :automigrate => :environment do
Dir[File.expand_path 'app/models/**.rb', File.dirname(__FILE__)].each do |model|
require model
klass = File.basename(model.sub(/\.rb$/,'')).classify.constantize
puts "== Migrating #{klass.name}"
klass.auto_upgrade!
end