Skip to content

Instantly share code, notes, and snippets.

@legoscia
legoscia / slugs.erl
Last active August 29, 2015 14:03 — forked from devinus/gist:450612
A Transliterating Erlang URL Slugifier (supports Unicode / UTF-8 input)
-module(slugs).
-export([slugify/1]).
-define(tolower(C), (C+32)).
-define(islower(C), (C >= $a andalso C =< $z)).
-define(isupper(C), (C >= $A andalso C =< $Z)).
-define(isdigit(C), (C >= $1 andalso C =< $9)).
-define(isspace(C), (
C =:= $\s orelse C =:= $\n orelse C =:= $\t orelse C =:= $\r
#!/usr/bin/env escript
-mode(compile).
epoch() ->
{Mega,Sec,Mili} = os:timestamp(),
(Mega * 1000000) + Sec + (Mili / 1000000).
measure(F) ->
Ini = epoch(),
@legoscia
legoscia / efind.sh
Created December 12, 2012 14:54 — forked from robertoaloi/efind.sh
#!/bin/sh
ROOTDIR=`which erl | sed -ne '/^ROOTDIR=/s///p'`
find $ROOTDIR -name $1.erl | awk -F / '{print $(NF-2)}'