Skip to content

Instantly share code, notes, and snippets.

View subzey's full-sized avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / index.js
Last active November 22, 2017 17:02
Concatenated gzip test
#!/usr/bin/env node
var http = require('http');
var os = require('os');
var url = require('url');
var zlib = require('zlib');
var buf1 = zlib.gzipSync('Conca');
var buf2 = zlib.gzipSync('tenated');
var port = 8080;
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
body {
background: #f5f6f7;
display: flex;
flex-flow: wrap;
justify-content: center;
@subzey
subzey / 4SHENkXy_mid.jpg
Last active October 20, 2017 16:20
jpeg skeletons
4SHENkXy_mid.jpg
@subzey
subzey / index.html
Last active October 19, 2017 18:02
2x images
<h2>100%</h2>
<p><strong>129 585</strong> PNG, 1x<br><img src="oeOGvICT_mid.png" width="466" height="275"><br>
<p><strong>90 931</strong> PNG, 2x pngquant<br><img src="oeOGvICT_mid-2x-fs8.png" width="466" height="275"><br>
<p><strong>44 510</strong> WebP, 2x 70% q<br><img src="oeOGvICT_mid-2x.webp" width="466" height="275"><br>
<h2>200%</h2>
<p><strong>129 585</strong> PNG, 1x<br><img src="oeOGvICT_mid.png" width="932" height="550"><br>
<p><strong>90 931</strong> PNG, 2x pngquant<br><img src="oeOGvICT_mid-2x-fs8.png" width="932" height="550"><br>
<p><strong>44 510</strong> WebP, 2x 70% q<br><img src="oeOGvICT_mid-2x.webp" width="932" height="550"><br>
@subzey
subzey / index.js
Last active November 21, 2017 16:56
Spiraling Braille
#!/usr/bin/env node
if (!process.stdout.isTTY) {
process.stderr.write('stdout is not a terminal');
process.exit(1);
}
const clearScreenSeq = '\u001b[H\u001b[2J';
const clearScreenSeqLen = Buffer.byteLength(clearScreenSeq);
const maths = (x, y, now, tie) => {
@subzey
subzey / index.js
Last active September 20, 2017 15:49
var myStrictFunction = function(){
"use strict";
console.log('strict', this);
};
var myLooseFunction = function(){
console.log('loose', this);
};
[myStrictFunction, myLooseFunction].map(function(fn){
@subzey
subzey / readme.md
Created August 17, 2017 15:23
About devicePixelRatio

devicePixelRatio is an amount of device pixels in a css pixel, in one dimension.

For example, devicePixelRatio = 2 means, 2 x 2 = 4 device pixels acts as one css pixel.

It depends both on physical device properties ("retina") and a page scaling set in browser.

Here's a top-10:

devicePixelRatio Percentage Comment
(module
(memory 1)
(func (export "duplicateText") (param $ptr i32)
(local $len i32)
(local $max i32)
(loop $continueLen
(if
(i32.load8_u
(i32.add (get_local $ptr) (get_local $len))
)
@subzey
subzey / electron-app.js
Last active June 7, 2017 10:22
Electron rasterizer test
const { BrowserWindow, app } = require('electron');
const imagePath = require('url').format({
protocol: 'file',
slashes: true,
pathname: require('path').join(__dirname, 'emoji_1f61c.svg')
});
app.once('ready', () => {
const win = new BrowserWindow({ show: false });
find . -name "package.json" -not -path "*/node_modules/*" | while read d; do (cd `dirname $d`; pwd; npm prune; npm update); done