Skip to content

Instantly share code, notes, and snippets.

@LeoDog896
LeoDog896 / types.ts
Created November 22, 2023 16:16
strict map and filter types
interface Array<T> {
map<U>(
callbackfn: (value: T, index: number, array: T[]) => U,
thisArg?: unknown
): { [K in keyof this]: U };
filter<S extends T>(
callbackfn: (value: T, index: number, array: T[]) => value is S,
thisArg?: unknown
): { [K in keyof this]-?: this[K] extends S ? S : never }
}
@LeoDog896
LeoDog896 / starship.toml
Created December 31, 2022 19:47
my starship config that i blatantly stole from someone else thanks kiel
format = """
[┌](bold green)$status$cmd_duration$fill
[│ ](bold green)$hostname$localip$time$nix_shell
[│ ](bold green)$java$kotlin$rust$golang$python
[│ ](bold green)$sudo$username$directory$package$git_branch$git_commit$git_state
[└─>](bold green) """
[fill]
symbol = "─"
@LeoDog896
LeoDog896 / parcel-init.sh
Created December 31, 2022 00:11
parcel-init
JSON=$(cat <<EOF
{
"private": true,
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --public-url ./",
"format": "prettier --write ."
},
"dependencies": {
@LeoDog896
LeoDog896 / README.md
Created December 16, 2022 17:17
How to clear HSTS settings from chrome
  1. Navigate to chrome://net-internals/#hsts

  2. Go to Query HSTS/PKP domain and ensure that the domain exists (ex github.com or google.com).

  3. Scroll down to Delete domain security policies and enter that domain

Finished!

@LeoDog896
LeoDog896 / index.ts
Last active August 5, 2022 15:38
Recursively read a directory in Deno
import { join } from "https://deno.land/std/path/mod.ts";
export async function* recursiveReaddir(
path: string
): AsyncGenerator<string, void> {
for await (const dirEntry of Deno.readDir(path)) {
if (dirEntry.isDirectory) {
yield* recursiveReaddir(join(path, dirEntry.name));
} else if (dirEntry.isFile) {
yield join(path, dirEntry.name);
@LeoDog896
LeoDog896 / CameraMovement.gd
Created July 22, 2022 15:50
Camera transition
extends Camera
export var target: Transform
# If the transition is active
export var active := true
# Strength of the transition
export var strength: float = 1
# The "from" transition to transition from
onready var starting_transform := self.transform
var time: float = 0.0
func _physics_process(delta: float) -> void:
@LeoDog896
LeoDog896 / Cargo.toml
Created July 11, 2022 23:39
Small WebRTC-rs example
[package]
name = "rs-example"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
webrtc = "0.4.0"
tokio = { version = "1.15.0", features = ["full"] }
@LeoDog896
LeoDog896 / README.md
Last active June 3, 2022 11:25
# Weird `no-pre-gyp` errors? Do this!

Simply do npm i -g request node-pre-gyp and it'l be fixed!

@LeoDog896
LeoDog896 / README.md
Created February 26, 2022 19:53
No drive found (linux installer)? Try this!

Find a SATA Operations option in your BIOS, and change it from RAID to SATA (NOT None).

@LeoDog896
LeoDog896 / types.ts
Created February 17, 2022 13:45
Detailed TypeScript definitions designed to align with the schema.
type DisplayType = "fullscreen" | "standalone" | "minimal-ui" | "browser"
interface WebManifest {
background_color?: string;
categories?: string[];
description?: string;
dir?: "ltr" | "rtl" | "auto"
display?: DisplayType;
display_override?: [DisplayType];
iarc_rating_id?: string;