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
;; Because in formal logic, ∀x.P(x) = ¬∃x.¬P(x) | |
(d/q '[:find ?id | |
:in $ [?interest ...] | |
:where | |
[?a :account/id ?id] | |
(not-join [?a ?interest] | |
[?a :account/interest ?i] | |
(not [(= ?i ?interest)]))]) | |
;; It is harder to understand when you bind interest as above if you |
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
(with-open [pdf-document (PDDocument/load (clojure.java.io/file THE-FILE))] | |
(let [doc (.getDocument pdf-document) | |
getobj (fn [^COSObject x] | |
[:pdf.type/object (.getObjectNumber x) (.getGenerationNumber x)]) | |
visit (fn [^COSBase x ^ICOSVisitor vis] | |
(if (.isDirect x) | |
(if (instance? COSObject x) | |
(getobj x) | |
(.accept x vis)) | |
(cond |
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
(require | |
'[cemerick.url :as url] | |
'[clojure.spec.alpha :as s] | |
'[clojure.spec.gen.alpha :as sgen]) | |
(defn non-empty-string-alphanumeric | |
[] | |
(sgen/such-that #(not= "" %) | |
(sgen/string-alphanumeric))) |
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 metosin.common.edn | |
#+clj | |
(:require [clj-time.format :as f]) | |
#+cljs | |
(:require [cljs-time.format :as f] | |
cljs.reader) | |
#+clj (:import [org.joda.time DateTime LocalDate])) | |
;; | |
;; #DateTime tagging |
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
#!/bin/sh | |
# Generate datomic transactor properties file and command line arguments. | |
# Specific scenario: using Google Mysql Cloud storage with SSL and client | |
# authentication. | |
OUTFILE='transactor.properties' | |
#TRANSACTOR_ARGS_FILE='transactor-arguments.txt' |
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
-- Optimized MYSQL schema for datomic | |
-- Unfortunately the bin/sql/mysql-*.sql bootstrapping files for datomic are not | |
-- very good, and can actually cause failures if not adjusted. | |
-- One symptom of this is the following error: | |
-- SQL Error (1071): Specified key was too long; max key length is 767 bytes. | |
-- Reported here: https://support.cognitect.com/entries/28462168-MySQL-Caveats | |
-- This is caused by the default collation for the `id` column possibly being |
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
import bisect | |
import itertools | |
import operator | |
class _BNode(object): | |
__slots__ = ["tree", "contents", "children"] | |
def __init__(self, tree, contents=None, children=None): | |
self.tree = tree |