Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active May 10, 2024 05:14
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
<html>
<head>
</head>
<body>
</body>
</html>
@vaughnd
vaughnd / gist:3705861
Created September 12, 2012 10:40
Datomic user -> group memberships with extra data using many-to-many
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://user-groups3")
(d/create-database uri)
(def conn (d/connect uri))
(d/transact
conn
[{:db.install/_attribute :db.part/db
:db/id #db/id[:db.part/db]
:db/ident :user/name
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@stuartsierra
stuartsierra / errors.clj
Created April 20, 2012 14:27
Example error messages from common mistakes with Datomic
;; Some example error messages resulting from common mistakes
;; using Datomic 0.8.4138
(ns errors
(:use [datomic.api :as d :only (db q)]))
(def uri "datomic:mem://database")
(d/create-database uri)
@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