Skip to content

Instantly share code, notes, and snippets.

View ryangjchandler's full-sized avatar
💭
I may be slow to respond.

Ryan Chandler ryangjchandler

💭
I may be slow to respond.
View GitHub Profile
@GaspardP
GaspardP / sha256.js
Created June 4, 2015 15:21
SHA-256 with Javascript and Web Crypto
// Computes the SHA-256 digest of a string with Web Crypto
// Source: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
function sha256(str) {
// Get the string as arraybuffer.
var buffer = new TextEncoder("utf-8").encode(str)
return crypto.subtle.digest("SHA-256", buffer).then(function(hash) {
return hex(hash)
})
}
@itod
itod / split_keyboards.md
Last active April 25, 2024 16:26
Every "split" mechanical keyboard currently being sold that I know of
@aishikaty
aishikaty / tiny-view-libraries.md
Last active January 1, 2024 02:47
Tiny JavaScript UI

☀️ UI Libraries

  • redom (1.6k) - Tiny turboboosted JavaScript library for creating user interfaces
  • frzr (1.6k) - Turboboosted 2 KB view library for browser & node.js
  • killroy (1.9k) - A tiny ui library inspired by React
  • real-dom (0.7k) - A ~1K non-virtual DOM non-framework framework for simple apps
  • domchanger (1.8k) - Dombuilder that applies diffs only to the real dom
  • vomit (3.2k) - A high order function using virtual dom to build user interfaces
  • bel (3.5k) - A simple library for composable DOM elements using tagged template strings
  • yo-yo (5.4k) - A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals (build on bel)
  • [choo](https://github.com/yos
@gullyn
gullyn / flappy.html
Last active November 28, 2023 18:23
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@owenvoke
owenvoke / readDuration.php
Created May 5, 2021 10:17
A string macro for the duration to read text.
<?php
// From Marcel Pociot's tweet
// See: https://twitter.com/marcelpociot/status/1389881758267625473
Str::macro('readDuration', function (... $text) {
$totalWords = str_word_count(implode(' ', $text));
$minutesToRead = round($totalWords / 200);
return (int) max(1, $minutesToRead);
@rosswintle
rosswintle / build.php
Last active February 8, 2024 20:34
A VERY simple PHP static HTML generator that does a single-level extend, and includes with variable passing and that's about it.
<?php
/*
* Input: files matching src/pages/*.html
* Output: public/*.html
*
* Pages can extend a template by calling:
*
* extend(string $relativeTemplatePath, array $variables)
*
* at the start and: