Skip to content

Instantly share code, notes, and snippets.

(defn animated-component []
(let [fade-anim (ui/animated-value. 0)]
(r/create-class
{:component-did-mount
(fn [this]
(-> ui/animated
(.timing fade-anim #js {:toValue 1
:duration 3000})
(.start)))
(ns foobar.font-awesome
(:require [cljsjs.react]))
(defn icon [{:keys [name class size rotate flip fixed-width spin pulse stack inverse component]
:or {component :span}
:as props}]
[component
(assoc props
:class (str "fa fa-" class " "
(if size (str "fa-" size)) " "
@Deraen
Deraen / spec-coercion.clj
Created June 14, 2016 15:47
Clojure.spec coercion test
(ns spec-test.core
(:require [clojure.spec :as s]))
(defn x-integer? [x]
(if (integer? x)
x
(if (string? x)
(try
(integer/parseint x)
(catch exception e
@Deraen
Deraen / build.boot
Last active June 3, 2016 15:07
Thinking about Cider boot-cljs-repl env
;; Called from nREPL started by cider-jack-in
(deftask cider-dev []
(comp
(watch)
(cljs-repl-env) ;; Creates Piggieback env for use in existing nREPL
(reload)
(less)
(cljs)))
;; Called from terminal
@Deraen
Deraen / readme.md
Last active April 12, 2016 13:44
Clojure-web-formats

Built from the ashes of https://github.com/ngrunwald/ring-middleware-format

Separated concerns:

  • Content negotation
    • Low level functions?
    • Higher level functions for using with Ring request maps?
    • Separate namespaces for low-level and Ring stuff?
  • Format encoding/decoding implementations
  • Formatters?
var db = new PouchDB('mydb');
db.post({}).then(function (result) { // post a new doc
return db.get(result.id); // fetch the doc
}).then(function (doc) {
console.log(doc); // log the doc
}).catch(function (err) {
console.log(err); // log any errors
});
@Deraen
Deraen / vim-lightning-talk.md
Last active May 5, 2016 08:31
VIM Lightning talk
 __      _______ __  __            _____ _       _
 \ \    / /_   _|  \/  |    _     / ____| |     (_)
  \ \  / /  | | | \  / |  _| |_  | |    | | ___  _ _   _ _ __ ___
   \ \/ /   | | | |\/| | |_   _| | |    | |/ _ \| | | | | '__/ _ \
    \  /   _| |_| |  | |   |_|   | |____| | (_) | | |_| | | |  __/
     \/   |_____|_|  |_|          \_____|_|\___/| |\__,_|_|  \___|
                                               _/ |
                                              |__/

Keybase proof

I hereby claim:

  • I am Deraen on github.
  • I am juhoteperi (https://keybase.io/juhoteperi) on keybase.
  • I have a public key whose fingerprint is 5DDB C334 3CEC 9A95 AB02 72C9 0942 2480 8950 366D

To claim this, I am signing this object:

@Deraen
Deraen / Makefile
Last active January 10, 2016 16:23
Makefile and watch script for LaTeX thesis
cc=pdflatex -halt-on-error -output-directory=temp -shell-escape
bb=biber -q
pandoc=pandoc --highlight-style pygments
MDS=$(wildcard md/*.md)
MDTEXS=$(MDS:.md=.tex)
IMGS=$(wildcard kuvat/*.svg)
IMGPDFS=$(IMGS:.svg=.pdf)
@Deraen
Deraen / routes.cljs
Created January 5, 2016 19:06
Silk Schema query params
(defprotocol ToUrlParam
(-to-url-param [this]))
(defn to-url-param [x]
(if (satisfies? ToUrlParam x)
(-to-url-param x)
x))
(extend-protocol ToUrlParam
PersistentHashSet