Skip to content

Instantly share code, notes, and snippets.

@koshdnb
koshdnb / .block
Created February 18, 2016 11:34 — forked from mbostock/.block
Programmatic Pan+Zoom II
license: gpl-3.0
@koshdnb
koshdnb / .block
Created February 18, 2016 11:29 — forked from mbostock/.block
General Update Pattern 4.0
license: gpl-3.0
@koshdnb
koshdnb / angular-directives
Created February 1, 2016 16:18 — forked from awerlang/angular-directives
Angular.js directives sorted by priority
/*
I've compiled a list of angular directives according to their priorities (from most priority to lesser priority).
Also, terminal property is included for each directive that asserts it
*/
ng-switch 1200
ng-repeat 1000 terminal
ng-if 600 terminal
ng-controller 500
ng-init 450
app.directive('faFastScroll', ['$parse', function ($parse) {
var Interval = function(min, max) {
this.min = min || 0;
this.max = max || 0;
};
Interval.prototype.clip = function(min, max) {
if(this.max <= min || this.min >= max) {
this.min = this.max = 0;
@koshdnb
koshdnb / d3.js
Created November 17, 2015 08:38 — forked from auser/d3.js
angular.module('d3', [])
.factory('d3Service', ['$document', '$window', '$q', '$rootScope',
function($document, $window, $q, $rootScope) {
var d = $q.defer(),
d3service = {
d3: function() { return d.promise; }
};
function onScriptLoad() {
// Load client in the browser
$rootScope.$apply(function() { d.resolve($window.d3); });
@koshdnb
koshdnb / initialization.js
Created November 8, 2015 13:01 — forked from pellebjerkestrand/initialization.js
Initialization meta module
(function(global){
/* Initialization meta module. Pelle Bjerkestrand. WTFPL. */
'use strict';
var app = global.app || {};
function init(){
for (var key in app) {
if (app.hasOwnProperty(key)) {
var module = app[key];
@koshdnb
koshdnb / ng.js
Last active September 18, 2015 11:24
read

What you need

es5-shim jQuery 1.* AngularJS 1.4.* build from this repo (some poly-fills are baked in and minor fixes to enable IE8 support) Example

@koshdnb
koshdnb / gist:6ab9e8c513408a4f7afc
Created September 18, 2015 11:07
ie8 polyfills
// Polyfills for AngularJS 1.3
(function () {
// detect IE8 one way or another
/*one way
var ie=function(){
for(var e,i=3,n=document.createElement("div"),t=n.getElementsByTagName("i");
n.innerHTML="<!--[if gt IE "+ ++i+"]><i></i><![endif]-->",t[0];);return i>4?i:e
}();