Skip to content

Instantly share code, notes, and snippets.

View ywatai's full-sized avatar

Yasuyuki Watai ywatai

  • Tokyo, Japan
View GitHub Profile
@ywatai
ywatai / http_server.feature
Last active December 18, 2015 03:29
http, smtp あたりのプロトコルの基礎とサーバの扱いを学んでもらうにあたり 新人にいきなりこれを見せてサーバを作らせるのはどーか。
#language: ja
フィーチャ: httpサーバ
シナリオ: 静的コンテンツが表示される
もし "/"にアクセスする
ならば HTTPのステータスコードは"200"
かつ 以下の文字列を含むコンテンツが返される
"""
ようこそ!!
@ywatai
ywatai / Gemfile
Created February 26, 2013 08:23
bundler miss gems on git repository when running in bundler environment.
source "https://rugygems.org/"
gem "rails", git:"git://github.com/rails/rails.git"
@ywatai
ywatai / devise.ja.yml
Created February 18, 2013 16:08
devise locale file: Japanese translation (based on en locale def in 2.2.3)
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
ja:
devise:
confirmations:
# confirmed: "Your account was successfully confirmed. You are now signed in."
confirmed: "アカウントの確認が完了しました。ようこそ!"
# send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
send_instructions: "数分でアカウントの確認手順を記載したメールが届きます。"
# send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
@ywatai
ywatai / gist:2835805
Created May 30, 2012 11:57
Bootstrap capistrano + railsless deploy with bundler
mkdir product
cd product
cat <<EOF > Gemfile
source :rubygems
gem 'capistrano'
gem 'railsless-deploy'
EOF
bundle install
capify .
@ywatai
ywatai / gist:2702880
Created May 15, 2012 16:00
Running rpmbuild without global (or user-local) build directory
#!/bin/bash
PWD=`pwd`
mkdir -p build/{BUILD,SOURCES,SPECS,RPMS,SRPM}
cp $SRC build/SOURCES
rpmbuild -D "_topdir $PWD/build" $*
@ywatai
ywatai / gist:1964983
Created March 3, 2012 08:29
Octpress on github pages: setup
% rbenv install 1.9.2-p290
% rbenv rehash
% git clone https://github.com/imathis/octopress.git
% cd octopress
% rbenv local 1.9.2-p290
% ruby -v
% gem install bundler
% bundle install
@ywatai
ywatai / gist:1893358
Created February 23, 2012 15:42
rbenv installation on Mac (log)
% brew update
% brew install rbenv
==> Downloading https://github.com/sstephenson/rbenv/tarball/v0.3.0
######################################################################## 100.0%
==> Caveats
To enable shims and autocompletion, add rbenv init to your profile:
eval "$(rbenv init -)"
==> Summary
/usr/local/Cellar/rbenv/0.3.0: 32 files, 160K, built in 6 seconds
% echo 'eval "$(rbenv init -)"' > ~/.zshrc.rbenv
@ywatai
ywatai / filter_gc_log.sh
Created February 17, 2012 01:25
java GC log filter (one-liner)
#!/bin/sh
grep "GC" $1 | awk ' NR == 1 { offset = $1 }; { $1 = sprintf("%.3f", $1 - offset); print $0 }'
@ywatai
ywatai / application_controller.rb
Created October 12, 2011 00:32
i18n filter for rails 3.0.x (from tutorial)
class ApplicationController < ActionController::Base
protect_from_forgery
# l19n by url parameter
before_filter :set_locale
private
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end