This file contains hidden or 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
;; There are some patterns with c.a.flow that weren't immediately obvious to me so I made this gist to | |
;; figure them out. | |
;; Those patterns are: | |
;; - backpressure across processes | |
;; - long-running tasks | |
;; - getting inputs for the first process in the flow | |
(require '[clojure.core.async :as async] | |
'[clojure.core.async.flow :as flow] | |
'[clojure.pprint :as pp] |
This file contains hidden or 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 -J-Dconf=local/config-overrides ... rest of command |
This file contains hidden or 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 app.hooks | |
(:require | |
;; A lib provided by react to make these types of integrations easier: | |
["use-subscription" :as react.use-subscription] | |
[re-frame.interop :as rf.interop] | |
[re-frame.core :as rf] | |
[helix.hooks :as h.hooks] ; cljs wrapper of the react hooks api | |
)) | |
(defn- maybe-dispose! [^clj reaction] |
This file contains hidden or 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 ansible.core | |
(:require [clojure.java.shell :as sh] | |
[clojure.string :as str] | |
[cheshire.core :as cheshire] | |
[clojure.java.io :as io]) | |
(:import (java.io File) | |
(com.fasterxml.jackson.core JsonGenerator) | |
(java.util Base64) | |
(java.security MessageDigest MessageDigest$Delegate))) |
This file contains hidden or 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 kc.datomic | |
"Datomic utility functions | |
Usage Notes: | |
Some functions in this namespace take sequences of facts and return them modified in some way. Some up-front modifications are useful for those functions, like replacing all map-form facts with vector-form facts. In order to avoid doing these modifications repeatedly to same the same set of facts (which would be harmless but wasteful), two versions of these functions exist: a \"safe\" version that does those up-front modifications, and an \"unsafe\" version that expects those modifications to already have been performed. The unsafe versions are named like the safe ones, but with a single quote appended. | |
TODO: | |
- consider implementing all fns that branch based on operation as multimethods | |
These fns mostly support :db/add, :db/retract :db.fn/retractEntity, :db.fn/cas, |
This file contains hidden or 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
var | |
// "appstate" object | |
obj = {}, | |
// data-level onChange handler - doesn't deal w/ the dom. | |
onChange = function(newValue){ obj.attr = newValue; }, | |
// start function that deals with the dom and calls the data-level event handler | |
start = function(handler){ | |
$(".selector").on("change", function(e){ | |
e.preventDefault(); | |
handler(e.target.value); |
This file contains hidden or 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 datasources (agent {})) | |
(defn make-datasource [db-conf] | |
(send-off datasources | |
(fn [datasources] | |
(if-let [ds-conf (get datasources db-conf)] | |
(update-in datasources [db-conf :count] inc) | |
(assoc datasources | |
db-conf {:count 1 | |
:ds (conn-pool/make-datasource db-conf)})))) |
This file contains hidden or 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 om-tutorial.core | |
(:require [goog.dom :as gdom] | |
[om.next :as om :refer-macros [defui]] | |
[om.dom :as dom])) | |
(enable-console-print!) | |
(def init-data | |
{:list/one [{:name "John" :points 0} | |
{:name "Mary" :points 0} |
This file contains hidden or 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
Exception in thread "main" java.lang.NoClassDefFoundError: clout/core/Route | |
at composur.routes.auth__init.load(Unknown Source) | |
at composur.routes.auth__init.<clinit>(Unknown Source) | |
at java.lang.Class.forName0(Native Method) | |
at java.lang.Class.forName(Class.java:270) | |
at clojure.lang.RT.loadClassForName(RT.java:2098) | |
at clojure.lang.RT.load(RT.java:430) | |
at clojure.lang.RT.load(RT.java:411) | |
at clojure.core$load$fn__5018.invoke(core.clj:5530) | |
at clojure.core$load.doInvoke(core.clj:5529) |
This file contains hidden or 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
;;; I'm not using Om yet because I've got a lot of code using Pump and just haven't made the transition, | |
;;; but the principles are all the same. So you'll see Pump-specific code here. | |
(def code->key | |
"map from a character code (read from events with event.which) | |
to a string representation of it. | |
Only need to add 'special' things here." | |
{13 "enter" | |
37 "left" | |
38 "up" |
NewerOlder