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 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>
<!doctype html>
<html>
<head>
<title>New window open test</title>
</head>
<body>
<button id="openwnd">Open a new window</button>
<script>
function openTab(url) {
const a = document.createElement('a');
@subzey
subzey / index.html
Last active March 30, 2023 18:00
Login 200 error
<!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 March 30, 2023 17:59
BlinkStick WebHID
<!doctype html>
<html>
<head></head>
<body>
<script>
async function getBlinkStick() {
const vendorId = 0x20a0;
const productId = 0x41e5;
const devices = await navigator.hid.getDevices();