!SLIDE
monads are simple
!SLIDE
a monad is a monoid in the category of endofunctors
### Download and install | |
cd /tmp | |
curl http://erlang.org/download/otp_src_R13B03.tar.gz | tar zx | |
cd otp_src_R13B | |
./configure --enable-hipe | |
make | |
sudo make install | |
sudo mkdir -p /Library/Erlang/lib | |
mkdir -p ~/Library/Erlang/lib |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
%% See LICENSE for licensing information. | |
-module(cowboy_debug). | |
-export([onrequest_hook/1]). | |
-export([onresponse_hook/4]). | |
onrequest_hook(Req) -> | |
Method = to_string(extract(cowboy_req:method(Req))), | |
Path = to_string(extract(cowboy_req:path(Req))), | |
Params = params_to_string(extract(cowboy_req:qs_vals(Req))), |
//return an array of objects according to key, value, or key and value matching | |
function getObjects(obj, key, val) { | |
var objects = []; | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) continue; | |
if (typeof obj[i] == 'object') { | |
objects = objects.concat(getObjects(obj[i], key, val)); | |
} else | |
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
if (i == key && obj[i] == val || i == key && val == '') { // |
VERSION=0.20.6 | |
sudo apt-get update | |
sudo apt-get install openjdk-6-jdk | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb | |
sudo dpkg -i elasticsearch-$VERSION.deb | |
# be sure you add "action.disable_delete_all_indices" : true to the config!! |
# install bzr and gource | |
# get a branch of Mir's trunk code | |
# create gource video | |
$ sudo apt-get install bzr gource | |
$ bzr branch lp:mir | |
$ cd mir | |
$ gource \ | |
-s .06 \ |
defmodule QuickSort do | |
def sort([]), do: [] | |
def sort([head|tail]) do | |
{lesser, greater} = Enum.partition(tail, &(&1 < head)) | |
sort(lesser) ++ [head] ++ sort(greater) | |
end | |
end | |
IO.inspect QuickSort.sort([1,6,3,4,2,5]) |
Eshell V5.9.1 (abort with ^G) | |
1> rr(parent). | |
[parent_type] | |
2> rr(child). | |
[child_type,parent_type] | |
3> | |
3> | |
3> {ok, P1} = child:start_link(none). | |
{ok,<0.42.0>} | |
4> |