Skip to content

Instantly share code, notes, and snippets.

View trodrigues's full-sized avatar
😸
:3

Tiago Rodrigues trodrigues

😸
:3
View GitHub Profile
# The following snippet checks your about to be committed js files with jslint and asks you what do to.
#
# You'll need either CocoaDialog (you can get it with macports) or plain old curses dialog installed.
# Using the shell's read wouldn't cut it because you have no stdin when running git hooks.
# Zenity would also be an option but I haven't considered it.
# You can get instructions for installing Rhino here http://www.nakedjavascript.com/installing-rhino
# You can get a jslint Rhino ready version here: http://www.jslint.com/rhino/index.html
# Paths are configured for my machine, so tweak them at your own taste.
# Tested on Linux and Mac OS X
/* Use this to cause a function to fire no more than once every 'ms' milliseconds.
For example, an expensive mousemove handler:
$('body').mouseover(ratelimit(function(ev) {
// ...
}, 250));
*/
function ratelimit(fn, ms) {
var last = (new Date()).getTime();
@trodrigues
trodrigues / html5.vim
Created August 10, 2010 12:43 — forked from gf3/html5.vim
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <[email protected]>
" URL: http://rm.blog.br/vim/syntax/html.vim
" Last Change: 2009 Aug 19
" License: Public domain
" (but let me know if you liked it :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file
{
"cars": [
{"make": "Honda", "model": "Accord"},
{"make": "Ford", "model": "Taurus"},
]
}
# showing git branch
export __CURRENT_GIT_BRANCH=
export __CURRENT_GIT_VARS_INVALID=1
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
zsh_git_invalidate_vars() {
@trodrigues
trodrigues / gist:1023167
Created June 13, 2011 16:51
Checkout only certain branches with git-svn
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do.
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk:
git svn clone -T trunk http://example.com/PROJECT
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T:
git svn clone -T branches/somefeature http://example.com/PROJECT
@trodrigues
trodrigues / vim.rb
Created November 14, 2011 14:04 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.294'
def features; %w(tiny small normal big huge) end
npm ERR! Error: No compatible version found: glob@'>=2.1.0- <2.2.0-'
npm ERR! Valid install targets:
npm ERR! ["1.1.0","2.0.9","2.0.8","2.0.7"]
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:424:10)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:406:17
npm ERR! at saved (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR! at cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
@trodrigues
trodrigues / bad jQuery practicies
Created January 20, 2012 14:38
Where does the before() content go?
$('.outer_class').addClass('status').find('.inner_class').html('some text goes here').before('some really really REALLY long piece of text and html');