This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>カレーのレシピ</title> | |
</head> | |
<body> | |
<article> | |
<header> | |
<h1>カレーのレシピ</h1> |
This file contains hidden or 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
CC = "gcc" | |
task :default => "./quicksort" | |
desc "Execute quicksort in console" | |
task "execute_quicksort" => ["quicksort"] do |t| | |
sh "./quicksort" | |
end | |
desc "Link .o Source files" |
This file contains hidden or 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
%a{:href => "/say/goodbye"}=@time | |
%p | |
%a= link_to "back", hello_path | |
- for file in @files | |
%li ファイ名: #{file} |
This file contains hidden or 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
#ProcBlok変換復習 | |
3.times{p 'hoge'} | |
proc = Proc.new{ p 'hoge'} | |
3.times{proc.call} | |
3.times(&proc) | |
def my_method(&hoge) |
This file contains hidden or 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
#Git各種パッケージのインストール | |
sudo aptitude install git git-core curl | |
#rbenvインストール | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
#PATH設定 | |
vi /home/USERNAME/.bash_profile | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" |
This file contains hidden or 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 BenchmarkFilter | |
def before(controller) | |
@timer = Time.now | |
Rails.logger.debug do | |
"- Action #{controller.action_name} started. |" | |
end | |
end | |
def after(controller) | |
elaped_time = Time.now - @timer |
This file contains hidden or 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 BenchmarkFilter | |
def filter(controller) | |
timer = Time.now | |
Rails.logger.debug do | |
"- Action #{controller.action_name} started. |" | |
end | |
yield | |
elaped_time = Time.now - timer | |
Rails.logger.debug do |
This file contains hidden or 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 Fibona | |
@@n1, @@n2 = 0, 0 | |
def self.fibonacci(n) | |
if n > 3 | |
@@n2 += 1 if n == 4 | |
return fibonacci(n - 2) + fibonacci(n - 1) + 1; | |
elsif n == 3 | |
@@n2 += 1 | |
@@n1 += 1 |
This file contains hidden or 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
def fizz_buzz(n) | |
trance = "#{["Fizz"][n % 3]}#{["Buzz"][n % 5]}" | |
trance.empty? ? n.to_s : trance | |
end | |
puts (1..100).map{|n| fizz_buzz n } |
This file contains hidden or 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
module Fibona | |
@@memo = [0 , 1]; | |
def self.[](n) | |
#既にメモされている最大の値から計算開始 | |
#求めたい値が既に計算済みならこのループは実行されない | |
@@memo.size.upto(n){|i| @@memo[i] = @@memo[i - 1] + @@memo[i - 2]} | |
@@memo[n] | |
end | |
end |
OlderNewer