One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| // this function takes in any parameter and can tell if it's "falsy" or not. | |
| // falsy means it's either false, 0, null, undefined, NaN, or an empty string/array/object | |
| // see the test cases at the bottom for a clearer picture | |
| function isFalsy(item) { | |
| try { | |
| if ( | |
| !item // handles most, like false, 0, null, etc | |
| || ( | |
| typeof item == "object" && ( |
| function zip(a, b) { | |
| var arr = []; | |
| for (var key in a) arr.push([a[key], b[key]]); | |
| return arr; | |
| } | |
| console.log(zip('foo', 'bar')); | |
| //=> [ [ 'f', 'b' ], [ 'o', 'a' ], [ 'o', 'r' ] ] | |
| console.log(zip(['a', 'b', 'c'], ['x', 'y', 'z'])); |
| # Add the alias below to ~/.bash_profile on a Mac | |
| # Save the file and run: source ~/.bash_profile | |
| alias code='open $@ -a "Visual Studio Code"' |
//run this in your console
for (var i = 0; i <= 3; i++) {
setTimeout(function(){
console.log(i);
}, 0);
}
| // under Google Chrome 36 | |
| Object.prototype.toString.call([]) | |
| // "[object Array]" | |
| Object.prototype.toString.call(function(){}) | |
| // "[object Function]" | |
| Object.prototype.toString.call({}) | |
| // "[object Object]" | |
| Object.prototype.toString.call(null) | |
| // "[object Null]" |
| <?php | |
| /** | |
| * Include posts from authors in the search results where | |
| * either their display name or user login matches the query string | |
| * | |
| * @author danielbachhuber | |
| */ | |
| add_filter( 'posts_search', 'db_filter_authors_search' ); | |
| function db_filter_authors_search( $posts_search ) { |
| { | |
| "AL": "Alabama", | |
| "AK": "Alaska", | |
| "AS": "American Samoa", | |
| "AZ": "Arizona", | |
| "AR": "Arkansas", | |
| "CA": "California", | |
| "CO": "Colorado", | |
| "CT": "Connecticut", | |
| "DE": "Delaware", |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html