Skip to content

Instantly share code, notes, and snippets.

View terjesb's full-sized avatar

Terje Sten Bjerkseth terjesb

  • Outnordic
  • Norway
View GitHub Profile
(def conn (start-datomic! (str "datomic:mem://" (java.util.UUID/randomUUID)) (schema)))
(def data
[{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Mike"}
{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Dorrene"}
{:db/id (d/tempid :com.mdrogalis/people)
:user/name "Benti"}
{:db/id (d/tempid :com.mdrogalis/people)
@terjesb
terjesb / accounts.clj
Last active August 29, 2015 14:17 — forked from pelle/accounts.clj
(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))

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

(ns favila.datomic-util.restore-datoms
"A \"manual\" datomic database restore.
Writes raw datoms (stored in a stream written by d/datoms) to an empty database.
Useful for memory databases: you can write out all the datoms in it, then read
them into another database. (Note mem dbs have no log or retractions)."
(:require [datomic.api :as d]
[clojure.edn :as edn]))
(defrecord datom [e a v tx added?])
(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}
@terjesb
terjesb / TacoProducer.scala
Created March 16, 2011 11:12
Using Akka AMQP to publish tasks to Octobot
import akka.amqp._
import akka.amqp.AMQP._
import akka.util.Logging
object TacoProducer extends Logging {
val connection = AMQP.newConnection()
val exchangeParameters = ExchangeParameters("tacotruck", Direct,
ActiveDeclaration(durable=true, autoDelete=false))
@terjesb
terjesb / 2html.html
Created November 3, 2011 18:11
nu.validator.htmlparser and comments in Lift HTML5 template
<!DOCTYPE html>
<!-- test --><!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--><!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--><!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--><!--[if IE 9]> <html class="no-js ie9" lang="en"> <![endif]--><!--[if gt IE 9]><!--><html class="no-js lift:H5BP.lang" lang="en"><!--<![endif]--><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<title class="lift:Menu.title">App: </title>
<script class="lift:Html5Shiv"></script>
<style class="lift:CSS.blueprint"></style>
<style class="lift:CSS.fancyType"></style>
<script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
@terjesb
terjesb / EC_Producer.php
Created March 6, 2012 18:35 — forked from shupp/EC_Producer.php
Kestrel Producer
<?php
/**
* Interface for adding jobs to a queue server
*
* @author Bill Shupp <hostmaster@shupp.org>
* @copyright 2010-2011 Empower Campaigns
*/
class EC_Producer
{
/**
@terjesb
terjesb / consumer_cli.php
Created March 6, 2012 18:35 — forked from shupp/consumer_cli.php
CLI harness for EC_Consumer
#!/bin/env php
<?php
// External application bootstrapping
require_once __DIR__ . '/cli_init.php';
// Instantiate and run the consumer
$consumer = new EC_Consumer($argv);
$consumer->run();
@terjesb
terjesb / gist:1988062
Created March 6, 2012 18:35 — forked from shupp/gist:960980
Example call to producer
<?php
$producer = new EC_Producer();
$producer->addJob('hello_world', 'HelloWorld', array('foo' => 'bar'));
?>