Skip to content

Instantly share code, notes, and snippets.

View Hotell's full-sized avatar
🎯
Focusing

Martin Hochel Hotell

🎯
Focusing
View GitHub Profile
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'
]
});
@Hotell
Hotell / defaults-overrides.md
Last active August 26, 2015 09:48 — forked from ericelliott/defaults-overrides.md
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {
@Hotell
Hotell / ng1mapToReactJs.md
Last active August 29, 2015 14:27
Mapping Angular 1 to ReactJS Api

Angular Component composition via ReactJS style API

This is my recomendation how to write angular components with leveraging react style component API naming.

And Remember, Respekt is everything! :)

Notes

  • ny - is not new york :D, it's our meetup group prefix ngParty, come to our meetup yo ngParty

@TODO

// <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) {
@Hotell
Hotell / triggerHandler.js
Last active November 9, 2015 12:22
jqLite#triggerHandler
// 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
@Hotell
Hotell / subclass.js
Created September 29, 2014 08:41
js inheritance
// 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) {
@Hotell
Hotell / dom.js
Last active August 29, 2015 14:06
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)