Skip to content

Instantly share code, notes, and snippets.

View danlentz's full-sized avatar

Dan Lentz danlentz

View GitHub Profile
@stuarthalloway
stuarthalloway / gist:2002582
Created March 8, 2012 18:39
Datomic extent query
;; 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)
@stuarthalloway
stuarthalloway / gist:2158138
Created March 22, 2012 12:54
Many to Many Datomic example
;; Datomic example code
;; make in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://matches")
(d/create-database uri)
(def conn (d/connect uri))
;; add the match attribute
(d/transact
@stuarthalloway
stuarthalloway / gist:2645453
Created May 9, 2012 15:22
Datomic queries against Clojure collections
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
@sshirokov
sshirokov / fsm.lisp
Created May 14, 2012 23:51
CLOS FSM with MOP Sauce (requires :closer-mop)
(defpackage :fsm
(:use :cl)
(:export :standard-state-machine
:standard-state-machine-event
:state
:defstate
:deffsm))
(in-package :fsm)
;; Basic copy-pasta protection
@sshirokov
sshirokov / hi-fsm.lisp
Created May 15, 2012 05:28
hi-fsm, example code for CLOS FSM with MOP Flavor
(fsm:deffsm hi-fsm ()
())
(fsm:defstate hi-fsm :initial (fsm c)
(case c
(#\! :error)
(#\H :want-i)))
(fsm:defstate hi-fsm :want-i (fsm c)
(if (char-equal c #\i)
@jedschneider
jedschneider / gh-pages-tips.md
Created June 7, 2012 17:59
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 17, 2025 02:24
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@noahlz
noahlz / datomic-first-steps.clj
Created July 17, 2012 21:24
First steps with Datomic
;; adopted from http://www.datomic.com/company/resources/getting-started
;; Clojure 1.4.0
;; user=>
(use '[datomic.api :only [q db] :as d])
;;=> nil
;; user=>
(doc d/q)
;; -------------------------
@sile
sile / actor.lisp
Created August 4, 2012 01:23
actor
(in-package :actor)
(defparameter *current-process* (make-process :background nil))
(define-symbol-macro self *current-process*)
;; fork
(defun fork-impl (fn)
(let ((proc (make-process)))
(execute-fork-fn fn proc) ; forkしたプロセスを実行する
proc))
@jaeschliman
jaeschliman / overview.lisp
Created September 7, 2012 17:59
overview of the protocol, sequence, iterator, and iterate+ packages.
#|
UPDATE: this file no longer works with the changes
pushed to github today (2012-09-17) will fix it
soon.
A working overview of the protocol, sequence,
iterator, and iterate+ packages.
These packages are each quite small and are