(dolist (var init-form result) S式 ... )
dolist は名前が示すように、リストに関係があります。最初に init-form を評価します。このとき、評価結果はリストでなければいけません。リスト以外の場合はエラーとなります。dolist は、このリストの要素を順番に変数 var に代入して S 式を評価します。リストの要素がなくなったら result を評価し、その値が dolist の返り値になります。次の例を見てください。
- GitHub Staff
- https://bento.me/kyanny
- @kyanny
- in/kyanny
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 ApplicationController < ActionController::Base | |
# see also: http://stackoverflow.com/questions/2385799/how-to-redirect-to-a-404-in-rails | |
def not_found! | |
raise ActionController::RoutingError.new('Not Found') | |
end | |
end |
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
CONFIGURE_OPTS="--with-out-ext=tk,tk/* --with-opt-dir=`brew --prefix openssl`:`brew --prefix readline`" rbenv install 2.0.0-dev |
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
#!/usr/bin/env ruby | |
while ARGF.readline | |
puts $. | |
begin | |
$_.match /./ | |
rescue => e | |
puts $_ | |
raise e | |
end |
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
// NSString* url = [NSString stringWithFormat:@"http://api.twitter.com/1/users/profile_image?size=normal&screen_name=%@", [screenName gtm_stringByEscapingForURLArgument]]; | |
NSString *url = [NSString stringWithFormat:@"http://n.hatena.ne.jp/%@/profile/image?type=face", screenName]; // はてなのURLに変更 |
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
console.log('hi'); | |
window.Todos = Ember.Application.create(); | |
Todos.Todo = Ember.Object.extend({ | |
title: null, | |
isDone: false | |
}); | |
Todos.todosController = Ember.ArrayController.create({ | |
content:[], |
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
require 'rubygems' | |
require 'rack/streaming_proxy' | |
use Rack::Auth::Basic, "Restricted Area" do |username, password| | |
[username, password] == ['user', 'password'] | |
end | |
use Rack::StreamingProxy do |request| | |
if request.path.start_with?("/proxy") | |
"http://other.host#{request.path}" |
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
require 'rack' | |
class App | |
def call(env) | |
html = %Q!<html><body style="margin:0"><img src="http://30d.jp/img/kyanny/public/80a57ec4-fc89-11e1-9cd3-00262d09affa_original.jpg" /></body></html>! | |
[200, {'content-type' => 'text/html'}, [html]] | |
end | |
end | |
run App.new |
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
require 'rubygems' | |
require 'ruby-prof' | |
RubyProf.measure_mode = RubyProf::ALLOCATIONS | |
RubyProf.start | |
1_000_000.times{ Array.new(10) } | |
result = RubyProf.stop | |
# Print a flat profile to text | |
printer = RubyProf::FlatPrinter.new(result) | |
printer.print(STDOUT) |
基礎知識
読み物系