Skip to content

Instantly share code, notes, and snippets.

View yenda's full-sized avatar
💭
When the Facts Change, I Change My Mind. What Do You Do, Sir?

Eric Dvorsak yenda

💭
When the Facts Change, I Change My Mind. What Do You Do, Sir?
View GitHub Profile
@yenda
yenda / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yenda
yenda / interview.clj
Last active February 26, 2016 15:28
Zalando interview
;; I had a really hard time programming and thinking in Clojure within a raw text editor and under stress,
;; so I took gave a new try to the problem using the repl and my usual editor (emacs) for a second shot
;; using the repl helped me quickly discard poor solutions and fix small quirks.
;; Here is what I came up with :
;; First I get the headers with the max width of each columns and print them, the way I started it during the interview
;; Then I completed each row with the missing keys using a sorted map and adding the whitespaces
;; Then I printed all the rows
(def c1 (chan))
(def c2 (chan))
(def xf (map #(repeat 3 %)))
(a/pipeline 4 c2 xf c1)
(a/put! c1 {:name "hello"})
(<!! c2)
@yenda
yenda / readme-macro
Created August 19, 2016 22:16
readme-macro
(defmacro readme
[& names]
`(do ~@(map #(list 'def (vary-meta (first %) assoc :declared true) (second %)) (partition 2 names))))
@yenda
yenda / test
Created November 10, 2016 09:57
digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
"useless docstring"
(ns cljs-browser-repl.compiler
(:require-macros [cljs.env.macros :refer [with-compiler-env]])
(:require [replumb.core :as replumb]
[replumb.repl :refer [current-ns]]
[cljs.tools.reader :as r])
(:import goog.net.XhrIo)
)
0xadaf150b905cf5e6a778e553e15a139b6618bbb7
0x2127edab5d08b1e11adf7ae4bae16c2b33fdf74a
(re-frame/reg-fx
::save-discover
(fn [discover]
(discoveries/save discover)))
(re-frame/reg-fx
::save-discovers
(fn [discovers]
(doseq [{:keys [message-id] :as discover} discovers]
(when-not (discoveries/exists? message-id))
@yenda
yenda / final?
Created November 21, 2017 16:03
(defn add-discover [db {:keys [message-id tags] :as discover}]
(-> db
(update :tags concat tags)
(assoc-in [:discoveries message-id discover])))
(defn new-discover? [discoveries {:keys [message-id]}]
(not (get discoveries message-id )))
(handlers/register-handler-fx
:discoveries-response-received