- @fergbyrne
- HTM = Hierarchical Temporal Memory
- Slides
- big data is like teenage sex
- noone knows how to do it
- everyone thinks everyone else is doing it
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
(ns n01se.externs-for-cljs | |
(:require [clojure.java.io :as io] | |
[cljs.compiler :as comp] | |
[cljs.analyzer :as ana])) | |
(defn read-file [file] | |
(let [eof (Object.)] | |
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))] | |
(vec (take-while #(not= % eof) | |
(repeatedly #(read stream false eof))))))) |
;;; show-your-colours --- an HTTP server showing the current buffer fontified | |
;; Author: Wilfred Hughes <[email protected]> | |
;; Version: 0.1 | |
;; Package-Requires: ((s "1.3.0")) | |
;;; Commentary: | |
;; Allow others to see what you're editing in Emacs. For live | |
;; screencasts, or general Emacs advocacy. If you have multiple |
Check out README.md to get started editing Clojure with Emacs. |
(defmacro test-> | |
"Takes an expression and a set of test/form pairs. Threads expr (via ->) | |
through each form for which the corresponding test expression (not threaded) is true." | |
[expr | |
& clauses] | |
(assert (even? (count clauses))) | |
(let [g (gensym) | |
pstep (fn [[test step]] `(if ~test (-> ~g ~step) ~g))] | |
`(let [~g ~expr | |
~@(interleave (repeat g) (map pstep (partition 2 clauses)))] |
(use '[datomic.api :only (q db) :as d]) | |
(def initial-data | |
[{:sku "1" :price 0.95M :qty 1} | |
{:sku "2" :price 1.99M :qty 0} | |
{:sku "3" :price 1.99M :qty 0} | |
{:sku "4" :price 5.99M :qty 3} | |
{:sku "5" :price 9.99M :qty 2} | |
{:sku "6" :price 2.99M :qty 3} | |
{:sku "7" :price 2.99M :qty 2}]) |
(ns datomic-helpers | |
(:require [datomic.api :as d])) | |
;;; Expose Datomic vars here, for convenience | |
;;; Ring middleware | |
(defn wrap-datomic | |
"A Ring middleware that provides a request-consistent database connection and | |
value for the life of a request." |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs