Skip to content

Instantly share code, notes, and snippets.

%%% Copyright (C) 2008 Willem de Jong
%%%
%%% This is json_parser.
%%%
%%% json_parser is free software: you can redistribute it and/or modify
%%% it under the terms of the GNU Lesser General Public License as
%%% published by the Free Software Foundation, either version 3 of
%%% the License, or (at your option) any later version.
%%%
%%% json_parser is distributed in the hope that it will be useful,
@ngerakines
ngerakines / memoize.erl
Created September 27, 2008 17:55
A small module to provide memoize functions in Erlang.
%% Copyright (c) 2008 Nick Gerakines <[email protected]>
%%
%% Permission is hereby granted, free of charge, to any person
%% obtaining a copy of this software and associated documentation
%% files (the "Software"), to deal in the Software without
%% restriction, including without limitation the rights to use,
%% copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the
%% Software is furnished to do so, subject to the following
%% conditions:
Summary: A native Erlang MySQL client library.
Name: erlang_mysql
Version: 1
Release: 1
Requires: erlang
Source0: http://ngerakines.github.com/erlang_mysql/sources/mysql-1.tgz
License: private
Group: dev-erlang
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
@rustyio
rustyio / gproc_tests.erl
Created September 16, 2009 13:16
gproc_tests.erl
-module(gproc_tests).
-compile(export_all).
-include_lib("stdlib/include/qlc.hrl").
go() -> make:all([load]).
register_stuff() ->
gproc:reg({n, l, key1}, value1),
gproc:reg({n, l, key2}, value2),
gproc:reg({n, l, key3}, value3),
%% Analysis results:
{ analysis_options,
[{callers, false},
{sort, acc},
{totals, true},
{details, false}]}.
% CNT ACC OWN
[{ totals, 3626, 50.613, 19.008}]. %%%
-module(friendfeed).
-export([start/0]).
-import(mochijson2).
start() ->
inets:start(),
build(1000),
inets:stop().
build(0) -> ok;
-module(stopwatch_client).
-export([start_timer/0, stop_timer/0, read_timer/0]).
start_timer() ->
stopwatch_server ! {self(), start_timer}.
stop_timer() ->
stopwatch_server ! {self(), stop_timer}.
-module(stopwatch).
-behaviour(gen_server).
%% Server API
-export([start_link/0, stop/0]).
%% Client API
-export([start_timer/0, stop_timer/0, read_timer/0]).
%% gen_server callbacks
<?php
/*
How to use:
Get this british words dictionary from here: http://www.curlewcommunications.co.uk/wordlist.html
IN PHP install the mypeb extension from source:
http://code.google.com/p/mypeb/
fun({Doc}) ->
case {proplists:get_value(<<"name">>, Doc), proplists:get_value(<<"value">>, Doc)} of
{undefined, _} ->
ok;
{_, undefined} ->
ok;
{Name, Value} ->
Emit(Name, {Doc});
_ ->
ok