⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
(ns arc.core | |
(:use compojure.core) | |
(:require [compojure.route :as route] | |
[compojure.handler :as handler] | |
[ring.util.response :as response] | |
[ring.adapter.jetty :as jetty])) | |
(def route-map (ref {})) | |
(def ^:dynamic *params* nil) |
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
def board(size, tunnels) | |
Hash.new {|_,i| i }. | |
merge(Hash[(1..6).map{|i| [size + i, size - i] }]). | |
merge(tunnels) | |
end | |
def move(board, players, player, roll) | |
players[player] = board[ players[player] + roll ] | |
[players, next_player(players.size, player, roll)] | |
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
UPDATE table_to_be_updated t1 | |
SET (t1.col1, t1.col2) = | |
(SELECT (t2.col1, t2.col2) subquery_or_table t2 | |
WHERE(t2.id1, t2.id2) in (t1.id1,t1.id2)) | |
WHERE (t1.id1, t1.id2) IN | |
(select t2.id1, t2.id2 from subquery_or_table t2) |
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
def sum(arr) | |
res = 0 | |
arr.each{|e| res+=e} | |
res | |
end | |
def mult(arr) | |
res = 1 | |
arr.each{|e| res*=e} | |
res |
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
~/projects/jruby $ jruby -v bench/bench_tak.rb 5 | |
jruby 1.7.0.dev (ruby-1.8.7-p330) (2011-07-25 3e0a9dd) (OpenJDK 64-Bit Server VM 1.7.0-internal) [darwin-x86_64-java] | |
user system total real | |
1.164000 0.000000 1.164000 ( 1.132000) | |
0.917000 0.000000 0.917000 ( 0.917000) | |
0.921000 0.000000 0.921000 ( 0.921000) | |
0.918000 0.000000 0.918000 ( 0.918000) | |
0.920000 0.000000 0.920000 ( 0.920000) | |
~/projects/jruby $ jruby -Xcompile.invokedynamic=false -v bench/bench_tak.rb 5 |