Skip to content

Instantly share code, notes, and snippets.

View mafredri's full-sized avatar

Mathias Fredriksson mafredri

View GitHub Profile
@mafredri
mafredri / zsh-git.rb.patch
Created August 10, 2015 22:27
Install zsh HEAD from git through Homebrew
diff --git a/Library/Formula/zsh.rb b/Library/Formula/zsh.rb
index e7e67a5..4dff75e 100644
--- a/Library/Formula/zsh.rb
+++ b/Library/Formula/zsh.rb
@@ -5,8 +5,11 @@ class Zsh < Formula
mirror "http://www.zsh.org/pub/zsh-5.0.8.tar.bz2"
sha256 "8079cf08cb8beff22f84b56bd72bb6e6962ff4718d816f3d83a633b4c9e17d23"
+ head "https://github.com/zsh-users/zsh.git"
+
@mafredri
mafredri / pure_benchmark.zsh
Created July 22, 2015 21:14
Benchmarking modifications to prompt pure
#!/usr/bin/env zsh
BRANCH=$1
BRANCHES=(master pure-nitro pure-nitro2)
BENCHDIR=benchmark
ROUNDS=100
if [[ ! -n $BRANCH ]]; then
[[ ! -d $BENCHDIR ]] && mkdir $BENCHDIR
for i in $BRANCHES; do
@mafredri
mafredri / var_subshell_perf.zsh
Last active August 29, 2015 14:25
ZSH Performance: variable vs captured subshell output
#!/usr/bin/env zsh
test1() {
test_var=$1
}
test2() {
print -n $1
}
@mafredri
mafredri / subl.sh
Last active August 29, 2015 14:22
Extended subl for SublimeText to open *.sublime-project files if available.
# Detect and open sublime-project files in the provided path, if no parameters
# are provided, open the $PWD. If the parameter is not a directory, call subl
# normally.
_subl() {
local params="$*"
local project
if test -z "$params"; then
params=.
fi