Skip to content

Instantly share code, notes, and snippets.

View braden's full-sized avatar

Braden Evans braden

View GitHub Profile
sudo aptitude install build-essential
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$fg[green]%}%2~ \
$(git_prompt_info)\
%{$fg[red]%}%(!.#.$)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1=""
#'%{$fg[blue]%}%~%{$reset_color%} ${return_code} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[yellow]%}("
# Shell options
setopt autocd # automatically cd to a directory if not cmd
setopt autopushd # automatically pushd directories on dirstack
setopt nopushdsilent # print dirstack after each cd/pushd
setopt pushdignoredups # don't push dups on stack
setopt correct # try to correct spelling...
formatDateTime: function(dateTime) {
var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var hour = dateTime.getHours();
var postfix;
if (hour < 12) {
postfix = "AM";
} else {
postfix = "PM";
@braden
braden / gist:6117331
Created July 30, 2013 21:50
Mongo property binder
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Quotations.Patterns
open Microsoft.FSharp.Quotations.DerivedPatterns
let prop (expr:Quotations.Expr) =
match expr with
| Lambda(_, PropertyGet(_, prop, _)) ->
match prop.GetCustomAttributes(typeof<BsonElementAttribute>, true) with
| [| attr |] -> (attr :?> BsonElementAttribute).ElementName
| _ -> prop.Name
@braden
braden / gist:8b75e39b625586c779a1
Created April 4, 2015 17:02
Array.empty benchmark
#time
(*
Without optimization
Real: 00:00:00.765, CPU: 00:00:00.765, GC gen0: 763, gen1: 1, gen2: 0
Real: 00:00:00.781, CPU: 00:00:00.765, GC gen0: 763, gen1: 0, gen2: 0
Real: 00:00:00.767, CPU: 00:00:00.765, GC gen0: 762, gen1: 0, gen2: 0
With optimization