Skip to content

Instantly share code, notes, and snippets.

View oze4's full-sized avatar
♠️
👋

Matt Oestreich oze4

♠️
👋
View GitHub Profile
@oze4
oze4 / 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();
@oze4
oze4 / json_treeview.ps1
Last active January 30, 2024 00:21
JSON TreeView - Extended
function Show-JsonTreeView {
param (
[Parameter(Mandatory)]
$Json
)
function Show-jsonTreeView_psf {
#----------------------------------------------
@oze4
oze4 / House.ps1
Created July 30, 2021 18:46
House
class House {
# Lower case bc private
hidden [Room[]]$rooms
# Constructor (PoSH support overloading, which is huge)
House() {
$this.rooms = Room[];
}
# [Room[]] means our return type is an array of Rooms
@oze4
oze4 / DOMRegex.js
Last active March 16, 2023 23:30
Essentially querySelectorAll with regex support. Modified from: https://stackoverflow.com/a/62144522
/**
* @plug
* DOMRegex.js
* https://mattoestreich.com
*
* @description
* Modified from: https://stackoverflow.com/a/62144522
* TLDR; querySelectorAll with regex support
*
* @important
@oze4
oze4 / v-cloak.css
Created February 9, 2019 23:55
v-cloak for vue.js loading
[v-cloak] {
display: block;
padding: 50px 0;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
@oze4
oze4 / Show-JsonTreeView.ps1
Created November 7, 2019 02:10
Displays JSON Data in TreeView
function Show-JsonTreeView {
param (
[Parameter(Mandatory)]
$Json
)
function Show-jsonTreeView_psf {
#----------------------------------------------
@oze4
oze4 / arena-macos-fixes.sh
Created April 30, 2022 05:31 — forked from april/arena-macos-fixes.sh
Fixes Magic Arena's broken full screen implementation on macOS
# this forces Arena into full screen mode on startup, set back to 3 to reset
# note that if you go into the Arena "Graphics" preference panel, it will reset all of these
# and you will need to run these commands again
defaults write com.wizards.mtga "Screenmanager Fullscreen mode" -integer 0
defaults write com.wizards.mtga "Screenmanager Resolution Use Native" -integer 0
# you can also replace the long complicated integer bit with any other scaled 16:9
# resolution your system supports.
# to find the scaled resolutions, go to System Preferences --> Display and then
# divide the width by 16 and multiple by 9. on my personal system this ends up
def run():
i = input("enter 20 numbers separated by spaces: ")
iList = i.split(" ")
validate_input(iList, 20)
nums = list_str_to_list_int(iList)
return calculate_sum(nums)
def validate_input(strList, expectedTotal):
l = len(strList)
if l != expectedTotal: