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];
app.directive('infiniteScroll', [
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
return {
link: function(scope, elem, attrs) {
var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
$window = angular.element($window);
elem.css('overflow-y', 'scroll');
elem.css('overflow-x', 'hidden');
elem.css('height', 'inherit');
scrollDistance = 0;
@koshdnb
koshdnb / mobiles-and-tablets-viewport-sizes
Created April 4, 2015 19:09 — forked from francoishill/gist:6483997
mobiles-and-tablets-viewport-sizes
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100
@koshdnb
koshdnb / 0_reuse_code.js
Created June 30, 2014 06:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console