This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(dispatcher). | |
-export([dispatch/2]). | |
dispatch(_, []) -> none; | |
dispatch(Req, [{Regexp, Handler}|T]) -> | |
"/" ++ Path = Req:get(path), | |
Method = Req:get(method), | |
Match = re:run(Path, Regexp, [global, {capture, all_but_first, list}]), | |
case Match of | |
{match, [MatchList]} -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(date_util). | |
-compile(export_all). | |
epoch() -> | |
now_to_seconds(now()) | |
. | |
epoch_hires() -> | |
now_to_seconds_hires(now()) | |
. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Chat.Client do | |
# In all of the following functions 'server' stands for the server's pid | |
def join({server, name}) do | |
send server, {name, :join, ""} | |
end | |
def say({server, name, message}) do | |
send server, {name, :say, message} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule JSON do | |
@moduledoc """ | |
This module is a wrapper for the Jiffy JSON library. | |
## Examples | |
JSON.encode({[{foo: bar, count: 1}]}) | |
JSON.encode({[{"foo": "bar", "count": 1}]}) | |
JSON.decode("\\"foo\\": \\"bar\\", \\"count\\": 1}]}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Vi Mode | |
setw -g mode-keys vi | |
# Reload Config | |
bind-key R source-file "$HOME/.tmux_conf"\; display-message "Configuration Reloaded" | |
# Option+Arrow | |
bind-key -n M-Left previous-window | |
bind-key -n M-Right next-window |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-key evil-normal-state-map ",f" (lambda () | |
(interactive) | |
(dired default-directory) | |
)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(Beam,[abstract_code]). | |
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... rest of module stuff | |
/** | |
* Set the 'cookies_allowed' cookie | |
* | |
* @access public | |
* @return string | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%%! -smp enable -sname update | |
main([Path]) -> | |
SPath = string:strip(Path, right, $/), | |
{ok, Dirs} = file:list_dir(SPath), | |
[files(SPath ++ "/" ++ Dir) || Dir <- Dirs]; | |
main(_) -> | |
io:format("Usage: update [path/to/directory]~n"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHOPIFY_CLIENT_ID "123456789" |