Skip to content

Instantly share code, notes, and snippets.

View rpip's full-sized avatar

Yao rpip

View GitHub Profile
%% @doc
%% Filter module for Zotonic
%% 'foldl' filter, applies foldl to a list
%%
%% Usage:
%% {{ [1,2,3]|foldl:["*", 1] }}
%% {{ [1,2,3]|foldl:["+", 0] }}
%% {{ ["a", "b", "c"]|foldl:["++", ""] }}
%%
%% Pass an attribute to fetch for each item:
@andytill
andytill / bench.erl
Last active August 29, 2015 13:56 — forked from 0xYUANTI/bench.erl
-module(bench).
-compile(export_all).
%% Luke Gorrie's favourite profiling macro.
-define(TIME(Tag, Expr),
(fun() ->
%% NOTE: timer:tc/4 does an annoying 'catch' so we
%% need to wrap the result in 'ok' to be able to
%% detect an unhandled exception.
{__TIME, __RESULT} =
@cabo
cabo / elixir-charming.el
Created July 13, 2014 13:25
Emacs lisp snippet to turn Elixir into a charming language (during editing only)
(defconst elixir--cabo-prettify-symbols-alist
'(
("->" . ?➙) ; → ➜➽➤
("::" . ?∷)
("<-" . ?⬅) ; ←
("<<" . ?⟪ ) ; «≪
("=>" . ?⇒)
(">>" . ?⟫ ) ; »≫
("do" . ?⫷)
@matthieubulte
matthieubulte / p-a-t.md
Last active October 4, 2015 21:22
Propositions as Types

List of papers (with links to the PDF versions) mentioned in Philip Wadler's presentation on Propositions as Types at StrangeLoop 2015 (https://www.youtube.com/watch?v=IOiZatlZtGU)

ECON100: Intro to Micro August 27th, 2014

Professor Steven 'Zurigbo Onyeiwu Office Hours: M 1-3 pm, WF 9-11 AM, and by appointment Office: Quigley 206 Email: sonyeiwu@allegheny.edu Phone: 332-3338

@hawkw
hawkw / CMPSC380 Day 1.md
Last active April 19, 2016 14:26
CMPSC380 Notes

CMPSC380: DATABASES August 26th, 2014

Data Management

  • How much data is there in the world today?
    • infinite amounts of data in an infinite universe
    • ~1 yottabyte stored by people
  • How much data is produced every day?
@kachayev
kachayev / channels.erl
Last active December 15, 2017 19:36
Process communication programming
-module(channels).
-compile(export_all).
make() ->
Ref = make_ref(),
Pid = spawn(?MODULE, channel, [Ref]),
{channel, Pid, Ref}.
channel(Ref) ->
receive
@hawkw
hawkw / CMPSC420 Day 1.md
Last active April 17, 2018 08:51
CMPSC420 Notes

CMPSC420: Introduction to Compiler Design August 27th, 2014

Professor Jumadinova Email: jjumadinova@allegheny.edu Office: Alden 105 Office hours: Monday 10-12am and 4:30pm-5:30pm Wednesday 10-12am and 2:30-3:30pm

anonymous
anonymous / gen_event_caster.erl
Created January 7, 2013 12:59
-module(gen_event_caster).
-author('Fernando Benavides <elbrujohalcon@inaka.net>').
-behaviour(gen_event).
-export([start/2]).
-export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]).
-type receiver() :: atom() | pid().
@bryanhunter
bryanhunter / build-erlang-r16b.sh
Created April 30, 2013 09:26
Build Erlang R16B on Ubuntu
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://raw.github.com/gist/5487621/build-erlang-r16b.sh
# chmod u+x build-erlang-r16b.sh
# sudo ./build-erlang-r16b.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi