Skip to content

Instantly share code, notes, and snippets.

View ckniffen's full-sized avatar

Caleb Kniffen ckniffen

View GitHub Profile
import {
Component, Input, DynamicComponentLoader, ElementRef,
ViewContainerRef, ViewChild, Directive
} from 'angular2/core';
import * as _ from 'lodash';
import {FormlyConfig, IFieldConfig} from '../main';
@Directive({
selector: '[child-host]',
/*
Script: accordian.js
Author:
Caleb Kniffen, <http://kniffenwebdesign.com>
Version:
1.6
Required Files:
@ckniffen
ckniffen / backbone.inherits.js
Created October 8, 2013 20:55
Tweak of Backbone.extend to allow deeper inheritance for properties such as `defaults` and `options` and another property you also want extended.
/* global _, Backbone */
(function(_, Backbone){
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
Backbone.deepInheritableProperties = ['options', 'defaults'];
var inherits = function(protoProps, staticProps) {
var parent = this;
var child;
@ckniffen
ckniffen / compile_html.js
Last active December 17, 2015 16:09
Grunt Task to compile handlebar templates into static html files
module.exports = function(grunt) {
var handlebars = require('handlebars');
var path = require('path');
var registerPartials = function(partialsDir){
var partials = grunt.file.expand(partialsDir + '**/*.html');
partials.forEach(function(partial){
var partialName = partial.replace(partialsDir, '').replace(path.extname(partial), '');
handlebars.registerPartial(partialName, grunt.file.read(partial));
@ckniffen
ckniffen / nerve-io-client.js
Created November 14, 2012 21:45
Backbone socket.io framework rough draft currently code named Nerve.io
define([
'lodash',
'backbone'
], function(_, Backbone){
var Nerve = {
ioClient: null,
init: function(ioClient){
Nerve.ioClient = ioClient;
}
};
@ckniffen
ckniffen / jasmine-global-pollution.js
Created August 18, 2012 22:55
Jasmine Global Scope Pollution Reporter

Jasmine Global Pollution Reporter

  • Requires underscorejs. download
  • After a spec finishes running it logs any global scope pollution that occurred.
  • After test runner has finished it logs a summary of the global scope pollution.