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
// @credit http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs | |
function allowCrossDomain(req, res, next) { | |
res.header('Access-Control-Allow-Origin', '*'); | |
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | |
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); | |
if ('OPTIONS' == req.method) { | |
res.send(200); | |
} |
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 F() { | |
} | |
F.prototype.beep = function() { | |
console.log('beep'); | |
}; | |
function G() { | |
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 f(Infinity, length, __proto__) { | |
return [,,~0.[0|0]][f.__proto__.length && Infinity, -~String(this).length >> __proto__] << (0. === .0) + Infinity; | |
}).apply(typeof f, [,,2]); |
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 myModule = angular.module(...); | |
myModule.directive('namespaceDirectiveName', function factory(injectables) { | |
var directiveDefinitionObject = { | |
// Declare how directive can be used in a template as an element, attribute, class, comment, or any combination. | |
restrict: string, | |
// Set the order of execution in the template relative to other directives on the element. | |
priority: number, |
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
# EditorConfig is awesome: http://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
[*] | |
# use line feed | |
end_of_line = lf | |
# ensure file ends with a newline when saving |
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
// @credit: http://2013.jsconf.eu/speakers/forbes-lindesay-promises-and-generators-control-flow-utopia.html | |
var fs = require('fs'); | |
var path = require('path'); | |
var Promise = require('es6-promise').Promise; | |
function async(makeGenerator) { | |
return function() { | |
var generator = makeGenerator.apply(this, arguments); |
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
angular.module('App') | |
.controller('MyController', function ($scope, $location, $window, $rootScope) { | |
$rootScope.$on('$routeChangeSuccess', function(e) { | |
$window.ga('send', 'pageview', { page: $location.path() }); | |
}); | |
$scope.gaEvent = function() { | |
$window.ga('send', { | |
'hitType': 'event', |
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 pickFiles = require('broccoli-static-compiler'); | |
var mergeTrees = require('broccoli-merge-trees'); | |
var compileCompass = require('broccoli-compass'); | |
var EmberApp = require('ember-cli/lib/broccoli/ember-app'); | |
var app = new EmberApp(); | |
app.styles = function() { | |
var vendorTree = this._processedVendorTree(); |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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 parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1='\n\n\[\033[0;36m\]\u@$(hostname)\[\033[00m\]\[\033[0;32m\] : \w\[\033[00m\] \[\033[00;36m\]$(parse_git_branch)\n\[\033[00;32m\]\$\[\033[00m\] ' |