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 max = 1000; | |
var min = 1; | |
var interval = 10; | |
var array = new Array(5000).join().split('').map(()=>Math.random() > 0.1 ? (Math.random()*(max-min)+min) : 'string'); | |
var strings = array.filter(el=>typeof el === 'string'); | |
result = array.filter(el=>typeof el === 'number').forEach(function(el) { | |
var place = (el/interval)|0; | |
(this[place] = this[place] || []).push(el); | |
}, result); | |
result.push(strings); |
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 getInt31() { | |
return Math.floor(Math.random()*2147483648).toString(); | |
} | |
function getInt32() { | |
return Math.floor((0.5-Math.random())*4294967296).toString(); | |
} | |
function getBigInt() { | |
// Constant deoptimizations, why? |
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
WITH [objects] as ( | |
SELECT | |
B.name as [schema_name], | |
A.name, | |
A.[object_id] as id, | |
A.type_desc as [object_type] | |
FROM sys.objects A | |
INNER JOIN sys.schemas B ON A.schema_id = B.schema_id | |
WHERE A.type_desc IN ('USER_TABLE' /*, 'VIEW'*/) | |
), |
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 numbers = Array(500*1000).join('a').split('').map(function(){ | |
return (1-Math.random())*Math.pow(2,200); | |
}); | |
(function bench(){ | |
for(var i = 0; i < numbers.length; i++) { | |
~~numbers[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
var toArray1 = function toArray1(arr){ | |
return [].slice.call(arr); | |
}; | |
var toArray2 = function toArray2(args) { | |
var len = args.length, | |
arr = new Array(len), i; | |
for (i = 0; i < len; i += 1) { | |
arr[i] = args[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
BEGIN TRANSACTION LENIWY_YAHOO; | |
CREATE TABLE #A(PK INT IDENTITY(1,1) PRIMARY KEY, Ignore INT); | |
INSERT INTO #A(Ignore) | |
SELECT CHECKSUM(NEWID()) FROM sys.objects; | |
ALTER TABLE #A ADD [nowy_timestamp] timestamp NOT NULL; | |
SELECT * FROM #A; |
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
WITH Wages(Euro, CountryName) AS ( | |
SELECT 357,"Albania"UNION ALL | |
SELECT 2230,"Andorra"UNION ALL | |
SELECT 315,"Armenia"UNION ALL | |
SELECT 2124,"Austria"UNION ALL | |
SELECT 224,"Azerbaijan"UNION ALL | |
SELECT 249,"Belarus"UNION ALL | |
SELECT 2091,"Belgium"UNION ALL | |
SELECT 425,"Bosnia and Herzegovina"UNION ALL | |
SELECT 376,"Bulgaria"UNION ALL |
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
CREATE TABLE Countries( | |
Country VARCHAR(30) PRIMARY KEY, | |
[GDP_$] INT, | |
[GDP PPP $] INT, | |
[Salary €] INT | |
); | |
INSERT INTO Countries | |
SELECT 'Luxembourg', 111716, 91047, 3149 UNION ALL | |
SELECT 'Norway', 97013, 64893, 3212 UNION ALL |
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
[ | |
{ | |
"country": "Afghanistan", | |
"publicHealthExpenditures": 2.9 | |
}, | |
{ | |
"country": "Albania", | |
"publicHealthExpenditures": 2.9 | |
}, | |
{ |
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
const BACKING_MAP = Symbol('Backing map for CustomEqualitySet'); | |
const HASH_FUNCTION = Symbol('Hash function for CustomEqualitySet'); | |
export default class CustomEqualitySet extends Set { | |
constructor(iterable=[], hashFunction=val=>val) { | |
super(); | |
this[BACKING_MAP] = new Map(); | |
this[HASH_FUNCTION] = hashFunction; | |
for(const el of iterable) { | |
this.add(el); |