Skip to content

Instantly share code, notes, and snippets.

(ns your.macros-for-cljs.ns
(:require [sablono.compiler :as sablono-c]))
;; Make sablono also walk into other forms:
;; if, for, let, do: Already exist
(.addMethod @(var sablono-c/compile-form) "when"
(fn
[[_ bindings & body]]
`(when ~bindings ~@(for [x body] (sablono-c/compile-html x)))))
@fogus
fogus / gist:3123867
Created July 16, 2012 17:21 — forked from stuarthalloway/gist:2645453
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")
anonymous
anonymous / collector.erl
Created June 9, 2012 13:47
-module(collector).
-behaviour(gen_server).
-export([start_link/1, do/2, ended/0]).
-export([handle_call/3, handle_cast/2]).
-export([init/1, terminate/2, handle_info/2, code_change/3]).
%% Client interface
anonymous
anonymous / gist:2899967
Created June 9, 2012 07:23
#include <stdio.h>
#include <unordered_map>
#include <iostream>
using namespace std;
#define N 1000000
load('./cljjs.js')
// USING EXISTING PARSER
clj.read_string("#queue [1 2 3]")
//=> #queue [1 2 3]
// REGISTERING NEW PARSER