Skip to content

Instantly share code, notes, and snippets.

@cjsauer
cjsauer / _Fulcro_Authorization_Idea
Last active April 3, 2021 00:02
Fulcro RAD Authorization Idea
@cjsauer
cjsauer / .dir-locals.el
Created March 24, 2020 20:12
Fulcro dom element indentation in Emacs
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((clojure-mode
(eval define-clojure-indent
(dom/a 1)
(dom/abbr 1)
(dom/address 1)
(dom/altGlyph 1)
(dom/altGlyphDef 1)
namespace MyProject.Core
{
using MyProject.Utilities;
using NatCorderU.Core;
using System.Collections;
using UnityEngine;
public class ReplayRecorder : MonoBehaviour
{
public int width = 960;
@cjsauer
cjsauer / cider-nrepl
Last active July 1, 2018 18:22
Cider nREPL bin script using tools.deps
clj -A:cider:dev -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init ["cider.nrepl/cider-middleware" "refactor-nrepl.middleware/wrap-refactor"])'
@cjsauer
cjsauer / autossh-datomic-socks-proxy
Last active August 16, 2019 09:20
Workaround for flaky Datomic SOCKS proxy script. Make sure to first install `autossh`. (Originally suggested by "jaret" in the #datomic Slack channel)
#!/bin/bash
while [ $# -gt 1 ]
do
case "$1" in
-p)
PROFILE_COMMAND="--profile $2"
;;
-r)
REGION=$2
;;
@cjsauer
cjsauer / datomic_ensure.clj
Last active June 2, 2018 02:52
Datomic Cloud schema ensure helpers
(ns datomic-ensure
(:require [datomic.client.api :as d]))
(defn cardinality
"Returns the cardinality (:db.cardinality/one or
:db.cardinality/many) of the attribute"
[db attr]
(->>
(d/q '[:find ?v
:in $ ?attr
@cjsauer
cjsauer / spec-errors-example.cljs
Created March 1, 2018 15:33
Short example of humanizing clojure.spec/explain-data output
(ns my-app.errors
(:require [my-app.spec :as spec]
[cljs.spec.alpha :as s]))
(def error-map
{::spec/required "This field is required"
::spec/max-length "This field is too long"
:email/regex "Invalid email address"
:password/regex "Password must contain at least 1 letter and 1 number"
:password/min-length "Password must be at least 8 characters in length"