Skip to content

Instantly share code, notes, and snippets.

View juanghurtado's full-sized avatar
🙄

Juan G. Hurtado juanghurtado

🙄
View GitHub Profile
@juanghurtado
juanghurtado / migration.rb
Created June 13, 2011 07:42
Sample migration with data update
class CreateUserProfiles < ActiveRecord::Migration
def self.up
create_table :user_profiles do |t|
t.string :locale, :default => :es
t.string :glucose_test_unit, :default => :mgdl
t.string :location
t.references :user
t.timestamps
@juanghurtado
juanghurtado / snipmatize.py
Created July 4, 2011 11:46 — forked from claytron/snipmatize.py
Convert TexMate snippets into snipMate compatible snippets
#!/usr/bin/env python2.6
"""
About
=====
Convert Texmate snippets into snipmate compatible snippets
http://www.vim.org/scripts/script.php?script_id=2540
http://macromates.com/
@juanghurtado
juanghurtado / gist:1195430
Created September 5, 2011 16:42
Rails 3.1 error on tests
Failure/Error: @user_profile = @user.create_user_profile(@attr)
ActiveRecord::RecordNotSaved:
Failed to remove the existing associated user_profile. The record failed to save when after its foreign key was set to nil.
@juanghurtado
juanghurtado / gist:1393001
Created November 25, 2011 07:37
One liner for starting a Webrick server at `pwd` from terminal
ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start'
@juanghurtado
juanghurtado / gist:1402145
Created November 28, 2011 21:24
Turn on iTunes notifications on dock icon
defaults write com.apple.dock itunes-notifications -bool TRUE
defaults write com.apple.dock notification-always-show-image -bool TRUE
killall Dock
@juanghurtado
juanghurtado / Rakefile
Created January 20, 2012 13:33
Rake tasks to compress CSS/JS through YUI Compressor
require 'nanoc3/tasks'
desc 'Compress CSS files in output/style directory using YUI Compressor'
task :css do
puts `find output/css -name '*.css' -exec java -jar ./lib/yuicompressor-2.4.2.jar --type css '{}' -o '{}' \\;`
end
desc 'Compress JavaScript files in output/script directory using YUI Compressor'
task :js do
puts `find output/js -name '*.js' -exec java -jar ./lib/yuicompressor-2.4.2.jar --type js '{}' -o '{}' \\;`
@juanghurtado
juanghurtado / gist:1709566
Created January 31, 2012 09:05
zshrc for ZSHuery
# Vars
local DOTFILES="$HOME/Dropbox/shell/dotfiles"
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:"
export EDITOR='vim'
# Load aliases files, ZSHuery and VCS info
for config_file ($DOTFILES/**/aliases.zsh) source $config_file
source $DOTFILES/zsh/zshuery/zshuery.sh
source $DOTFILES/zsh/vcsinfo.sh
@juanghurtado
juanghurtado / gist:1710537
Created January 31, 2012 13:39
jQuery namespaced events binding and unbinding
jQuery(function() {
jQuery('a').bind('click.custom_namespace', function() {
alert("Oh my god, I'm gonna be unbinded later!");
});
jQuery('a').bind('click', function() {
alert("I'm Chuck Norris, and I approve this bind.");
});
jQuery('a').unbind('click.custom_namespace');
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0"
id="com.viavansi"
version="0.2">
<!-- Info -->
<name>PhoneGap Sample</name>
<description>
PhoneGap API Sample
@juanghurtado
juanghurtado / gist:1875830
Created February 21, 2012 10:57
Ignore files at TODO TextMate bundle
Add a shell variable called `TM_TODO_IGNORE`, with a regEx value like: `jquery.mobile.1.0.js|phonegap.js|jquery-1.6.4.js|jquery.mobile.js`