Skip to content

Instantly share code, notes, and snippets.

View eraserhd's full-sized avatar

Jason Felice eraserhd

View GitHub Profile
@eraserhd
eraserhd / json-schema-dimensions.clj
Created October 2, 2019 13:47
Finding the minimum array or string dimensions required by a JSON schema
(defn- minimum-required-dimensions
"Find a list of minimum required dimensions for the schema.
e.g. An array of array of strings might be '(2 0 3), meaning the string must
have length three, there can be zero or more strings in an array, and there
must be three or more arrays of strings in the array of arrays of strings.
To simplify logic, we keep a dimension for the innermost type, even if it is
an atomic type and doesn't make sense."
[schema]
@eraserhd
eraserhd / new.clj
Created September 27, 2019 13:57
Another win for meander
(defn- schema->type
[schema]
(let [types (concat
(m/search schema
{"format" "date-time"} :db.type/instant
{"format" "uri"} :db.type/uri
{"type" "array"} '(Array nil)
{"type" "boolean"} :db.type/boolean
{"type" "integer"} :db.type/long
{"type" "string"} :db.type/string
@eraserhd
eraserhd / new.clj
Created September 26, 2019 16:35
Small but nice win for Meander
(doseq [attr #{"asset-location" "brand-name" "name" "uuid"}]
(eval
(m/subst
(defrule ~(symbol (str "Branding-" attr))
[EAV (= e '?e) (= a ~(keyword "brand" attr)) (= v '?v)]
=>
(synthesize! '?e ~(keyword "branding" attr) '?v)))))
Note: The following stack trace applies to the reader or compiler, your code was not executed.
CompilerException Unexpected error macroexpanding meander.syntax.epsilon/defsyntax at (meander/epsilon.cljc:208:1). #:clojure.error{:phase :macroexpansion, :line 208, :column 1, :source "meander/epsilon.cljc", :symbol meander.syntax.epsilon/defsyntax}
clojure.lang.Compiler.macroexpand1 (Compiler.java:7018)
clojure.lang.Compiler.macroexpand (Compiler.java:7074)
clojure.lang.Compiler.macroexpand (Compiler.java:7076)
clojure.lang.Compiler.eval (Compiler.java:7160)
clojure.lang.Compiler.load (Compiler.java:7635)
clojure.lang.RT.loadResourceScript (RT.java:381)
clojure.lang.RT.loadResourceScript (RT.java:372)
clojure.lang.RT.load (RT.java:463)
{
"/nix/store/c4idqf4nl9xl7vgh11yh0cdgkjyvxxn4-vault-1.2.2.drv": {
"outputs": {
"out": {
"path": "/nix/store/22lhnlh4m3n6gbns6qdmsgi4sh4q0gr9-vault-1.2.2"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
{
"/nix/store/c4idqf4nl9xl7vgh11yh0cdgkjyvxxn4-vault-1.2.2.drv": {
"outputs": {
"out": {
"path": "/nix/store/22lhnlh4m3n6gbns6qdmsgi4sh4q0gr9-vault-1.2.2"
}
},
"inputSrcs": [
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"
],
@eraserhd
eraserhd / foo.clj
Created September 13, 2019 13:30
m/search
(defn last-sent-input-tx [eav-map]
(m/search eav-map
{?lsi {:last-sent-task-input/input [?input]
:last-sent-task-input/exec-uuid [?exec-uuid]}
?exec {:taskexec/uuid [?exec-uuid]
:taskexec/def [?def]}
?def {:taskdef/automated [false]}}
[:db/add ?lsi :last-sent-task-input/input (fix-input ?input)]))
@eraserhd
eraserhd / home-manager.log
Created September 5, 2019 15:34
failure
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Activating home-manager configuration for jfelice
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Starting home manager activation
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Activating checkFilesChanged
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Activating checkLinkTargets
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Activating writeBoundary
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: Activating installPackages
Sep 05 10:38:36 crunch hm-activate-jfelice[120484]: installing 'home-manager-path'
Sep 05 10:38:36 crunch nix-daemon[92684]: accepted connection from pid 120507, user jfelice
Sep 05 10:38:41 crunch dbus-daemon[1020]: [system] Reloaded configuration
Sep 05 10:38:41 crunch hm-activate-jfelice[120484]: building '/nix/store/h4gghwngh23vi45q73irgp7l7ra4r1jz-user-environment.drv'...
config = {
environment.systemPackages = mkIf cfg.enable [ kubectlWrapper pkgs."2u".ops-tools ];
nixpkgs.overlays = [ (self: super: {
"2u" = super."2u" // {
kubectl-config = (import ../../pkgs/kubectl-config { stdenv = super.stdenv; }).override { configure = cfg; };
};
}) ];
};
commit 1611a26b2af09d218a909b4a9af52bf477df9600
Author: Jason Felice <[email protected]>
Date: Wed Jul 17 15:46:13 2019 -0400
ifx ypto "accpets"
diff --git a/test/test_EducationalOrganization.js b/test/test_EducationalOrganization.js
index c08ab3b..53adafc 100644
--- a/test/test_EducationalOrganization.js
+++ b/test/test_EducationalOrganization.js