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 group-by-reducers.core | |
(:require [clojure.core.reducers :as r :only [fold reduce map]]) | |
(:require [criterium.core :as c])) | |
(defn group-by-naive [f coll] | |
(reduce | |
(fn [groups a] | |
(assoc groups (f a) (conj (get groups a []) a))) | |
{} | |
coll)) |
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
# 1.9.3-p194-perf - GC tweaks | |
✓ ~/code/sspinc/cartman » time bundle exec rake environment | |
bundle exec rake environment 5.16s user 1.60s system 95% cpu 7.067 total | |
✓ ~/code/sspinc/cartman » time bundle exec rake environment | |
bundle exec rake environment 5.23s user 1.57s system 95% cpu 7.113 total | |
# 1.9.3-p194-perf - No GC tweaks | |
✓ ~/code/sspinc/cartman » time bundle exec rake environment | |
bundle exec rake environment 6.60s user 1.44s system 98% cpu 8.157 total | |
» time bundle exec rake environment |
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 | |
class Greeter | |
def self.call(language) | |
new(language) | |
end | |
def initialize(language) | |
@language = language | |
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
repl-port |
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-of-pos-elements (memoize (fn [xs] (apply + (filter #(>= % 0) xs))))) | |
(def sum-of-neg-elements (memoize (fn [xs] (apply + (filter #(< % 0) xs))))) | |
(defn subset-sum | |
"Returns the indexes of elements in xs whose sum is s" | |
([xs s] | |
(subset-sum xs (dec (count xs)) s)) | |
([xs i s] | |
"Returns the indexes of elements x0...xi (in xs) whose sum is s" | |
(let [sol (subset-sum xs i s [])] |
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
#!/bin/sh | |
clj_base="${HOME}/code/clojure"; | |
java -cp .:${clj_base}/lib/jline-0.9.94.jar:${clj_base}/clojure/target/clojure-1.5.0-master-SNAPSHOT.jar:${clj_base}/criterium-0.2.2-SNAPSHOT-standalone.jar:${clj_base}/clojurescript jline.ConsoleRunner clojure.main "$@" |
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
render partial: 'avatar', locals: { mood: 'depressed' } # works fine | |
render 'avatar', locals: { mood: 'depressed' } # undefined local variable or method 'mood' (in the partial) | |
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
diff --git a/src/MacVim/mvim b/src/MacVim/mvim | |
index 653cf78..5e6b0d7 100755 | |
--- a/src/MacVim/mvim | |
+++ b/src/MacVim/mvim | |
@@ -13,6 +13,11 @@ | |
# or by un-commenting and editing the following line: | |
# VIM_APP_DIR=/Applications | |
+tabs=true | |
+if [ "$1" = "-f" ]; then |
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
require 'forwardable' | |
class X | |
def foo | |
puts "foo!" | |
end | |
alias_method :bar, :foo | |
end | |
class Y < X |