Skip to content

Instantly share code, notes, and snippets.

View MatthewCallis's full-sized avatar
🍖
Hungry Goriya

Matthew Callis MatthewCallis

🍖
Hungry Goriya
View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 10, 2024 20:23
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@ilyakmet
ilyakmet / wasmRustNodeExample.md
Last active December 19, 2020 17:38
WASM Rust to Node Example

WASM Rust to Node Example

Use only > 8.x.x NodeJS version

Install Rust before using this tutorial: curl https://sh.rustup.rs -sSf | sh

Create dirs:

mkdir wasmRustNodeExample

cd wasmRustNodeExample
@tcdw
tcdw / read_song.js
Last active April 2, 2019 18:55
Dump song directly from Classic Road II
#!/usr/bin/env node
/*
Classic Road II music ripper
by tcdw
Usage:
1. Get the Classic Road II ROM
2. Get your template SPC file:
2.1. Dump a SPC via your SNES emulator from the game, and hex edit x1F4 to 0x00
@fnky
fnky / ANSI.md
Last active May 3, 2024 00:12
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@digarok
digarok / lz4.s
Created October 29, 2018 15:35
LZ4 65816 decompress special format
* Format is : 2-byte length word followed by compressed stream
MX %00
*-------------------------------------------------------------------------------
LZ4_Unpack STY LZ4_DestOffset+1 ; Y = Destination offset
STX LZ4_HeaderLenByte+1 ; X = Src offset (with 2 byte len header)
STX LZ4_HeaderAddr+1 ; and the address of the offset
STA LZ4_Literal_3+1 ; Uncompress a LZ4 Packed Data buffer (64 KB max)
SEP #$20 ; A = Bank Src,Bank Dst
STA LZ4_Match_5+1 ; X = SRC Byte offset
@littletsu
littletsu / wrapper.js
Created September 18, 2018 05:52
Mini wrapper around discord API. Dependencies: snekfetch, ws. Heavily based in rylib by ry00001 (https://github.com/ry00001)
const fetch = require('snekfetch')
const ws = require("ws")
var logHeartbeat = false
// Weebsocket
get('gateway').then(gateway => {
let weebsocket = new ws(gateway.url)
@HS39
HS39 / asm65816.ccs
Last active February 19, 2022 21:51
//
// 65816 assembly opcodes
//
// Addressing mode tags:
//
// (none) Implied or Accumulator
// _i Immediate
// _8 Immediate, 8-bit register
// _d Direct page
// _di Direct indirect
import asm65816
// Overwrites Teleport Box battle action code
// 0xC2AB71 - 0xC2AC29
define Atk_Fail_Chk = 0xC2AB71 define NPC_Check = 0xC2AB71
define Miss_Calc = 0xC2AB75
define Smash = 0xC2AB79
define Determine_Dodge = 0xC2AB7D
define Level_2_Atk = 0xC2AB81
define Heal_Strangeness = 0xC2AB85
@devinacker
devinacker / exomizer-816.asm
Created July 10, 2018 01:13
WIP (sorta) Exomizer decruncher for SNES / 65c816 (with ca65)
.include "libSFX.i"
.feature force_range
.export Decrunch
/*
Exomizer (raw mode) decruncher for 65c816 / ca65.
by Devin Acker (Revenant/RSE), 2018
For use on SNES, and theoretically other 65c816-based platforms.

iOS restrictions re: bringing up the keyboard on programmatic focus

I can't find exact specifications on this, but it seems that iOS restricts bringing up the keyboard via programmatically focusing on <input>. It only brings up the keyboard in response to explicit user interaction.

  1. iOS focus on input field only brings up keyboard when called inside a click handler.
  2. It doesn’t work if the focus is async.

This presents a curious problem when you want to autofocus an input inside a modal or lightbox, since what you generally do is click on a button to bring up the lightbox, and then focus on the input after the lightbox has been opened. Without anything fancy, it actually works ok. The problem shows up when you try to add something fancy like a setTimeout or a promise.then(). I don't know why people would want to use a setTimeout here, but waiting for a promise is actually a pretty common use case. E.g. we try to batch dom manipulations like getting a lightbox to show up inside `requestAnimati