This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- Mode: Emacs-Lisp ; Coding: utf-8 -*- | |
;; スタートアップ時のメッセージを抑制 | |
(setq inhibit-startup-message t) | |
;; エンコーディングは基本的にUTF-8 | |
(set-language-environment "Japanese") | |
(set-terminal-coding-system 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(set-buffer-file-coding-system 'utf-8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
export PATH=/usr/local/bin:$PATH | |
# export PATH=$HOME/.powconfig:$PATH | |
# if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi | |
eval "$(rbenv init -)" | |
export CC=gcc-4.2 | |
alias -g be="bundle exec" | |
alias -g E='emacs -nw' | |
alias -g rs="rspec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 全部の問題で e = [1,2,3,4,5] を対象に回答してください | |
e = [1,2,3,4,5] | |
e[0] # 1 | |
# 末尾の要素(5)を返すメソッド | |
e[4] # 5 | |
e.slice(4) | |
e.last | |
e.at(4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
describe Array do | |
let(:e) { [1,2,3,4,5] } | |
it "先頭の要素(1)を返すメソッド" do | |
e[0].should == 1 | |
e.at(0).should == 1 | |
e.first.should == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# | |
require 'nkf' | |
class PhoneticMap | |
def data | |
@data ||= build_data | |
end | |
def index_of(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Formatter | |
def output_report(title, text) | |
raise 'Abstruct method called' | |
end | |
end | |
class HTMLFormatter < Formatter | |
def output_report(title, text) | |
puts '<html>' | |
puts '<head>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
presenters = %w(mizzyさん fuchinoさん demiさん kulopさん わじさん ライティさん まよとさん あんちぽさん あよはたさん \ | |
うーたんさん うまづらさん テリーさん けんごさん tnmtさん) | |
presenters.shuffle! | |
presenters.each_with_index do |presenter, index| | |
puts "#{index+1}. #{presenter}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://blog.uu59.org/2011-10-03-sinatra-stream.html | |
require "rubygems" | |
require "sinatra" | |
set :server, :thin # 注: :keep_openが使えるのはイベントベースのサーバだけなのでthinを明示的に指定してる | |
connections = [] | |
get '/' do | |
# keep stream open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# expect to の書き方が推奨されているので書きなおす | |
# https://github.com/rspec/rspec-rails | |
# ↓ 落ちる | |
it "routes to #show" do | |
expect(get: "/entries/1").to route_to(controller: "entries", action: "show", id: "1") | |
end | |
Failures: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/yuta% sudo php-build 5.3.9 ~/.phpenv/versions/5.3.9 | |
Password: | |
[Info]: Loaded pyrus Plugin. | |
[Info]: Loaded xdebug Plugin. | |
[Info]: php.ini-production gets used as php.ini | |
[Info]: Building 5.3.9 into /Users/yuta/.phpenv/versions/5.3.9 | |
[Skipping]: Already downloaded and extracted http://www.php.net/distributions/php-5.3.9.tar.bz2 | |
[Preparing]: /var/tmp/php-build/source/5.3.9 | |
[Compiling]: /var/tmp/php-build/source/5.3.9 | |
[Pyrus]: Downloading from http://pear2.php.net/pyrus.phar |
OlderNewer