Skip to content

Instantly share code, notes, and snippets.

nathanmarz / gist:2506020
Created Apr 27, 2012
Concise inline operations with Cascalog serfn branch
View gist:2506020
(use 'cascalog.playground) (bootstrap)
(require '[clojure.set :as set])
(require '[cascalog.vars :as v])
(defn all-syms [form]
(if (coll? form)
(reduce (fn [curr elem] (set/union curr (all-syms elem)))
View pred.clj
^{:doc "Predicate macro aggregator that extracts a timeseries, given
`?chunk`, `?temporal-resolution` and `?date`. Currently only
functions when `?chunk` is an instance of `forma.schema.IntArray`."}
(<- [?temporal-res ?date ?chunk :> ?pix-idx ?t-start ?t-end ?tseries]
(datetime->period ?temporal-res ?date :> ?tperiod)
(:sort ?tperiod)
(timeseries ?tperiod ?chunk :> ?pix-idx ?t-start ?t-end ?tseries)))
View gist:1001206
~/$ lein new ring-on-heroku
Created new project in: /home/jim/Development/ring-on-heroku
~/$ cd ring-on-heroku
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj
(ns ring-on-heroku.core
(:use ring.util.response
(defn app [req]
bakkdoor / thrift-mode.el
Created Jan 8, 2011
Simple thrift mode (taken from and adjusted to highlight self-defined types, unions & namespaces nicely.
View thrift-mode.el
(require 'font-lock)
(defvar thrift-mode-hook nil)
(add-to-list 'auto-mode-alist '("\\.thrift\\'" . thrift-mode))
(defvar thrift-indent-level 2
"Defines 2 spaces for thrift indentation.")
;; syntax coloring
View type-level-tagging.clj
(ns type-level-tagger
{:doc "Implements State-of-the-art Unsupervised Part-of-speech Tagger
from \"Simple Type-Level Unsuperivsed POS Tagging\"
by Yoong-Keok Lee, Aria Haghighi and Regina Barzilay
blog post:"
:author "Aria Haghighi ("}
(:use [ :only [reader]]
[ :only [with-out-writer]]
[clojure.contrib.seq-utils :only [indexed]]
View riak_map_reduce_example.erl
handle_call({lookup_popular_replies, TweetId, AuthorId}, _From, #state{client=Client} = State) ->
% reduce fun to get valid tweet keys in tweet response bucket phase 3
Fun = make_local_fun("fun(O, _) ->
([LinkedTweet = <<Id:128>>, <<Val:128>>, <<\"reply\">>], Acc) ->
[{{<<\"tweet_responses_bucket\">>, LinkedTweet}, {Id, Val}} | Acc];
({{<<\"tweet_responses_bucket\">>, _}, _} = PreviousPass, Acc) ->
[PreviousPass | Acc];
(_, Acc) ->