Skip to content

Instantly share code, notes, and snippets.

View juanghurtado's full-sized avatar

Juan G. Hurtado juanghurtado

View GitHub Profile
@callumlocke
callumlocke / .zshrc
Last active June 24, 2024 10:59
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@mxriverlynn
mxriverlynn / defaults.js
Created August 22, 2012 02:11
defaults
// backbone's `defaults` can be a function.
//
// if you need the default value to be evaluated
// every time you instantiate a new model, then
// it should be a function, not an object literal.
//
// object literals are only evaluated once, when the
// object is defined.
@mxriverlynn
mxriverlynn / init.js
Created June 6, 2012 18:28
add initializers to marionette module
// v0.9.0 of Marionettte will strip down the Modules to bare minimums, removing
// the ability to add initializers. you can re-add them to your module, as-needed,
// by doing this:
MyApp.module("Foo", function(Foo, MyApp, Backbone, Marionette){
var initCallbacks = new Marionette.Callbacks();
Foo.addInitializer = function(initializer){
initCallbacks.add(initializer);
}
@benpickles
benpickles / minify
Created January 4, 2011 21:17
Swiftly concat and minify JavaScript files from the command line
#!/usr/bin/env ruby
dry_run = ARGV.delete('--dry-run')
force = ARGV.delete('--force')
if ARGV.empty?
puts <<-USAGE
minify, swiftly concat and minify JavaScript files from the command line
Pass a single argument to create a .min.js version: