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 '[buddy.core.codecs.base64 :as base64] | |
'[cognitect.aws.util :as util] | |
'[clojure.string :as str] | |
'[jsonista.core :as json] | |
'[cognitect.aws.credentials :as creds] | |
'[cognitect.aws.http :as http]) | |
(import '[java.util Date]) | |
(defn host-style-bucket-uri [bucket] | |
(str "http://" bucket ".s3.amazonaws.com/")) |
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
;; This previously was CLJX but has now been updated to use cljc. Thanks @caskolkm | |
;; https://gist.github.com/caskolkm/39d823f5bac7051d3062 | |
(ns app.logging | |
(:refer-clojure :exclude [time]) | |
(:require #?(:clj [clojure.tools.logging :as log] | |
:cljs [goog.log :as glog])) | |
#?(:cljs (:import goog.debug.Console))) | |
#?(:cljs |
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
commit 8e51c34ca4d97e48750850d5ba09956f89783b4e | |
Author: Kyle Kingsbury <aphyr@aphyr.com> | |
Date: Wed May 7 19:06:15 2014 -0700 | |
Improve Keyword.intern performance | |
Keyword interning is an expensive factor in many Clojure | |
serialization/deserialization paths, especially where the same set of | |
keywords are created and freed repeatedly; e.g. iterating over records | |
with similar structure. There are two principle costs to keyword |
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 net.cgrand.decay | |
"Exponentially decaying lists. See http://awelonblue.wordpress.com/2013/01/24/exponential-decay-of-history-improved/ | |
for background and http://clj-me.cgrand.net/2013/02/12/decaying-lists-log-scale-for-lists/ for documentation") | |
;; PRNG, formulas straight from java.util.Random javadoc | |
(defn- seed ^long [^long n] | |
(bit-and (unchecked-multiply n 0x5DEECE66D) | |
(unchecked-dec (bit-shift-left 1 48)))) | |
(defn- next-seed ^long [^long seed] |
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
(use '[datomic.api :only [db q] :as d]) | |
(def schema | |
[{:db/doc "A persons name" | |
:db/id #db/id[:db.part/db] | |
:db/ident :name | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db.install/_attribute :db.part/db} | |
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
;; Datomic example code | |
;; demonstrates various update scenarios, using a news database | |
;; that contains stories, users, and upvotes | |
;; grab an in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://foo") | |
(d/create-database uri) | |
(def conn (d/connect uri)) |
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
(use '[datomic.api :only [q db] :as d]) | |
(def uri "datomic:mem://accounts") | |
;; create database | |
(d/create-database uri) | |
;; connect to database | |
(def conn (d/connect uri)) |
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
;; Datomic example code | |
;; | |
;; The extent of entity ?x is all datoms that are about ?x. | |
;; Drop this into your rules. | |
;; | |
;; Demonstrates | |
;; | |
;; 1. recursive query (extent calls itself) | |
;; 2. disjunction (different extent bodies are ORed) | |
;; 3. component attributes (e.g. your arm is a component, your brother isn't) |
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
(defn vec->tree [calls] | |
(-> (reduce (fn [tree [op was-ret?]] | |
(if was-ret? | |
(-> tree | |
(z/append-child op) | |
(z/up)) | |
(-> tree | |
(z/append-child [op]) | |
(z/down) | |
(z/rightmost)))) |
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
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
NewerOlder