A collection of utilities for making your life with angularFire better.
Reference: FirebaseExtended/angularfire#200 (comment)
Generate $firebase object of an array type, which can be used with handy angular filters.
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| app.directive('autoFillSync', function($timeout) { | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, elem, attrs) { | |
| var origVal = elem.val(); | |
| $timeout(function () { | |
| var newVal = elem.val(); | |
| if(ngModel.$pristine && origVal !== newVal) { | |
| ngModel.$setViewValue(newVal); | |
| } |
| /** | |
| * Context and arguments proxy function | |
| * | |
| * @param {function} func the function | |
| * @param {object} context the context | |
| * @param {array} args arguments | |
| * @return {function} proxied function | |
| */ | |
| function proxy(func, context, args) { | |
| return function () { |
| // async version of timedChunk plus queued by robin | |
| function asyncChunkQueued(items, process, context, callback) { | |
| var todo = items.concat(), //create a clone of the original | |
| i = 0, // index counter | |
| dfd = $.Deferred(), | |
| routine = function () { | |
| process.call(context, todo.shift(), i++) | |
| .then(function () { | |
| if (todo.length > 0) { | |
| _setImmediate(routine); |
| var Promise = require('bluebird'); | |
| // log the error | |
| Promise.onPossiblyUnhandledRejection(function(error){ | |
| // this will be called even though there is a catch | |
| console.log('uncaught error here', error); | |
| }); | |
| var toCall = Promise.coroutine(function* () { | |
| console.log('going to explode'); |
| angular.module('fireUtil', ['firebase']) | |
| .provider('fireUtil', function () { | |
| var util, $get; | |
| util = { | |
| rootUrl: null, | |
| $get: ['Firebase', function (Firebase) { | |
| var _rootRef = util.rootUrl ? new Firebase(util.rootUrl) : null; |
| angular.module('scope.glance', []) | |
| .factory('attach$glance', ['$q', function ($q) { | |
| function $glance(watchExpression, checkFunction, objectEquality) { | |
| var scope = this; | |
| var dfd = $q.defer(), | |
| clearWatch; | |
| checkFunction = checkFunction || function (newVal, oldVal, scope) { |
A collection of utilities for making your life with angularFire better.
Reference: FirebaseExtended/angularfire#200 (comment)
Generate $firebase object of an array type, which can be used with handy angular filters.
| // SmoothScroll for websites v1.2.1 | |
| // Licensed under the terms of the MIT license. | |
| // People involved | |
| // - Balazs Galambosi (maintainer) | |
| // - Michael Herf (Pulse Algorithm) | |
| (function(){ | |
| // Scroll Variables (tweakable) |