This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Factory = $FirebaseObject.extendFactory({ | |
| forEach: function(callback, context) { | |
| var self this; | |
| $firebaseUtils.each(self, function(v, k) { | |
| if( k !== "ignore" ) { | |
| callback.call(context, v, k, self); | |
| } | |
| }); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // inspiration: http://stackoverflow.com/questions/3993982/how-to-check-type-of-variable-in-java/16717058#16717058 | |
| class TypeTester { | |
| void printType(Byte x) { | |
| System.out.println(x + " is a byte"); | |
| } | |
| void printType(Boolean x) { | |
| System.out.println(x + " is a boolean"); | |
| } | |
| void printType(Integer x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var SmartSaveFactory = $FirebaseArray.$extendFactory({ | |
| $save: function(indexOrItem, listOfFields) { | |
| if( !listOfFields ) { | |
| // do a normal save if no list of fields is provided | |
| return $FirebaseArray.prototype.$save.apply(this, arguments); | |
| } | |
| else { | |
| // this is a bit risky since we're using an internal method that could change | |
| // we could remove this coupling by always passing the item instead of allowing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var DynamicPathMonitor = require('./DynamicPathMonitor'); | |
| // call this instead of new PathMonitor inside PathMonitor.process | |
| function NestedPathMonitor(ref, factory) { | |
| this.factory = factory; | |
| this.paths = {}; | |
| ref.on('child_added', this._add, this); | |
| ref.on('child_removed', this._remove, this); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ResetFactory = $FirebaseArray.$extendFactory({ | |
| reset: function(itemOrIndex) { | |
| var self = this; | |
| var key = self.$keyAt(itemOrIndex); | |
| self.$inst().$ref().once('value', function(snap) { | |
| self.$$updated(snap); | |
| }); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var app = angular.module('app', ['firebase', 'ui.grid', 'ui.grid.infiniteScroll']); | |
| app.controller('ctrl', function($scope, $firebaseArray) { | |
| var baseRef = new Firebase('https://fbutil.firebaseio.com/paginate'); | |
| var scrollRef = new Firebase.util.Scroll(baseRef, 'number'); | |
| //$scope.data = $firebaseArray(scrollRef); | |
| $scope.opts = { | |
| columnDefs: [ | |
| {name: '$id', displayName: 'ID'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <canvas id='canvas'></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _updateModel(model, options) { | |
| var firebase = this.firebase; | |
| var changes = model.changedAttributes(); | |
| if( changes ) { | |
| setTimeout(function() { // make sure change events fire before Firebase notifies on() listener | |
| firebase.child(model.id).update(changes); | |
| }, 0); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var authClient = new FirebaseAuthClient(db, function(error, user) { | |
| if (error) { | |
| alert(error); | |
| } else if (user) { | |
| $(body).removeClass("noAuth").addClass("auth"); | |
OlderNewer