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 arrayBufferToBase64(buffer) { | |
return btoa(String.fromCharCode.apply(String, new Uint8Array(buffer))); | |
} |
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 printPdf(url) { | |
var frame = document.createElement('iframe'); | |
frame.setAttribute('style', 'display:none;'); | |
frame.setAttribute('src', url); | |
var element = document.body.appendChild(frame); | |
element.addEventListener('load', function () { | |
element.contentWindow.print(); | |
document.addEventListener('focus', focusEventListener, true); | |
}); | |
function focusEventListener() { |
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.module('storage.utils', []) | |
.factory('StorageUnit', ['$localStorage', function ($localStorage) { | |
function StorageUnit(storageKey) { | |
this.storageKey = storageKey; | |
this.content = $localStorage[storageKey]; | |
} | |
StorageUnit.prototype.get = function () { | |
return this.content; |
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
if (!Object.fromSchema) { | |
Object.defineProperty(Object, 'fromSchema', { | |
enumerable: false, | |
value: function fromSchema(schema) { | |
var result = {}; | |
Object.keys(schema).forEach(function (key) { | |
value = schema[key]; | |
if (value && value.constructor === Function) { | |
result[key] = value(); | |
} |
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.module('$template-cache-watch', []) | |
.decorator('$templateCache', function ($delegate) { | |
var decorated = Object.create($delegate); | |
var callbacks = Object.create(null); | |
decorated.watch = function (key, callback) { | |
if (!callbacks[key]) { | |
callbacks[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
angular.module('ng-attribute', []) | |
// Horrible hack for obtaining directive class `Attribute` constructor function. | |
// There is a nuisance in AngularJS in that the `constructor` property was not retained in the prototype. | |
.directive('attributesDecorator', function () { | |
// constructor extracted from angular.js | |
function Attributes(element, attributesToCopy) { | |
if (attributesToCopy) { | |
var keys = Object.keys(attributesToCopy); | |
var i, l, 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
angular.module('services-roles', []) | |
.factory('HelperRole_CommonResourceGetter', function (params, errorHandler) { | |
/** | |
* @constructor | |
* @param {string} name of the resource | |
* @param {Resource} Resource | |
* @param {Function.<Array|boolean>} actionArgsMapper | |
*/ |
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
/** | |
* Extends `obj` with properties created as `key: value` for every pair of two consecutive arguments | |
* @param {Object} obj | |
* @return {Object} obj | |
*/ | |
function extendWithArgs(obj) { | |
for (var i = 2; i < arguments.length; i += 2) { | |
obj[arguments[i-1]] = arguments[i]; | |
} | |
return obj; |
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
/** | |
* @method Array.prototype.groupBy(group) | |
* Creates a dictionary grouping by an attribute or if `group` is a function, what it returns. | |
* @param {function|string} group - attribute name or function(item, index, array): string | |
* @returns {object.<array>} | |
*/ | |
if (!Array.prototype.groupBy) { | |
Object.defineProperty(Array.prototype, 'groupBy', { | |
enumerable: false, | |
value: function groupBy(group) { |
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.module('configurators', ['ngRoute', 'ngMaterial']) | |
.config(['$provide', '$routeProvider', 'Resolver', function ($provide, $routeProvider, Resolver) { | |
var modules = {}; | |
$provide.constant('RouteConfigurationProvider', function (module, options) { | |
if (arguments.length === 1) { | |
if (angular.isObject(module)) { | |
options = module; |
OlderNewer