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 loader = (function() { | |
var speed = 200, | |
index = 0, | |
timeout = null, | |
symbols = ['└', '├', '┌', '┬', '┐', '┤', '┘', '┴']; | |
function show() { | |
console.log(symbols[index]); | |
index = (index + 1) % symbols.length; | |
timeout = setTimeout(show, speed); |
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 endpoints = null; | |
function addEndpoint(url) { | |
var i; | |
if (endpoints == null) { | |
endpoints = getEndpoints(); | |
} | |
url = url.trim(); | |
if (url.charAt(url.length - 1) != '/') { | |
url += "/"; |
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 _swap = function(a, b) { | |
return "".concat(a, " = [", b, ", ", b, " = ", a, "][0]") | |
}; | |
var a = 1, b = 2; | |
eval(_swap('a', 'b')); |
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
# Finds all .css and .js files in specified folders and converts LF line endings to CRLF | |
dirs=( './Packages' './App.Web/Scripts' ); | |
find "${dirs[@]}" -type f \( -name '*.js' -o -name '*.css' \) -exec dos2unix -D -v {} \; |
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 stack_holder = new Error; | |
function stackPrepare(e,stacks) { | |
var stack = stacks | |
for (var p in stack[0]) { | |
stack[p] = stack[0][p] | |
} | |
stack.find = function(fn) { | |
for (var i=stack.length;i--;) { | |
if (stack[i].getFunction() === fn) break; |
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
/** | |
* ES5 Complete Object Clone | |
* | |
* @param {Object} Object to clone | |
* @return {Object} Cloned object | |
*/ | |
function (obj, tmp /* placeholder */) { | |
// import Object.* | |
with(Object) | |
// get property names |
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 utility function to convert an array-like object (or suffix of it) to a true array. | |
*/ | |
function (arr, start /* optional */) { | |
return Array.prototype.slice.call(arr, start || 0); | |
} |
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
/** | |
* Returns a new function that invokes `func` in a specified context and | |
* with specified set of arguments. | |
* The arguments to this function serve as a template. Undefined values | |
* in the argument list are filled in with values from the inner set. | |
* | |
* Example: var f = function(x, y, z) { return x * (y - z); } | |
* partialApply(f, undefined, 2)(3, 4) // => -6: 3 * (2 - 4) | |
* | |
* @param func {Function} A function to invoke. |
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
/** | |
* Applies a set of named arguments to `fn`. | |
* | |
* Example: var f = function(x, y, z) { return x * (y - z); }; | |
* namedApply(f, {x: 1, y: 2, z: 3}); | |
* | |
* @param fn {Function} A function to invoke. | |
* @param args {Object} A collection of named arguments. | |
*/ | |
function namedApply(fn, args) { |
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 i = 0, sum = 0; | |
while (i < sizeof(array)) | |
{ | |
sum += array[i]; | |
i++; |
OlderNewer