Skip to content

Instantly share code, notes, and snippets.

@kapusta
kapusta / onDelayedKeyup.coffee
Last active August 29, 2015 14:06 — forked from davidstump/gist:d0b9f87f6a132c2991fb
a keyup debouncing directive, needs to be decaffeinated
@App.directive "onDelayedKeyup", ['$timeout', ($timeout) ->
(scope, element, attrs) ->
timer = false
element.bind "keyup", ->
$timeout.cancel(timer) if timer
timer = $timeout ->
scope.$apply attrs.onKeyup
, 500
]
@kapusta
kapusta / watchers-bookmarklet.js
Last active August 29, 2015 13:56 — forked from clouddueling/bookmarklet.js
Angular watchers bookmarklet, compiled by make_bookmarklet.pl by @gruber
javascript:(function()%20{var%20root%20=%20$(document.getElementsByTagName(%27body%27));var%20watchers%20=%20[];var%20f%20=%20function(element)%20{if%20(element.data().hasOwnProperty(%27$scope%27))%20{angular.forEach(element.data().$scope.$$watchers,%20function(watcher)%20{watchers.push(watcher);});}angular.forEach(element.children(),%20function(childElement)%20{f($(childElement));});};f(root);console.log(watchers.length);}());
@kapusta
kapusta / intercept-fcty.js
Last active December 21, 2015 08:58 — forked from gnomeontherun/angularjs-interceptor.js
AngularJS interceptor factory with diff syntax from the gist I forked from. This logs everything out and is verbose as hell (dial that back as needed). In your module.config() you'll push 'intercept' onto the interceptors array by saying $httpProvider.interceptors.push('intercept'); The IIFE is in place because I keep all of my factories, servic…
// Adapted from: https://gist.github.com/gnomeontherun/5678505
(function(angular, document){
'use strict';
angular.module('YOURMODULENAMEHERE').factory('intercept', ['$q', function($q) {
console.log("intercept factory is running");
var i = {};