Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.
function foo ({
bar = 'no',
baz = 'works!'
} = {}) {
const materialPackages:string[] = [ | |
'core', | |
'toolbar', | |
'icon', | |
'button', | |
'sidenav', | |
'list', | |
'card', | |
'input', | |
'radio', |
// include material 2 into angular-cli-build.js | |
var Angular2App = require('angular-cli/lib/broccoli/angular2-app'); | |
module.exports = function(defaults) { | |
return new Angular2App(defaults, { | |
vendorNpmFiles: [ | |
'@angular2-material/**/*.js' | |
] | |
}); |
This is my recomendation how to write angular components with leveraging react style component API naming.
And Remember, Respekt is everything! :)
ny
- is not new york :D, it's our meetup group prefix ngParty, come to our meetup yo ngParty// <script src="angular.min.js"></script> | |
(function(name, factory) { | |
// our basic IO module system that stores every module on modules with the "file" namespace | |
// please use something like browserify rather than rolling your own like this | |
window.modules = window.modules || {}; | |
window.require = window.require || function require(name) { return window.modules[name] || window[name]; }; | |
var exports = {}; factory(exports, window.require); | |
window.modules[name] = exports; | |
}('TodoService', function(exports, require) { |
// jqLite triggerHandler api | |
// dummy controller | |
function Ctrl(){ | |
this.clickMeBro = function(){ | |
}; | |
this.enterMeYo = function(event){ |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
A very exclusive collection of only must-have JavaScript links. I'm only listing my favorite links. Nothing else makes the cut. Feel free to suggest links if you think they're good enough to make this list. The really curious should feel free to browse the comments to find other links. I can't guarantee the quality of links in the comments.
Some of these links are affiliate links, meaning that if you make a purchase, I might earn a little money. This has absolutely no bearing on whether or not links make the list. None, whatsoever. However, it does allow me more resources to fight poverty with code. Every little bit counts.
// Person super class | |
function Person(name) { | |
this.name = name; | |
} | |
Person.prototype.describe = function () { | |
return 'Person called '+this.name; | |
}; | |
// Employee sub class | |
function Employee(name, title) { |
var dom = (function(window) { | |
'use strict'; | |
var docElem = window.document.documentElement; | |
function getViewportSize() { | |
return { | |
w: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), | |
h: Math.max(document.documentElement.clientHeight, window.innerHeight || 0) |