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
// includes bindings for fetching/fetched | |
var PaginatedCollection = Backbone.Collection.extend({ | |
initialize: function() { | |
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by'); | |
typeof(options) != 'undefined' || (options = {}); | |
typeof(this.limit) != 'undefined' || (this.limit = 20); | |
typeof(this.offset) != 'undefined' || (this.offset = 0); | |
typeof(this.filter_options) != 'undefined' || (this.filter_options = {}); | |
typeof(this.sort_field) != 'undefined' || (this.sort_field = ''); |
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
$resourceMinErr = angular.$$minErr('$resource') | |
angular.module('resources', []) | |
.provider 'Resource', () -> | |
provider = @ | |
provider.prefix = '/api/v1' | |
provider.uriField = 'resource_uri' | |
class ResourceBase |
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
#!/usr/bin/env python | |
from base64 import b64decode | |
from flask import Flask, current_app | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_presst import PresstApi, ModelResource | |
from flask_presst.principal import PrincipalResource | |
from flask_login import LoginManager, UserMixin, current_user, login_required, user_logged_in, user_logged_out | |
from flask_principal import UserNeed, RoleNeed, Principal, Identity, AnonymousIdentity, identity_changed, \ |
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
class Potion { | |
/** | |
* | |
* @param {function} fetch for GET requests to look up references | |
* @param {object} constructors a map of resource URIs to constructors, e.g. {'/type': Type} | |
* @param {function} defaultConstructor an optional fallback for other types | |
* @param {string} prefix an optional API prefix | |
* @param {object} cache an optional cache object with get(string), put(string, object) and remove(string) methods | |
*/ |
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
import angular from 'angular'; | |
function copy(source, target) { | |
Object.keys(source).forEach((key) => { | |
target[key] = source[key]; | |
}); | |
return target; | |
} | |
function fromCamelCase(string, separator = '_') { |