View chsk.cljc
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 populace.web.chsk | |
(:require #?@ | |
(:clj | |
[[aleph.http :as http] | |
[bidi.bidi :refer (path-for RouteProvider tag)] | |
[bolt.authentication :refer :all] | |
[bolt.authentication.protocols :refer (RequestAuthenticator)] | |
[byte-streams :as bs] | |
[hara.event :refer :all] | |
[ring.middleware.transit :refer [encode decode]] |
View parser.cljc
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 populace.parser | |
(:refer-clojure :exclude [read]) | |
(:require [populace.user :as user] | |
[om.next.impl.parser :as parser] | |
[#?(:clj juxt.datomic.extras | |
:cljs populace.utils.datascript) | |
:refer (DatomicConnection as-conn as-db to-ref-id to-entity-map)] | |
#?@(:clj | |
[[populace.auth.client :refer :all] | |
[populace.config :refer [config filter-cljs]] |
View markov.clj
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 markov-data | |
[words] | |
(->> words | |
(partition 2 1) | |
(reduce (fn [acc [w next-w]] | |
(update-in acc | |
[w next-w] | |
(fnil inc 0))) | |
{}))) |
View async_protocol.clj
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 async-protocol | |
(:require [clojure.core.async :as async] | |
[clojure.set :as set] | |
[com.stuartsierra.component :as component :refer (Lifecycle)] | |
[taoensso.timbre :as log])) | |
(defn throw-err [e] | |
(when (instance? Throwable e) (throw e)) | |
e) |
View rum_cmp.cljs
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
(defprotocol IRender | |
(renderer [_]) | |
(render-fn [_ views])) | |
(defprotocol IRumView | |
(display-name [_]) | |
(state? [_]) | |
(mixins [_])) | |
(defn rum-ctor [view] |
View kargs.clj
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 | |
([] (kargs {})) | |
([a b & {:as r}] | |
(kargs (assoc r a b))) | |
([a] a)) | |
(and (= (kargs :some 1 :me 2) | |
(kargs {:some 1 :me 2}) | |
{:some 1 :me 2}) | |
(= (kargs) |
View clojure-repls.el
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
;;; clojure-repls.el --- Assign repls for clj and cljs eval | |
;; Copyright (C) 2015 Dylan Butman | |
(require 'cider) | |
(require 'dash) | |
(defvar clojure-repls-clj-con-buf nil) | |
(defvar clojure-repls-cljs-con-buf nil) |
View poller.clj
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 poller | |
(:require | |
[clojure.core.async :as async :refer (chan alts! go-loop timeout >! close!)] | |
[clojure.core.async.impl.protocols :as impl] | |
[com.stuartsierra.component :as component] | |
[plumbing.core :refer :all :exclude [update]] | |
[schema.core :as s])) | |
(defn poll! | |
"executes f at frequency and puts the result on output-chan, returns a stop functions" |
View transition.cljs
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 utils.transition | |
(:require-macros [cljs.core.async.macros :refer [go go-loop]]) | |
(:require [cljs.core.async :as async :refer [<! put! chan sub timeout]] | |
[plumbing.core :refer [update map-vals] :refer-macros [defnk fnk fn->]] | |
[bardo.ease :as ease] | |
[bardo.interpolate :as intrpl] | |
[cljs-time.core :as t] | |
[cljs-time.coerce :as tc] | |
[om.core :as om :include-macros true] | |
[om-tools.core :refer-macros [defcomponentk]] |
View debounce.clj
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 | |
"debounce an action on a channel for values that produce the same result of a key-fn" | |
([f input-ch wait] (debounce f input-ch wait identity)) | |
([f input-ch wait key-fn] | |
;; keep a map of keys that have been triggered | |
(go-loop [debounced {}] | |
(let [[v c] (alts! (conj (vals debounced) input-ch))] | |
(if (= c input-ch) | |
(let [key (key-fn v)] | |
(if (get (into #{} (keys debounced)) key) ;; if our key is debounced |
NewerOlder