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 createRestFactory(name, path, r){ | |
| rest.factory(name, function($resource, $cacheFactory){ | |
| var c=$cacheFactory(name); | |
| var res = $resource(path, {}, r); | |
| return (function(resource, routes, cache) { | |
| var o={}; | |
| angular.forEach(routes, function(value, key) { | |
| o[key]=(function(r) { | |
| var request=r; | |
| return function(attrs) { |
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
| var link_processor = function () { | |
| var link_selector = 'a[href^="/"], a[href^="' + document.location.origin + '"]'; | |
| $('body').on('click', link_selector, function () { | |
| var target, all_of_type, target_path; | |
| target = $(this); | |
| if (target.attr('href')) { | |
| target_path = target.attr('href').replace(document.location.origin, ''); | |
| var chunks = target_path.split('.'); | |
| if ((chunks.length == 1) || (chunks.length > 1 && (chunks[chunks.length - 1] == "htm") && (chunks[chunks.length - 1] == "html"))) { |
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
| CacheFactory = (function () { | |
| function compareThings() { | |
| var names = [ | |
| arguments[0]["name"].toLowerCase(), | |
| arguments[1]["name"].toLowerCase() | |
| ]; | |
| if (names[0] < names[1]) { | |
| return -1; | |
| } | |
| if (names[0] > names[1]) { |
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
| var brightnessProperty = { | |
| get: function () { | |
| var canvas = document.createElement('canvas'); | |
| canvas.width = 1; | |
| canvas.height = 1; | |
| var context = canvas.getContext('2d'); | |
| context.drawImage(this, 0, 0, 1, 1); | |
| var data = context.getImageData(0, 0, 1, 1).data; | |
| return Math.floor((data[0] + data[1] + data[2]) / 3) | |
| }, |
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 (rarDetected) { | |
| function detectRar(blob, callback) { | |
| var reader = new FileReader; | |
| reader.readAsBinaryString(blob); | |
| reader.onload = function () { | |
| callback(reader.result.indexOf('Rar!') != -1) | |
| } | |
| } | |
| function getBlob(url, callback) { |
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
| $('body').on('submit', 'form.remote', function (e) { | |
| e.preventDefault(); | |
| var form = this; | |
| form.xhrSend(function (responseData) { | |
| form.reset(); | |
| window.images.add(responseData.src) | |
| }); | |
| return false | |
| }); |
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
| directive('preload-css-images', function () { | |
| var image_regexp = /url\(['"]?\S*['"]?\)/; | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| var styleSheet = document.styleSheets[i]; | |
| var rules = styleSheet.cssRules || styleSheet.rules; | |
| if (rules && rules.length) | |
| for (var j = 0; j < rules.length; j++) { | |
| var image_urls = image_regexp.exec(rules[j].cssText); | |
| if (image_urls) for (var k = 0; k < image_urls.length; k++) { | |
| document.createElement('img').src = image_urls[k] |
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
| directive('preload-css-images', function(){ | |
| var image_regexp = /url\(['"]?\S*['"]?\)/; | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| var styleSheet = document.styleSheets[i]; | |
| var rules = styleSheet.cssRules || styleSheet.rules; | |
| if (rules && rules.length) | |
| for (var j = 0; j < rules.length; j++) { | |
| var ruleText = rules[j].cssText; | |
| if (ruleText){ | |
| var image_urls = image_regexp.exec(ruleText); |
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
| require('traceur').require.makeDefault(function(filename){ | |
| return filename.endsWith('traceur.js'); | |
| }); | |
| module.exports = require('./index.traceur.js'); |
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 lcs(x, y) { | |
| var symbols = {}, | |
| r = 0, p = 0, p1, L = 0, idx, | |
| m = x.length, n = y.length, | |
| S = new Array(m < n ? n : m); | |
| p1 = popsym(0); | |
| for (i = 0; i < m; i++) { | |
| p = (r === p) ? p1 : popsym(i); | |
| p1 = popsym(i + 1); | |
| idx = (p > p1) ? (i++, p1) : p; |
OlderNewer