Matthias Schneider dermatthias

View gist:10524497
1 2 3 4 5 6 7 8 9
### Keybase proof
 
I hereby claim:
 
* I am dermatthias on github.
* I am dermatthias (https://keybase.io/dermatthias) on keybase.
* I have a public key whose fingerprint is AC02 AA14 BA11 3F8D E75E 9D0A D870 E61F DA5A 94C4
 
To claim this, I am signing this object:
View otto - send to main thread
1 2 3 4 5 6 7 8 9 10
import android.os.Handler;
import android.os.Looper;
 
import com.squareup.otto.Bus;
 
public class MainThreadBus extends Bus {
private final Handler mainThread = new Handler(Looper.getMainLooper());
@Override public void post(final Object event) {
if (Looper.myLooper() == Looper.getMainLooper()) {
View appengine setup for clojure
1 2 3 4 5 6 7 8 9 10
(ns com.freiheit.clojure.appengine.appengine-local
(:use
[compojure.http routes servlet helpers]
clojure.contrib.test-is
compojure.server.jetty
[clojure.contrib def str-utils duck-streams])
(:require
[clojure.contrib.logging :as log])
(:import
[com.google.appengine.api.labs.taskqueue.dev LocalTaskQueue]
View pearson-fast.clj
1 2 3 4 5 6 7 8 9 10
(defn pearson-fast
[v1 v2]
(let [dim (double (count v1))
meanv1 (/ (areduce v1 i ret 0
(+ ret (aget v1 i))) dim)
meanv2 (/ (areduce v2 i ret 0
(+ ret (aget v2 i))) dim)
sum (areduce v1 i ret 0
(+ ret (* (- (aget v1 i) meanv1)
(- (aget v2 i) meanv2))))
View sweeeeeeeeeet! :)
1 2 3 4 5 6 7
(defn euclidean
"berechnet den (modifizierten) euklidischen abstand zwischen zwei usern"
[active other]
(Math/sqrt (reduce + (map (fn [movie]
(let [features (item-map movie)]
(reduce + (map (fn [feat] (diff active other movie feat)) features)) ))
(common-items active other)))))
View gnnnaaahhhhhhh
1 2 3 4 5 6 7 8
(defn process-file
[file-name line-func line-acc]
(reduce line-func line-acc (read-lines file-name)))
 
(defn process-line-data
[acc line]
(let [l (.split line "\t")]
(assoc acc (first l) (vec (rest l)))))
Something went wrong with that request. Please try again.