Skip to content

Instantly share code, notes, and snippets.

View donatj's full-sized avatar
☕
Getting back to business

Jesse Donat donatj

☕
Getting back to business
View GitHub Profile
@donatj
donatj / ziphash.php
Last active November 13, 2026 16:14
Test for Hashing GitHub Zip Contents
<?php
$zipFiles = [
'phpstan.zip' => 'https://github.com/phpstan/phpstan/archive/refs/tags/2.3.0.zip',
'google-cloud.zip' => 'https://github.com/googleapis/google-cloud-php/archive/refs/tags/v0.352.0.zip',
'magento.zip' => 'https://github.com/magento/magento2/archive/refs/tags/2.4.9.zip',
'wordpress.zip' => 'https://github.com/WordPress/WordPress/archive/refs/tags/7.1.4.zip',
'google-api-client.zip' => 'https://github.com/googleapis/google-api-php-client-services/archive/refs/tags/v0.466.0.zip',
'microsoft-graph.zip' => 'https://github.com/microsoftgraph/msgraph-sdk-php/archive/refs/tags/v3.10.0.zip',
'mpdf.zip' => 'https://github.com/mpdf/mpdf/archive/refs/tags/v8.3.1.zip',
@donatj
donatj / RFC.md
Last active July 27, 2026 18:29
WIP: PHP `catchAny` RFC Proposal

PHP catchAny RFC Proposal

Go does not have exceptions. It has errors. Errors are returned rather than thrown, and they do not inherently capture a stack trace.

Go errors can also wrap other errors. This is broadly similar to a PHP exception accepting a previous exception:

throw new RuntimeException('Operation failed', previous: $e);
@donatj
donatj / main.go
Created March 19, 2024 21:27 — forked from brandon-braner/main.go
my attempt at processing a large csv
package main
import (
"database/sql"
"encoding/csv"
"fmt"
"io"
"log"
"os"
"sync"
@donatj
donatj / cube.py
Last active August 12, 2022 21:53
Micropython Spinning Cube
import math
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
i2c=I2C(1,sda=Pin(26), scl=Pin(27), freq=400000)
oled = SSD1306_I2C(128, 64, i2c)
class Point3D :
x = 0;
y = 0;
fileInput.addEventListener('input', function(){
fileInput.files[0].arrayBuffer().then(function(x){
const data = new Uint8Array(x[0]);
// send the data to Go (it only accepts bytes as Uint8Array's
})
});
@donatj
donatj / example.go
Last active January 4, 2023 02:43
Read File Inputs from Go WASM (used in https://donatstudios.com/Read-User-Files-With-Go-WASM)
package main
import (
"syscall/js"
)
func main() {
quit := make(chan struct{}, 0)
document := js.Global().Get("document")
@donatj
donatj / index.html
Created January 27, 2022 17:29
Simple Gif Play/Pause
<html>
<body>
<img src="tumblr_ngqdgj3vqt1sulnzno1_500.gif">
<img src="tumblr_ngqdgj3vqt1sulnzno1_500.gif" width="100">
<img src="tumblr_ngqdgj3vqt1sulnzno1_500.gif" style="width: 30px; height: 200px;">
<br>
<button onclick="play()">Play</button>
<button onclick="pause()">Pause</button>
@donatj
donatj / subtitles.php
Last active October 10, 2025 06:59
Crappy .srt helper
#!/usr/bin/env php
<?php
date_default_timezone_set('UTC');
$stderr = fopen('php://stderr', 'wb');
$shift = 0.0;
switch( $argv[1] ?? '' ) {
case 'shift':
@donatj
donatj / get-dependencies.sh
Created April 14, 2020 21:43
Recursively get every dependency and version from package-lock.json
cat package-lock.json | jq -r '.. | select(.>={}) | .dependencies | select(. != null) | to_entries[] | .key + ": " + .value.version' | sort | uniq

TypeScript

class MyLogicContainer {
    constructor(private x: number) { }
    
    add(y: number) {
        return this.x + y;
    }
}