Skip to content

Instantly share code, notes, and snippets.

View subzey's full-sized avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / LICENSE.txt
Created July 8, 2011 14:52 — forked from 140bytes/LICENSE.txt
deMorse: Morse code → text
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 subzey <subzey@immelman.ru>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@subzey
subzey / LICENSE.txt
Created July 28, 2011 13:30 — forked from 140bytes/LICENSE.txt
removeClassRegexp
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 subzey <subzey@immelman.ru>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@subzey
subzey / index.md
Created November 8, 2011 10:51
ES5 Whitespace Browser Hell

ES5 Whitespace Browser Hell

Please tell what isFinite('\r\n') is equal to? The right answer is true. Another wtfjs.com case?

The answer why is in ECMA-262 spec, §9.3.1, “ToNumber Applied to the String Type”:

The MV of StringNumericLiteral ::: StrWhiteSpace is 0.

The MV of StringNumericLiteral ::: StrWhiteSpaceopt StrNumericLiteral StrWhiteSpaceopt is the MV of StrNumericLiteral, no matter whether white space is present or not.

@subzey
subzey / LICENSE.txt
Created December 12, 2011 10:23 — forked from 140bytes/LICENSE.txt
IE9 console.log patch
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 subzey <subzey@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@subzey
subzey / LICENSE.txt
Created December 19, 2011 12:11 — forked from thingsinjars/LICENSE.txt
Chainable property setting
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Simon Madine <http://thingsinjars.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@subzey
subzey / LICENSE.txt
Created December 29, 2011 08:51 — forked from 140bytes/LICENSE.txt
getFloat64LE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 subzey <subzey@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@subzey
subzey / readme.md
Created March 10, 2012 14:41
Array.prototype.concat и UInt32

Array.prototype.concat и UInt32

У массива в javascript есть замечательный метод .concat. Как и следует из названия, он объединяет два (или более) массива в один. Если в качестве аргумента передан массив, в результрующий массив попадут его значения; если не массив, то сам аргумент. Если кратко, то вот этот кусок кода:

[1, 2, 3].concat(4, [5, 6], [7]); // [1,2,3,4,5,6,7]

А что будет, если длина получившегося массива будет равна или превышать 232? Чтобы ответить на этот вопрос обратимся к спецификации. А написано там следующее:

rx1 = /regularexpression/;
with({rx1: 0})
var rx1 = RegExp(/regular/ + /expression/);
var rx2 = /regularexpression/;
@subzey
subzey / gist:2901181
Created June 9, 2012 14:28
Strange "illegal access" error in v8
for (var i = 0; i <= 0xFFFF; i++){
i.toString(16).split(/(.)\1/i)
}
console.log('ok');
@subzey
subzey / gist:3260444
Created August 4, 2012 22:58
simple node tcp server
var PORT = 23; // telnet
var tcpServer = require("net").createServer();
tcpServer.on('connection', function(socket){
var clientAddress = socket.remoteAddress + ':' + socket.remotePort;
console.log('%s connected', clientAddress);
socket.on('data', function(buffer){
console.log('%s sent %s byte(s)', clientAddress, buffer.length);
});
socket.on('end', function(){