Skip to content

Instantly share code, notes, and snippets.

View matthewoestreich's full-sized avatar
♠️
👋

Matt Oestreich matthewoestreich

♠️
👋
View GitHub Profile
alert("Wizer");
@matthewoestreich
matthewoestreich / sqlite.sql.zip
Created February 17, 2025 17:50
Uploaded via script @ Mon, 17 Feb 2025 17:50:39 GMT UTC
This file has been truncated, but you can view the full file.
@matthewoestreich
matthewoestreich / sqlite.sql.gz
Created February 16, 2025 23:59
Testing .gz as Gist.
This file has been truncated, but you can view the full file.
import React, { useReducer, useState } from 'react';
interface Message {
from: string;
message: string;
}
interface ChatState {
messages: Message[] | null;
}
@matthewoestreich
matthewoestreich / solution.js
Created November 4, 2024 00:59
Training on Warcraft Series I
function generateEmptyPathArray(pathLength) {
let path = ["M"];
for (let i = 1; i < pathLength-1; i++) {
path.push(".");
}
path.push("B");
return path;
}
function simulateMining(path, time) {
@matthewoestreich
matthewoestreich / slice_filter.go
Created August 13, 2024 02:58
Generic slice filter in Go with similar behavior to `[].filter((i, e) => bool)` in JS.
type filterFunc[T any] func(int, T) bool
func filter[T any](arr []T, fn filterFunc[T]) []T {
filtered := []T{}
for i, e := range arr {
if fn(i, e) {
filtered = append(filtered, e)
}
}
return filtered
const https = require("https");
const querystring = require("querystring");
const fs = require("fs");
const path = require("path");
(async () => {
// Root of json file should be an array..
// []
const LOG_FILE_PATH = path.resolve(__dirname, "./log.json");
@matthewoestreich
matthewoestreich / triggerInputChange.js
Created April 17, 2024 04:56
Programmatically set input on React rendered DOM elements.
/**
* Programmatically set input.
* https://stackoverflow.com/a/72014541/10431732
*
* @param {HTMLElement} node
* @param {String} value
* @example - You would use it like this:
const textarea = document.querySelector("textarea");
const submitButton = document.querySelector('button[aria-label="Submit"]');
const TEXT_TO_TYPE = "hello, world!";
<blockquote class="tiktok-embed" cite="https://www.tiktok.com/@scout2015/video/6718335390845095173" data-video-id="6718335390845095173" style="max-width: 605px; min-width: 325px">
<section>
<a target="_blank" title="@scout2015" href="https://www.tiktok.com/@scout2015?refer=embed">@scout2015</a> Scramble up ur name &#38; I’ll try to guess it😍❤️ <a title="foryoupage" target="_blank" href="https://www.tiktok.com/tag/foryoupage?refer=embed">#foryoupage</a>
<a title="petsoftiktok" target="_blank" href="https://www.tiktok.com/tag/petsoftiktok?refer=embed">#petsoftiktok</a> <a title="aesthetic" target="_blank" href="https://www.tiktok.com/tag/aesthetic?refer=embed">#aesthetic</a>
<a target="_blank" title="♬ original sound - tiff" href="https://www.tiktok.com/music/original-sound-6689804660171082501?refer=embed">♬ original sound - tiff</a>
</section>
</blockquote>
<script async src="https://www.tiktok.com/embed.js"></script>
Client-Side: client side: import React, { useState } from "react";
function VideoButton() {
const [downloadLink, setDownloadLink] = useState(null);
const [videoName, setVideoName] = useState(null); // State to store the video file name
const uploadFile = (event) => {
const file = event.target.files[0];
if (file) {
const formData = new FormData();