Skip to content

Instantly share code, notes, and snippets.

# 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
@dry
dry / json.ex
Created February 4, 2013 22:04
A Jiffy (https://github.com/davisp/jiffy) wrapper for Elixir
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}]})
@dry
dry / sample output
Last active December 11, 2015 16:19 — forked from josevalim/sample output
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
@dry
dry / date_util.erl
Created December 20, 2012 21:15 — forked from zaphar/date_util.erl
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
@dry
dry / dispatcher.erl
Created December 2, 2012 14:11
Simple URL dispatcher for Mochiweb
-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]} ->
@dry
dry / gist:4017752
Created November 5, 2012 15:22 — forked from ckimrie/gist:3312619
Example extension that allows you to modify the final ExpressionEngine CP output
<?php
/**
* Modifying the final CP Output
*
* This extension demonstrates how you can access and modify the final ExpressionEngine
* CP output. It is not a hack, but it is a new technique that to my knowledge has not
* been used before in an EE addon.
*
* This has not been road tested and its side effects are unknown, so use this at your own risk.
@dry
dry / bash.sh
Created October 28, 2012 00:58 — forked from nstielau/bash.sh
Set node attributes, run_list, chef_environment, etc
knife node configure my_node.example.com
@dry
dry / gist:3438221
Created August 23, 2012 16:20
Rewrite Force HTTPS
RewriteCond %{HTTPS} off
RewriteCond $1 ^(section|othersection) [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond $1 ^(anothersection|anothersection|anothersection) [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@dry
dry / mixins.php
Created December 7, 2011 20:50
A possible way to simulate mixins in PHP
<?php
class Person {
private $mixins = array();
private $instances = array();
public function __construct()
{
if (func_num_args())
@dry
dry / gist:943413
Created April 26, 2011 23:36
Page Fields
layout:
documentation.html
--
title:
Page Custom Fields
--
summary:
h2. Page Custom Fields