This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Promise.all is good for executing many promises at once | |
Promise.all([ | |
promise1, | |
promise2 | |
]); | |
// Promise.resolve is good for wrapping synchronous code | |
Promise.resolve().then(function () { | |
if (somethingIsNotRight()) { | |
throw new Error("I will be rejected asynchronously!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bar1 = base => class extends base { | |
componentWillMount(){ | |
super.componentWillMount(); | |
console.log('Bar1'); | |
} | |
}; | |
var Bar2 = base => class extends base { | |
componentWillMount(){ | |
super.componentWillMount(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ignore all | |
* | |
# Unignore all with extensions | |
!*.* | |
# Unignore all dirs | |
!*/ | |
### Above combination will ignore all files without extension ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A thing I want to do | |
// This flow only involves **one** promise, for example an ajax call | |
// None of the subsequent `then` or `catch` calls, return new promises. | |
var explode = false; | |
var promise = new Promise(function(resolve, reject) { | |
if (explode) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias delsvn='find . -type d -name .svn -exec rm -rf {} +' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Do not use this library. This is just a fun example to prove a | |
// point. | |
var Bloop = window.Bloop = {}; | |
var mountId = 0; | |
function newMountId() { | |
return mountId++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Chosen, a Select Box Enhancer for jQuery and Prototype | |
// by Patrick Filler for Harvest, http://getharvest.com | |
// | |
// Version 0.9.15 | |
// Full source at https://github.com/harvesthq/chosen | |
// Copyright (c) 2011 Harvest http://getharvest.com | |
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md | |
// This file is generated by `cake build`, do not edit it by hand. | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modernizr style test | |
if (!(window.webkitMatchMedia || window.mozMatchMedia || window.oMatchMedia || window.msMatchMedia || window.matchMedia)) { | |
var root = document.getElementsByTagName( 'html' )[0]; | |
root.className += ' no-matchmedia'; | |
} | |
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license - IE8 VERSION! */ | |
window.matchMedia = window.matchMedia || (function(doc, undefined){ | |
var docElem = doc.documentElement, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modernizr style test | |
if (!(window.webkitMatchMedia || window.mozMatchMedia || window.oMatchMedia || window.msMatchMedia || window.matchMedia)) { | |
var root = document.getElementsByTagName( 'html' )[0]; | |
root.className += ' no-matchmedia'; | |
} | |
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ | |
window.matchMedia || (window.matchMedia = function() { | |
"use strict"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStyle(styleText) { | |
var style = document.createElement('style'); | |
style.type = 'text/css'; | |
// <style> element must be appended into DOM before setting `cssText` | |
// otherwise IE8 will interpret the text in IE7 mode. | |
document.body.appendChild(style); | |
if (style.styleSheet) { | |
style.styleSheet.cssText = styleText; | |
} else { |