Skip to content

Instantly share code, notes, and snippets.

View rboyd's full-sized avatar

Robert Boyd rboyd

  • Anarchist
  • Bentonville, AR
View GitHub Profile
@rboyd
rboyd / accounts.clj
Created September 14, 2012 04:57 — forked from pelle/accounts.clj
Using database functions in Datomic transactions and annotating transaction history
(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))
@rboyd
rboyd / memo-dyn.txt
Created September 14, 2012 04:34 — forked from fogus/memo-dyn.txt
Memoization vs dynamic programming
Memoization is fundamentally a top-down computation and dynamic
programming is fundamentally bottom-up. In memoization, we observe
that a computational *tree* can actually be represented as a
computational *DAG* (the single most underrated data structure in
computer science); we then use a black-box to turn the tree into a
DAG. But it allows the top-down description of the problem to remain
unchanged.
In dynamic programming, we make the same observation, but construct
the DAG from the bottom-up. That means we have to rewrite the
@rboyd
rboyd / upsert-auto.clj
Created September 14, 2012 04:28 — forked from clifford/upsert-auto.clj
Upserting in Datomic
(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}])
@rboyd
rboyd / MailchimpDeliveryMethod
Created June 22, 2011 15:01 — forked from ippy04/MailchimpDeliveryMethod
Delivery Method for Mailchimp STS and Amazon SES using Uakari
class MailchimpDeliveryMethod
attr_accessor :settings
def initialize(values = {})
self.settings = {:track_opens => true,
:track_clicks => true
}.merge!(values)
end
def deliver!(mail)
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.