⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
npm = require 'npm' | |
npm.load {global: true}, (error, npm) -> | |
npm.commands.ls [], true, (error, result) -> | |
for moduleName, module of result.dependencies | |
if moduleName[..8] == 'clitool-' | |
# load module as a plugin |
Getting grunt to work with Cygwin and git on Windows is a bit difficult considering the cygwin package that is installed by git has an outdated version of node running on it. There are several issues to work through:
- Cygwin by default installs an old version of node.
- Open Cygwin shell
which node
tells you where the executable isnode --version
tells you if it's oldcd
to the directory listed bywhich node
mv node.exe node.exe.bak
- download node from nodejs.org and install it
- Node installed through installer doesn't update PATH to point to correct version of node installed normally.
This gist is aimed at helping you assess whether you'll be a good fit for Bocoup's "Foundations of Programming with JavaScript" training. This class is aimed at introducing you to fundamental concepts of development using JavaScript. In this class, you'll work through the process of building a simple game of hangman; along the way, you'll learn about functions, arrays, objects, and prototypes, and get a brief introduction to the jQuery library. You'll also learn about approaches that will help you write more maintainable code, and get introduced to tools for debugging and testing your JavaScript.
// inside a gruntfile | |
grunt.registerTask('awesome', { | |
description: 'The most awesome task ever.', | |
type: 'multi', | |
main: function(grunt, arg) { | |
var files = grunt.file.expandFiles(grunt.util._.pluck(this.files, 'src')); | |
var success = this.task.listFiles(grunt, files); | |
grunt.log.writeln('Stuff happened...'); | |
if (success) { grunt.log.ok(); } else { grunt.log.error(); } | |
}, |
#!/ricky martin |
mobile: function() { | |
return Modernizr.mq("only all and (max-width: 480px)"); | |
} |
I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.
Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).
- Calling
array.push()
five times in a row will never be a "performance improvement." The author has clearly co
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 6) then: | |
// ie === 0 | |
// If you're in IE (>=6) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |