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
(defn kargs [& {:as args}] | |
args) | |
;; idempotent | |
(= ((-> kargs | |
(partial :test 1))) | |
((-> kargs | |
(partial :test 1) | |
(partial :test 1)))) | |
;; => true |
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
# convert all spaces to underscores, remove characters like {}(),\! and convert the filename to lowercase. | |
ls | while read -r FILE | |
do | |
mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'` | |
done | |
# just spaces to underscores | |
ls | while read -r FILE |
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 agencyrx.utils.chsk | |
(:require-macros | |
[cljs.core.async.macros :refer [go go-loop]]) | |
(:require | |
[cljs.core.async :as async :refer (<! >! put! chan dropping-buffer)] | |
[taoensso.sente :as sente :refer (cb-success?)])) | |
(defn control-loop | |
"calls f on each value read from read-chan | |
returns a control channel that can :play, :pause, and :kill the read loop" |
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 starlab.services.nashorn | |
(:require [clojure.tools.logging :as log] | |
[clojure.java.io :as io]) | |
(:import [javax.script | |
Invocable | |
ScriptEngineManager]) | |
(:use [plumbing.core :exclude [update]])) | |
(defn nashorn-env [] | |
(doto (.getEngineByName (ScriptEngineManager.) "nashorn") |
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
(defcomponentk component-interpolator | |
[data | |
owner | |
[:opts | |
view-factory | |
{interpolator (fnk [{prev nil} next] ;; views are (partial contructor data) | |
(fn [t] | |
(next)))} | |
{duration 1000} | |
{ease (ease/ease :cubic-in-out)}]] |
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
(defn debounce-action | |
([period events-ch f] | |
(debounce-action period events-ch f [])) | |
([period events-ch f & args] | |
(go-loop [] | |
(let [[v c] (alts! [(timeout period) events-ch])] | |
(when v | |
(if (= c events-ch) | |
(recur) | |
(apply f args))))))) |
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
(defn read-images-from-disk [] | |
;; return images or | |
[]) | |
(defn save-images-to-disk [images] | |
;; delete the old ones | |
;; save the new ones | |
) | |
(defn fetch-images [] |
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 router | |
#+cljs (:require-macros [cljs.core.match.macros :refer [match]]) | |
(:require [domkm.silk :as silk] | |
[clojure.string :as str] | |
#+clj [content :as content] | |
#+clj [drivers.email :as email] | |
#+clj [clojure.core.match :refer [match]] | |
#+clj [compojure.core :as compojure :refer [defroutes GET POST PUT DELETE]] | |
#+clj [compojure.route :as route] | |
#+clj [com.stuartsierra.component :as component] |
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 browser | |
(:require-macros [cljs.core.async.macros :refer [go go-loop]]) | |
(:require [goog.events :as events] | |
[clojure.string :as str] | |
[cljs.core.async :refer [put! <! chan]]) | |
(:import goog.History | |
goog.history.Html5History | |
goog.history.Html5History.TokenTransformer | |
goog.history.EventType)) |
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
(defn control-loop | |
"calls f on each value read from read-chan | |
returns a control channel that can :play, :pause, and :kill the read loop" | |
([f read-chan] (control-loop f read-chan (chan))) | |
([f read-chan control] | |
(go-loop [action :play] | |
(let [[v c] (alts! (condp = action | |
:play [read-chan control] | |
:pause [control]))] | |
(when-not (nil? v) |