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
(def inputs [{:korks :email} | |
{:korks [:name :first]} | |
{:korks [:name :last]}]) | |
(defn form [app owner] | |
(reify | |
om/IInitState | |
(init-state [this] | |
(reduce (fn [state {:keys [korks]}] | |
(assoc-in state korks nil)) |
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]] |
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]] |
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 |
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))) | |
{}))) |
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) |
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] |
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) |
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) |
NewerOlder