Skip to content

Instantly share code, notes, and snippets.

View Hotell's full-sized avatar
🎯
Focusing

Martin Hochel Hotell

🎯
Focusing
View GitHub Profile
@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!'
  } = {}) {
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
//MODIFIED: add require for connect-modewrite
var modRewrite = require('connect-modrewrite');
grunt.initConfig({
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@Hotell
Hotell / git.css
Created August 16, 2014 11:20 — forked from neilgee/git.css
/* Set up Git Configuration */
git config --global user.email "neil@coolestguidesontheplanet.com"
git config --global user.name "Neil Gee"
git config --global core.editor "vi"
git config --global color.ui true
@Hotell
Hotell / ng.resourceCustomDef.ts
Last active August 29, 2015 14:06
Custom ng.resource definition
// We have the option to define arguments for a custom resource
interface IArticleParameters {
id: number;
}
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
title: string;
text: string;
date: Date;
author: number;
@Hotell
Hotell / ws.bug.ts
Last active August 29, 2015 14:06
Webstorm type infer bug
declare module ng{
interface IAngularStatic{
}
interface IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise<TResult>;
}
@Hotell
Hotell / index.html
Created September 16, 2014 18:39
The Holy Grail of CSS Centering
<body>
<div class="container">
<!-- Centered inside whatever sized container -->
<div class="outer">
<div class="inner">
<div class="centered">
<p>
@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)
@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) {