Skip to content

Instantly share code, notes, and snippets.

View subzey's full-sized avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / index.html
Created February 12, 2013 12:42
A CodePen by subzey. Object.freeze() + arguments - What should happen?
<pre id="log"></pre>
var HEATMAP_ENDPOINT_URL = 'http://screening.nasdaq.com/heatmaps/whhttptunnelisapi.dll?init?server=CPDCOMW42&port=8180&hm=Nasdaq100_v6';
function Nasdaq100 () {
var that = this;
require('http').get(HEATMAP_ENDPOINT_URL, function(stream){
var result = [];
var trailer = '';
function onData(buf){
trailer = (trailer + buf.toString('ascii')).replace(/\|R\|3\|(.*)[\r\n]+|.*[\r\n]+/g, function(_, symbol){
@subzey
subzey / index.html
Created March 19, 2013 11:38
A CodePen by subzey. Chrome inline SVG weird padding - Left offset of SVG "rendering start" point depends on top padding
<div class="wrapper">
<svg xmlns="http://www.w3.org/2000/svg" style="padding: 1px 50px">
<rect x="0" y="0" width="100%" height="100%" fill="yellow" />
</svg>
</div>
<div class="wrapper">
<svg xmlns="http://www.w3.org/2000/svg" style="padding: 0px 50px">
<rect x="0" y="0" width="100%" height="100%" fill="yellow" />
</svg>
</div>
@subzey
subzey / readme.md
Last active February 2, 2026 12:42
Про это

Про это

Как вы называете переменную, когда нужно сохранить this в замыкании?

Вопрос не праздный, ведь это дело даже не личного вкуса, а, скорее, договоренности. В коде проекта, над которым я сейчас активно работаю, можно было с равной степенью вероятности встретить that и self. Через два года разработки, впрочем, баланс заметно сместился в сторону that.

Но знаете, что? И self, и that, и даже _this с me — это очень хреновые названия.

@subzey
subzey / requiem.md
Last active August 29, 2015 13:58
Requiem for a Dragon

Requiem for a Dragon

This is post-mortem for my first JS1K entry, Breath.

Complete, almost per-line, explaination was subitted with uncompressed de-optimized source code. So it's not so "techy", this is something I would share with other coders after few beers in a bar. No code, just thoughts.

The Idea

@subzey
subzey / banner-insert.js
Created April 17, 2014 09:29
Пример асинхронной вставки
(function(){
var allScripts = document.getElementsByName('script');
var link = document.createElement('a');
for (var i=allScripts.length; i--; ){ // старый добрый ECMA 262-3
// Проходим по всем скриптам
var script = allScripts[i];
if (!script.src){
continue;
}
// определяем, подходит ли этот элемент script по его src
@subzey
subzey / readme.md
Last active September 1, 2018 06:08
Games with unusual spacetime

Games with unusual spacetime

2 Dimensions

Desktop puzzle game. Level design resembles Escher's "impossible" drawings and passable path varies depending on where player is located and in which direction he moves.

@subzey
subzey / dson.js
Last active August 29, 2015 14:02
DSON shim
var DSON = DSON || {
parse: function(v) {
return JSON.parse(v.replace(/"(\\"|[^"])*"|[a-z]+/gi, function(v) {
return {
such: '{',
wow: '}',
is: ':',
so: '[',
many: ']',
next: ',',
@subzey
subzey / gist:b18c482922cd17693d65
Last active November 1, 2025 17:50
Few Tricks on Compressing Js13k Entry

Few Tricks on Compressing Js13k Entry

Most important detail: in js13k entry 13k stands for zipped entry size. And this detail makes js13k differ from other code golfing compos.

Last year winner entry uncompressed size was about 70k. 70 kilobytes! In js1k you have a month to minify 1k, so how much time would it take to minify 70k? Nope, you have only 1 month. So it's very unlikely one will manually golf the entry. And this is the other thing that makes js13k special: no hardcore manual "hell yeah I've stripped one byte!" golfing.

@subzey
subzey / toms.js
Created September 27, 2014 08:10
var toMs = (function (){
function _add(a, b){
var v = new Number((a || 0) + (b || 0));
v.milliseconds = milliseconds;
v.seconds = seconds;
v.minutes = minutes;
v.hours = hours;
v.days = days;
return v;
}