Skip to content

Instantly share code, notes, and snippets.

@nivekuil
nivekuil / scylla.clj
Last active March 16, 2021 23:37
crux scylla/cassandra doc store
(ns app.crux.scylla
(:require [crux.codec :as codec]
[crux.db]
[crux.document-store :as ds]
[crux.io :refer [with-nippy-thaw-all]]
[crux.system :as sys]
[crux.memory]
[taoensso.nippy :as nippy]
[taoensso.timbre :as log]
[qbits.alia :as alia]
@nivekuil
nivekuil / crux
Created September 30, 2020 08:19
(put {:crux.db/id {[:user/id 1] :login-details} :user/id 1 :user/name "foo" :user/password "bar"})
(put {:crux.db/id {[:user/id 1] :favorites} :user/id 1 :user/favorite-food "pie" :user/favorite-animal "cow"})
(defn attr [ident attr]
(dissoc (crux/entity (db) {ident attr}) :crux.db/id))
(defn entity [ident]
(let [[table id] ident]
(dissoc
#[proc_macro_attribute]
pub fn instrument_err(args: TokenStream, item: TokenStream) -> TokenStream {
let input: ItemFn = syn::parse_macro_input!(item as ItemFn);
let args = syn::parse_macro_input!(args as AttributeArgs);
// these are needed ahead of time, as ItemFn contains the function body _and_
// isn't representable inside a quote!/quote_spanned! macro
// (Syn's ToTokens isn't implemented for ItemFn)
let ItemFn {
attrs,
(defun insert-parentheses-backward ()
"Insert parentheses around the sexp near point.
Move parentheses backward by sexp if used repeatedly."
(interactive)
(cond ((string-match-p "\\\w" (char-to-string (char-after)))
(forward-char) (insert-parentheses-backward))
((equal (char-before) 41)
(backward-sexp) (insert-parentheses-backward))
((equal (char-after) 40)
(if (equal (char-before) 40)