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
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
curl -so /dev/null -w "url_effective = %{url_effective}\n http_code = %{http_code}\n http_connect = %{http_connect}\n time_total = %{time_total}\n time_namelookup = %{time_namelookup}\n time_connect = %{time_connect}\n time_appconnect = %{time_appconnect}\n time_pretransfer = %{time_pretransfer}\n time_redirect = %{time_redirect}\n time_starttransfer = %{time_starttransfer}\n size_download = %{size_download}\n size_upload = %{size_upload}\n size_header = %{size_header}\n size_request = %{size_request}\n speed_download = %{speed_download}\n speed_upload = %{speed_upload}" https://<your instance>.firebaseio.com/some/deep/path.json |
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
// UNTESTED; THEORETICAL, based on http://docs.urbanairship.com/connect/ios_push.html | |
https://github.com/mikeal/request | |
var request = require('request'); | |
/** Presumably the snapshot will contain something like this: | |
* | |
{ | |
"audience": {"device_token": "FE66489F304DC75B8D6E8200DFF8A456E8DAEACEC428B427E9518741C92C6660"}, | |
"notification": { |
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
'use strict'; | |
/** | |
* This module monitors angularFire's authentication and performs actions based on authentication state. | |
* directives/directive.ngcloakauth.js depends on this file | |
* | |
* Modify ng-cloak to hide content until FirebaseSimpleLogin resolves. Also | |
* provides ng-show-auth methods for displaying content only when certain login | |
* states are active. | |
* |
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
// this will remove all error logging globally | |
angular.config(function($provide) { | |
$provide.decorator("$firebaseObject", function($delegate) { | |
$delegate.prototype.$$error = function(err) { | |
this.$destroy(err); | |
}; | |
return $delegate; | |
}); | |
$provide.decorator("$firebaseArray", function($delegate) { |
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
angular.factory('Arr', function($firebaseArray) { | |
function Arr(ref) { | |
this.oldVals = {}; | |
return $firebaseArray.call(this, ref); | |
} | |
Arr.prototype.$$process = function(event, rec, prevKey) { | |
$firebaseArray.prototype.$$process.apply(this, arguments); | |
this.oldVals[rec.$id] = rec; | |
}; |
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
app.factory('DescendingArray', function($firebaseArray) { | |
return $firebaseArray.$extend({ | |
// Modify $$process to handle added events by prepending instead of appending | |
$$process: function(event, rec, prevChild) { | |
var key = this.$$getKey(rec); | |
var changed = false; | |
if( event === 'child_added' ) { | |
curPos = this.$indexFor(key); |
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
/** | |
* A diff utility that compares arrays and returns a list of added, removed, and updated items | |
* | |
* Returns an object with two methods: | |
* diff: do a one-time diff of two arrays | |
* watch: observe a variable on scope and report any changes to a callback | |
* | |
* Invoking the factory is done like so: | |
* <code> | |
* function(listDiff) { |
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
//require the Twilio module and create a REST client | |
var client = require('twilio')('ACCOUNT_SID', 'AUTH_TOKEN'); | |
var Firebase = require('firebase'); | |
var fb = new Firebase('FIREBASE_URL'); | |
fb.auth('FIREBASE_SECRET', function(err) { | |
if( err ) { throw err; } | |
listenForEvents(); | |
}) |