This file contains 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
/* | |
tabSlideOUt v1.3 (altered by katowulf) | |
Originally by William Paoli: http://wpaoli.building58.com | |
To use you must have an image ready to go as your tab | |
Make sure to pass in at minimum the path to the image and its dimensions: | |
example: |
This file contains 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 Firebase = require("./firebase-node.js"); | |
function Queue(ref) { | |
this._ref = ref; | |
} | |
Queue.prototype.pop = function(cb) { | |
this._ref.startAt().limit(1).once("child_added", this._pop.bind(this, cb)); | |
} |
This file contains 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 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 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
{ | |
"chat": { | |
// the list of chats may not be listed (no .read permissions here) | |
// a chat conversation | |
"$key": { | |
// if the chat hasn't been created yet, we allow read so there is a way | |
// to check this and create it; if it already exists, then authenticated | |
// user (specified by auth.id) must be in $key/users |
This file contains 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
/* | |
* Promise wrapper for Firebase | |
* | |
* Requires jQuery and underscore.js | |
*************************************/ | |
(function ($) { | |
"use strict"; | |
var undefined; | |
var FIREBASE_URL = 'https://YOURINSTANCE.firebaseio.com'; |
This file contains 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"); | |
This file contains 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 copyFbRecord(oldRef, newRef) { | |
oldRef.once('value', function(snap) { | |
newRef.set( snap.value(), function(error) { | |
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); } | |
}); | |
}); | |
} |
This file contains 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 sequenceRef = new Firebase(...+'/entries'); | |
var updateCounter = new Firebase(...+'/counter'); | |
updateCounter.transaction(function(currentValue) { | |
return currentValue+1; | |
}, function(error, committed, snap) { | |
if( error ) { ... } | |
else if( committed ) { | |
var updateCounter = snap.val(); | |
sequenceRef.push().setWithPriority({ |
This file contains 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
{ | |
"rules": { | |
".read": true, | |
".write": false, | |
"incid": { | |
"counter": { | |
// this counter is set using a transaction and can only be incremented by 1 | |
// the total number of records must be less than 10,000 simply for demo purposes | |
".write": "newData.isNumber() && ((!data.exists() && newData.val() === 1) || newData.val() === data.val()+1) && newData.val() <= 10000" | |
}, |
OlderNewer