Skip to content

Instantly share code, notes, and snippets.

View subzey's full-sized avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / readme.md
Last active February 2, 2026 12:42
Про это

Про это

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

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

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

@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 / index.html
Last active July 30, 2025 16:19
Emoji roulette
<!DOCTYPE html>
<html>
<head>
<title>СПГС 2023</title>
<style>
html {
height: 100%;
background: radial-gradient(#fff, #f0f0f0 50%, #aaa) #eee;
}
body {
@subzey
subzey / index.html
Created July 17, 2019 13:36
Adding numbers with WebGL2 Transform Feedback
<!doctype html>
<html>
<head>
<title>Adding numbers with WebGL2 Transform Feedback</title>
</head>
<body>
<h1>Adding numbers with WebGL2 Transform Feedback.</h1>
<output></output>
<script src="webgl.js"></script>
<p>View <a href="webgl.js">the commented source</a>!</p>
@subzey
subzey / index.html
Created January 12, 2017 17:14
Unclosed CSS
<body>
<style>
@media all {
body {
background: url('data:image/gif;base64,\
R0lGODdhEAAQAKECAAAAAP8AAP///////ywAAAAAEAAQAAACGkyEqWi3z6CctNorALha2759IUaWJuRYjRoUADs=
@subzey
subzey / LICENSE.txt
Created March 22, 2012 22:32 — forked from 140bytes/LICENSE.txt
CSS selector specificity
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 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
function distanceBetweenPoints(p1, p2) {
return Math.hypot(p1.x - p2.x, p1.y - p2.y);
}
function closestPoints(points) {
let closestPoints = [];
let smallestDistance = Infinity;
for (let i = 1; i < points.length; i++) {
for (let j = 0; j < i; j++) {
@subzey
subzey / index.html
Created January 31, 2019 13:29
Resize debug
<!DOCTYPE html>
<html>
<head>
<title>Screen size debug</title>
</head>
<body>
<script>
function log(s){
var logEntry = document.createElement('pre');
logEntry.textContent = (new Date().toISOString() + ' ' + s);
@subzey
subzey / index.html
Created November 13, 2019 13:43
iframe autoplay
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<script>
function playSound() {
var ifr = document.createElement('iframe');
ifr.allow = 'autoplay';
#!/usr/bin/env node
const { createServer } = require('http');
function serveStatic(req, res) {
res.writeHead(200, {
'Content-Type': 'text/html;charset=utf-8',
});
res.end(`
<!doctype html>