Skip to content

Instantly share code, notes, and snippets.

{ok, RawCDs} = core_cds:find_all(),
FilteredCDs = lists:filter(fun(CD) ->
Now = date(),
case ecdm_cd:maturity_date(CD) of
undefined ->
true;
Value when Value < Now ->
true;
_ ->
@ericbmerritt
ericbmerritt / gist:1019166
Created June 10, 2011 16:08
highlight extent
;;;###autoload
(defun ispell-hl-minor-mode (&optional arg)
"Toggle Ispell Highlight mode.
With prefix ARG, turn Ispell Highlight mode on if arg is positive.
In Ispell Highlight mode, changing the buffer contens will spell
the words around the cursor and highlight miss-spelled ones!"
(interactive "P")
(setq ispell-hl-minor-mode
(not (or (and (null arg) ispell-hl-minor-mode)
?FORALL({FunName, ArgName, Op}, {ident(), ident(), op()},
begin
Expr = lists:flatten(
io_lib:format("(defn ~s [~s] (~s (mod ~s) 0))",
[FunName, ArgName, Op, ArgName])),
Tokens = jxa_lex:lex(Expr),
[] == Tokens
end).
keyword_style_ident() ->
":" ++ string().
defvar_style_ident() ->
"*" ++ string() ++ "*".
split_ident() ->
string() ++ "-" ++ string().
normal_ident() ->
-module(jxat_lexer_proper).
-include_lib("proper/include/proper.hrl").
to_string({ident, _, Ident}) ->
Ident;
to_string({char, _, Char}) ->
[$\\, Char];
to_string({syntax_quote, 0, "`"}) ->
"`";
@ericbmerritt
ericbmerritt / gist:1556075
Created January 3, 2012 17:53
Example spec syntax for joxa
(module jxat-spec test)
(deftype+ foo (bar baz) {bar baz})
(deftype boo () :ok)
(deftype+ hoo (a) a)
(defspec internal-test () (foo :this :is))
(defn internal-test ()
{:this :is :a :test})
This technology allows you to implement distributed systems using
proven algorithms in well tested implementations (riak and
riak_core). If you don't grok distributed systems, rely on folks
that do.
Eric B. Merritt
Afiniate, CTO
@ericbmerritt
ericbmerritt / gist:2006851
Created March 9, 2012 14:55
elisp for opening emacs in emacs
;;;
;;; Eshell stuff
;;;
(when (fboundp 'eshell)
;; This and rmb are my two vices. rmb is defined as an eshell alias.
(defalias 'eshell/lo #'eshell/exit)
(defalias 'eshell/logout #'save-buffers-kill-emacs)
;; I'm obsessive/compulsive with clear.
@ericbmerritt
ericbmerritt / gist:2012064
Created March 10, 2012 16:56
Seresye Optimization
No Optimization
Rules fired: 8723
Time = 120.195321 sec, 72.57354052908599 rules/sec, rule execution time 13.779126561962627 msec
With 'optimizanion'
Rules fired: 8723
Time = 156.990103 sec, 55.56401221037481 rules/sec, rule execution time 17.997260460850626 msec
optimization slowed things down significantly.
@ericbmerritt
ericbmerritt / gist:2045326
Created March 15, 2012 17:07
very simple fnv hash test
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers;
with Interfaces.C;
with Ada.Unchecked_Conversion;
procedure Hello is
function Amem_Hash(K1 : Interfaces.C.Unsigned_Long;
K2 : Interfaces.C.Unsigned_Long;
K3 : Interfaces.C.Unsigned_Long)
return Ada.Containers.Hash_Type is