Skip to content

Instantly share code, notes, and snippets.

View subzey's full-sized avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / main.js
Created August 5, 2012 06:53
My old and dirty telnet server prototype
var net = require('net');
var telnet = require('./telnet.lib.js');
var boxDrawings = {
'ascii': [
[0xDC], // lower
[0xDF], // upper
[0xDB], // full
[0xB2], // 75%,
[0xB3], // 50%,
{{К удалению|2012-07-17}}Список включает фильмы, описывающие [[психические расстройства]] как в основной, так и второстепенных сюжетных линиях. Фильмы упомянуты независимо от того, правильно ли изображено в них то или иное психическое расстройство.
== [[Агорафобия]] ==
* ''[[Имитатор (фильм, 1995)|Имитатор]]'' (1995) [http://www.imdb.com/title/tt0112722/]
* ''[[Обнажённый страх]]'' (1999) [http://www.imdb.com/title/tt0373183/]
* ''[[Застывший от страха]]'' (2000) [http://www.imdb.com/title/tt0221297/]
* ''[[Влюблённый Тома (фильм)|Влюблённый Тома]]'' (2000)
* ''[[Public Domain (film)|Public Domain]]'' (2003) [http://www.imdb.com/title/tt0382923/]
* ''[[Двенадцать друзей Оушена]]'' (2004) [http://www.imdb.com/title/tt0349903/]
* ''[[Запасные игроки (фильм)|Запасные игроки]]'' (2006) [http://www.imdb.com/title/tt0437863/]
#!/usr/bin/env node --harmony --expose-gc --gc-global
var map = new WeakMap();
var key = {};
var value = {foo: 42};
map.set(key, value);
value = null; /* unreference */
gc();
console.log(map.get(key));
#!/usr/bin/env node --harmony
var map = new WeakMap();
var heapStat = {
current: undefined,
max: -Infinity
};
(function iterate(){
console.log(
'Current: %s\tMax: %s',
heapStat.current = process.memoryUsage().heapUsed,
var foo = function(){
var o = {foo: 42};
global.bar = function(){
return o;
};
try {
return o;
} finally {
o = null;
}
@subzey
subzey / gist:3830251
Created October 3, 2012 22:19
UnicodeEscapeSequence in Identifier

According to ECMA 262 both versions 3 and 5 variable name may contain chars escaped by \uHHHH. So var ы; and var \044b; is essentially the same.

The Syntax section there also states that variable name cannot be equal to any of the reserved words. So var this; is surely invalid.

But what happens if var \0074his is encountered?

Specs doesn't clearly explain this. "Unicode escape sequences are also permitted in an IdentifierName, where they contribute a single character to the IdentifierName...". Great, but does it mean that escape sequence must be unescaped prior to comparsion with reserved kerwords or not?

In other words, is \0074his the same as this?

@subzey
subzey / gist:4196191
Created December 3, 2012 16:42
Function.prototype.kwargs
Function.prototype.kwargs = function()
{
var argNames, kwargs, args = [], thisObject;
for (var i=0; i<arguments.length; i++){
var obj = arguments[i];
if (Object(obj) !== obj){
continue;
}
for (var key in obj){
@subzey
subzey / gist:4374329
Created December 25, 2012 17:38
Events handling in WSH + JScript example.
// Create a new InternetExplorer.Application object
// 2nd arg is a prefix for events (any string)
var ie = WScript.CreateObject("InternetExplorer.Application", "ieEvent_");
// Set url
ie.Navigate("about:blank");
// Show window (default state is hidden)
ie.Visible = 1;
// Create specially named function using prefix (that 2nd arg above)
// (OnQuit means when IE window is closed)
@subzey
subzey / index.html
Created December 26, 2012 11:12
A CodePen by subzey.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="-100 -100 200 200">
<desc>pointer-events css property demo</desc>
<ellipse class="ellipse" cx="0" cy="0" rx="70" ry="70"></ellipse>
<rect x="-100" width="200" y="-20" height="40"></rect>
<text x="0" y="-10">Look, Ma!</text>
<text x="0" y="10">Text and rect are clicked thru!</text>
</svg>
<!----><script>
console.log('Foo bar');
//</script>