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 factorial(n) { | |
var | |
out = 1; | |
if ( n > 1 ) { | |
out = n * factorial(n - 1); | |
} | |
return out; |
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 findSumPairs(arr, sum) { | |
'use strict'; | |
var | |
i = 0, | |
j = 0, | |
isum, | |
imatch, | |
out = [], | |
larr; |
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 invert(num) | |
rev = 0 | |
while num >= 10 | |
rev = (rev + num % 10) * 10 | |
num = fld(num, 10) | |
end | |
return (rev + num) | |
end |
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 checkNumSeq(sum, chunks) { | |
var | |
i, | |
hchunks, | |
chunk, | |
out = []; | |
if ( sum % chunks === 0 && chunks % 2 ) { | |
chunk = sum / chunks; |
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
td { | |
height: 50px; | |
width: 50px; | |
border: 1px solid gray; | |
text-align: center; | |
} |
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
// Chrome 41 a>b>c | |
// FF 31 a>b>c | |
// IE10 a>b>c | |
// IE9 a>b>c | |
// IE8 b>c>a (opposite order, taking events wtih .onclick with higher precedence) | |
(function() { | |
var | |
myDiv = document.getElementById('myDiv'), | |
evt = 'click'; |
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
bukvy = new Set(); | |
word = 'world asdf a asdf asdf asdf asd fasdf sadf asdf asdf asdf as234234df asdf sadf asdf 5 alkjlkjkjsdf asdf asdf asd fasdfasd fasdf'; | |
out = []; | |
word.replace(/\d|\s/g, '').split('').forEach( | |
function(bukva) { | |
bukvy.add(bukva); | |
} | |
); | |
bukvy.forEach(function(bukva) { |
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 deepEqual(a, b) { | |
var | |
isAobj = (typeof a === 'object'), | |
isBobj = (typeof b === 'object'), | |
isABobjs = (isAobj && isBobj), | |
out = (a === b); | |
function checkX (x) { | |
var | |
ix, |
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
/// should be inside | |
/// static function OnBeforeRequest(oSession: Session) { ... } | |
if ( true/*some condition*/ ) { | |
var fso = new ActiveXObject("Scripting.FileSystemObject"), | |
fl = fso.OpenTextFile("c:\\path\\mocks\\manifest.json", 1), | |
content = fl.ReadAll(), | |
mockCalls, |
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 isPalindrome(word) { | |
var | |
normalizedWord = word.toLowerCase(), | |
reversedWord = normalizedWord.split('').reverse().join(''); | |
return normalizedWord === reversedWord | |
} |