Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Khlynovskiy subzey

View GitHub Profile
@subzey
subzey / favicon.svg
Last active Jun 23, 2021
Chrome 91 SVG favicon test
View favicon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View favicon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View index.html
<!doctype html>
<html>
<head><title>rAF fps</title></head>
<body>
<output id="fps"></output>
<script>
const outputText= document.querySelector('#fps').appendChild(document.createTextNode(''));
let prev = -Infinity;
let count = 0;
requestAnimationFrame(function frame(now) {
@subzey
subzey / index.html
Last active May 12, 2021
BlinkStick WebHID
View index.html
<!doctype html>
<html>
<head></head>
<body>
<script>
async function getBlinkStick() {
const vendorId = 0x20a0;
const productId = 0x41e5;
const devices = await navigator.hid.getDevices();
View linestat.js
import { createReadStream } from 'fs';
async function * splitLines(inputStream) {
let carry = '';
for await (const chunk of inputStream) {
const lines = (carry + chunk).split('\n');
carry = lines.pop();
yield * lines;
}
@subzey
subzey / index.html
Last active Dec 15, 2020
Login 200 error
View index.html
<!doctype html>
<html>
<head><title>Login status demo</title></head>
<body>
<fieldset>
<legend>Псевдо-логинка</legend>
<form id="loginform">
<p><label><input name="user" type="input"> Логин</label></p>
<p><label><input name="password" type="password"> Пароль</label></p>
<p><input type="submit"></p>
@subzey
subzey / index.html
Last active Dec 10, 2020
Svg use & canvas path2d
View index.html
<html>
<head>
<style>
svg, canvas { outline: black 1px dotted }
</style>
</head>
<body>
<h2>SVG &lt;use&gt;</h2>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="100" width="120"><use xlink:href="tv-heart.svg#heart"/></svg>
<h2>Canvas Path2D</h2>
@subzey
subzey / cli.js
Last active Oct 28, 2020
cache-control
View cli.js
#!/usr/bin/env node
import { createServer } from 'http';
import { readFile } from 'fs/promises';
import { resolve } from 'path';
import { parse, fileURLToPath } from 'url';
const ALIGNMENT = 60000; // ms
const TTL = 80000; // ms
View index.js
#!/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>
@subzey
subzey / index.html
Last active Jun 29, 2020
new window right away
View index.html
<!doctype html>
<html>
<head>
<title>New window right away open test</title>
</head>
<body>
<button id="openwnd">Open a new window</button>
<script>
const pageTemplate = '<h1>Loading...</h1>';