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
<?php | |
// | |
// SyncController | |
// | |
// A controller for Laravel authentication when performing CouchDB syncing. | |
// | |
// This controller assumes a user per database approach and that when a user registers with the Laravel | |
// web app a couchdb_username is generated and stored in the user record. This name is used for the | |
// creation of a corresponding couchdb user and database. | |
// |
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
// | |
// Applies a sequence of angular filters to a given variable | |
// | |
// @param $filter The angular filter service | |
// @param value The variable to apply the filters on | |
// @param filterSpec A pipe separated list of filters to apply to the value e.g "filter1|filter2|filerN" | |
// | |
function applyFilters($filter, value, filterSpec) | |
{ |
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 readNested(obj, keys) | |
{ | |
var parts = keys.split('.'), | |
curr = obj; | |
for (var i = 0; i < parts.length; i++) | |
{ | |
if (!curr[parts[i]]) | |
{ | |
return null; |
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
// | |
// Performs a Fisher-Yates shuffle of an array | |
// | |
// @param input An array of items to shuffle | |
// | |
angular.module('nd.filters').filter('shuffle', function() { | |
function shuffle(input) | |
{ | |
var out = []; |