Skip to content

Instantly share code, notes, and snippets.

View timkindberg's full-sized avatar

Tim Kindberg timkindberg

View GitHub Profile
@timkindberg
timkindberg / placeholder.js
Created January 25, 2013 18:28
JQuery polyfill for input placeholders.
;(function($){
var alreadySupported = 'placeholder' in document.createElement('input');
function doPlaceholder(){
if(alreadySupported) return;
var $this = $(this);
if($this.data('placeholder-polyfill'))return;
$this.data('placeholder-polyfill', true);
if(!$this.is('[type="text"], [type="password"], [type="email"], textarea')) return;
$this.wrap('<span style="position:relative" />');
@timkindberg
timkindberg / mockDirective.js
Last active August 29, 2015 14:26
Quickly Mock Child Components
export function mockDirective(...names) {
return angular.mock.module(($compileProvider) => {
names.forEach((name) => {
$compileProvider.directive(name, () => {
return {
priority: 9999,
terminal: true,
restrict: 'EAC',
template:`<mock-${dashCase(name)}></mock-${dashCase(name)}>`,
replace: true
@timkindberg
timkindberg / app.js
Last active May 11, 2016 16:04
ng-forward ng1 migration (after)
import { Component, bundle } from 'ng-forward';
import { ComponentA } from './component-a';
import { ComponentB } from './component-b';
@Component({
selector: 'app',
directives: [ ComponentA, ComponentB ]
})
export class App { }
@timkindberg
timkindberg / app.js
Last active October 22, 2015 18:04
ng-forward ng1 migration (before)
angular.module('app', []);
@timkindberg
timkindberg / app.js
Last active October 25, 2015 07:12
ng-forward ng1 migration (part 1)
import { componentAModule } from './component-a';
angular.module('app', [componentAModule]);
@timkindberg
timkindberg / app.js
Created October 22, 2015 18:28
ng-forward ng1 migration (part 2)
import { componentAModule } from './component-a';
angular.module('app', [componentAModule]);
@timkindberg
timkindberg / app.js
Last active October 26, 2015 03:24
ng-forward ng1 migration (part 1 - alternative)
import { bundle } from 'ng-forward';
import { ComponentA } from './component-a';
// We can create a bundled module from ComponentA
// You can then reference that module elsewhere for
// non-converted components and services
bundle('app', ComponentA);
@timkindberg
timkindberg / app.js
Created October 26, 2015 03:24
ng-forward ng1 migration (part 2 - alternative)
import { bundle } from 'ng-forward';
import { ComponentA } from './component-a';
// We can create a bundled module from ComponentA
// You can then reference that module elsewhere for
// non-converted components and services
bundle('app', ComponentA);
@timkindberg
timkindberg / ng-forward.0.0.1-alpha.8.js
Created November 26, 2015 04:20
ng-forward for plunkr
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global){
"use strict";
_dereq_(180);
_dereq_(181);
if (global._babelPolyfill) {
throw new Error("only one instance of babel/polyfill is allowed");
@timkindberg
timkindberg / ng-forward.0.0.1-alpha.10.js
Created November 30, 2015 03:13
ng-forward.0.0.1-alpha.10.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global){
"use strict";
_dereq_(188);
_dereq_(189);
if (global._babelPolyfill) {
throw new Error("only one instance of babel/polyfill is allowed");