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
el-GR: 9705 | |
fr-FR: 9684 | |
it-IT: 9394 | |
de-DE: 9391 | |
nl-NL: 9174 | |
es-CL: 9076 | |
ro-RO: 9073 | |
ms-MY: 8998 | |
id-ID: 8993 | |
hu-HU: 8983 |
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 handlers = {}; | |
self.addEventListener('message', function (event) { | |
if (event.origin !== location.origin) return; | |
var key = event.data.key; | |
var value = event.data.value; | |
if (!handlers[key]) return; | |
handlers[key](value); | |
delete handlers[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
import java.util.Locale; | |
import java.util.Date; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
public class HelloWorld | |
{ | |
public static void main(String[] args) | |
{ | |
Locale hiDflt = Locale.forLanguageTag("hi-IN"); |
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 pascalize(string) { | |
return string.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); | |
} | |
function normalize(value) { | |
if (/^(null|true|false)$/.test(value)) { | |
return JSON.parse(value); | |
} | |
return 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
function assingImmutable(obj, toAdd) { | |
if (!_.isObjectLike(toAdd)) { | |
return toAdd; | |
} | |
key = _.first(path); | |
if (_.isArray(obj)) { | |
copy = _.slice(obj); | |
toAdd.forEach(function (value, idx) { | |
copy[idx] = assingImmutable(obj[idx], 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
function getType (value) { | |
let type = typeof value; | |
if (type === 'object') { | |
return value ? Object.prototype.toString.call(value).slice(8, -1) : 'null'; | |
} | |
return type; | |
} | |
[NaN, 0, 1, Infinity, // numbers | |
null, undefined, false, 'str', // other primitives |
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
/** | |
* @param {Node} node | |
* @template T | |
*/ | |
function Node (key, left, right) { | |
/** @property {T} key */ | |
this.key = key; | |
if (left) left.parent = this; | |
if (right) right.parent = this; | |
/** @property {Node<T>} left */ |
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
class Shape { | |
constructor (type, ...args) { | |
super(); | |
switch (type) { | |
case 'rect': | |
return new Rectangle(...args); | |
case 'circle': | |
return new Circle(...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
(function decompress (s) { | |
var i, c, out = "", len, offset; | |
for (i = 0; i < s.length; i++) { | |
c = s.charCodeAt(i); | |
if (c >= 256 && c <= 288) { | |
len = c - 256; | |
offset = s.charCodeAt(++i); | |
out += out.substr(-offset, len); | |
} else { | |
out += s.charAt(i); |
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 (n, m) { | |
if (typeof m === 'undefined') { m = 1; } | |
if (typeof n === 'undefined') { throw new TypeError("Provide at least first number"); } | |
function randSort () { | |
return Math.random() * 2 - 1; | |
} | |
function getArr(n) { | |
var a = []; | |
for (var i = 1; i <= n; i++) { a.push(i); } |
NewerOlder