Skip to content

Instantly share code, notes, and snippets.

View log
Started GET "/auth/twitter?use_authorize=true" for at 2014-02-03 17:39:08 +0100
NoMethodError - undefined method `encoding' for nil:NilClass:
/Users/martin/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/cgi/util.rb:7:in `escape'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:28:in `block in build_authorize_url'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:28:in `build_authorize_url'
oauth (0.4.7) lib/oauth/tokens/request_token.rb:9:in `authorize_url'
omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:36:in `request_phase'
omniauth-twitter (1.0.1) lib/omniauth/strategies/twitter.rb:60:in `request_phase'
omniauth (1.2.1) lib/omniauth/strategy.rb:215:in `request_call'

Clojure Conspiracy goes Euroclojure

Hey there, I know you're going to Euroclojure and since there are a lot of people going from Berlin I thought it could be fun to rent a small bus and go in a group while entertaining ourselves with some clojure related stuff like programmed music or things like lightning talks.

Before I spend more time check if that's possible, what the price would be etc, I'd obviously like to know if people would be interested in that and open to giving up some of there flexibility by going to Krakow and back in a group. I guess we'd probably leave on Wednesday evening and then go back on Sunday so everyone is able to spend some nice weekend in Krakow too!

martinklepsch / Dockerfile-broken
Created May 20, 2014
Dockerfile does not work without setting workdir even if all file references are absolute
View Dockerfile-broken
FROM dockerfile/java
# copy the locally built fat-jar to the image
ADD app.jar /
EXPOSE 42042
# run the server when a container based on this image is being run
ENTRYPOINT [ "java", "-verbose", "-jar", "/app.jar" ]
View for-exceptions.clj
(for [snippet snippets
idx (range (count snippets))]
(parser/patentxml->map snippet)
(catch Exception e
(error xml-archive "::" idx))))))
;; (parser/patentxml->map snippet))))
View retrieval.clj
(defn parse [cursor]
(clojure.walk/postwalk (fn [m]
(if-let [v (:_value m)]
(and (map? m) (empty? m)) nil
(map? m) (into {} (remove (comp nil? second) m))
:else m)))
View retrieval.clj
(def foo {:bar 1 :moo {:event {:_value 2} :ter {:_value 1} :ber {}}
:floors [{:area {:_value 10} :height {}} {:area {} :height {:_value 5}}]
:roofs [{:area {}}]})
(defn parse [cursor]
(clojure.walk/postwalk (fn [m]
(if-let [v (:_value m)]
(and (map? m) (empty? m)) nil
View handler.clj
(defn now-plus [n]
"Returns current time plus `n` minutes as string"
(let [f (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")]
(.setTimeZone f (TimeZone/getTimeZone "GMT" ))
(.format f (Date. (+ (System/currentTimeMillis) (* n 60 1000))))))
View core.clj
(defn file->map [f]
{:name (.-name f)
:type (.-type f)
:size (.-size f)})
(defn sign-file [file]
(let [out (chan)
fmap (file->map file)
edn-ize #(reader/read-string (.getResponseText (.-target %)))]
(.send XhrIo (str "/sign?file-name=" (:name fmap) "&mime-type=" (:type fmap))
View core.clj
(def report-chan (chan 10))
(def upload-files (comp (map #(upload-file % report-chan))))
(def upload-chan (chan 10 upload-files))
(def sign-files (comp (map #(sign-file % upload-chan))))
(def signing-chan (chan 10 sign-files))
(def test-file
(first (array-seq (.-files (gdom/getElement "fin")))))
(put! signing-chan test-file)
View patent-statistics.edn
"200505" {:patents 23250, :inventors 21342},
"201002" {:patents 26221, :inventors 24356},
"200108" {:patents 8674, :inventors 8221},
"200301" {:patents 24023, :inventors 22191},
"201206" {:patents 29866, :inventors 27208},
"2001" {:patents 56410, :inventors 50014},
"201408" {:patents 29835, :inventors 27461},
"201210" {:patents 25637, :inventors 23490},
"200902" {:patents 24523, :inventors 22723},
You can’t perform that action at this time.