Skip to content

Instantly share code, notes, and snippets.

View thisivan's full-sized avatar

Ivan Torres thisivan

View GitHub Profile
@thisivan
thisivan / .zshrc
Created February 11, 2011 22:07
Enable Vim mode in ZSH
# Enable Vim mode in ZSH
bindkey -v
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^E' edit-command-line # Opens Vim to edit current command line
bindkey '^R' history-incremental-search-backward # Perform backward search in command line history
bindkey '^S' history-incremental-search-forward # Perform forward search in command line history
bindkey '^P' history-search-backward # Go back/search in history (autocomplete)
bindkey '^N' history-search-forward # Go forward/search in history (autocomplete)
@thisivan
thisivan / gist:823572
Created February 12, 2011 07:05
Concentrate (http://getconcentrating.com) Pomodoro AppleScripts
(* Setup this script to run when a "Pomodoro" activity has finished. It will start either "Pomodoro Break" or "Pomodoro Long Break" when finished *)
set activity1 to "Pomodoro Break"
set activity2 to "Pomodoro Long Break"
set button3 to "Stop Working"
set dialogText to "What do you want to do now?"
set dialogTitle to "Choose your next step..."
@thisivan
thisivan / git_remote_branches.sh
Created April 28, 2009 02:41
Git: Track Remote Branches
# Create new remote branch
git push origin origin:refs/heads/new_branch_name
# Make sure everything is updated
git fetch origin
# Check your branch has been created
git branch -r
# Track a remote branch
@thisivan
thisivan / gist:1395629
Created November 26, 2011 12:58
Git-rm: Delete already deleted files
git status | grep deleted | cut -f2 | sed -e 's/deleted:\s*//g' | xargs git rm -f
@thisivan
thisivan / gist:1314957
Created October 26, 2011 00:31
Change Vim file alias
#!/usr/bin/env sh
DEFAULT_VIM_PATH='/workspace/tools/vim'
if [[ ! -z $1 ]]; then
DEFAULT_VIM_PATH=$1
fi
rm ~/.vimrc
rm ~/.vim
startup_message off
defscrollback 5000
defutf8 on
hardstatus alwayslastline
hardstatus string '%{= kG}[%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
@thisivan
thisivan / paginated_collection.js
Created October 17, 2011 11:50 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
vmap <Leader>! :call ExecuteVLines()<CR>
function! NumSort(a, b)
return a:a>a:b ? 1 : a:a==a:b ? 0 : -1
endfunction
function! ExecuteVLines()
let [firstline, lastline]=sort([line('v'), line('.')], 'NumSort')
let lines = getline(firstline, lastline)
exec ":!".join(lines, " && ")
@thisivan
thisivan / gist:1284745
Created October 13, 2011 16:41
String Concatenation
# Ruby String Concatenation Benchmarks
require 'benchmark'
n = 100000
a = "a"
b = "b"
c = "c"
@thisivan
thisivan / gist:1208606
Created September 10, 2011 18:23
Install Ubuntu 11.04 server
# Update to the latest version
sudo apt-get update && sudo apt-get upgrade && sudo shutdown -r now
# Install SSH server
sudo apt-get install openssh-server
# Install basic tools
sudo apt-get install build-essential vim-nox curl git-core subversion
# Install RVM (as root, system wide)