Skip to content

Instantly share code, notes, and snippets.

@DATADEER
DATADEER / type-helpers.ts
Last active January 29, 2025 13:18
All kinds of useful type helpers
/**
* Extracts the type of values in an object or array
*
* @example
* type Colors = {
* primary: string;
* secondary: string;
* };
*
* type ColorValue = ValueOf<Colors>; // string
@DATADEER
DATADEER / find-matching-deps.js
Created June 15, 2024 09:31
Find NPM Package Versions explicitly mention another package in their peer dependencies
const { exec } = require("child_process");
const semver = require("semver");
const { program } = require("commander");
// Define the command-line arguments using commander
program
.option("--upgrade <package>", "The package to upgrade")
.option("--required <dependency>", "The required version of the dependency");
program.parse(process.argv);
@DATADEER
DATADEER / open llamalife
Created January 25, 2023 16:25
open llamalife
tell application "Finder"
set _bounds to bounds of window of desktop
set _height to item 4 of _bounds
end tell
tell application "Safari"
make new document at end of documents with properties {URL:"https://llamalife.co/tasks"}
set bounds of front window to {0, 0, 300, _height}
end tell
@DATADEER
DATADEER / Editor Config Changes Godot on Restart
Last active January 8, 2023 15:32
This is how the editor config changes on macos after setting the keyboard shortcut for "Project" to F5
[gd_resource type="EditorSettings" load_steps=7 format=3]
[sub_resource type="InputEventKey" id="InputEventKey_royfo"]
physical_keycode = 84
[sub_resource type="InputEventKey" id="InputEventKey_4gnok"]
meta_pressed = true
physical_keycode = 84
[sub_resource type="InputEventKey" id="InputEventKey_xxe3q"]
@DATADEER
DATADEER / Force Godot Docs to Godot 4 and english
Last active December 23, 2022 07:57
Redirects all requests to godot docs to the english / latest version (Godot 4)
// ==UserScript==
// @name Force Godot Docs to latest english
// @namespace http://tampermonkey.net/
// @version 0.1
// @description When opening the godot docs, always show the page in english and the latest version
// @author DATADEER
// @match https://docs.godotengine.org/*
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Godot_icon.svg/2048px-Godot_icon.svg.png
// @grant none
// ==/UserScript==
{
"title": "SHIFT ARROWS",
"rules": [
{
"description": "SHIFT LEFT_ARROW",
"manipulators": [
{
"type": "basic",
"from": {
"modifiers": {
{
"title": "OPTION ARROWS",
"rules": [
{
"description": "OPTION LEFT_ARROW",
"manipulators": [
{
"type": "basic",
"from": {
"modifiers": {
{
"title": "COMMAND ARROWS",
"rules": [
{
"description": "COMMAND LEFT_ARROW",
"manipulators": [
{
"type": "basic",
"from": {
"modifiers": {
{
"%%true": {
"%function": {
"name": "canReadWritePartition",
"arguments": [
"%%partition"
]
}
}
}
@DATADEER
DATADEER / lock_pdf.sh
Last active November 24, 2020 12:52
Locks a pdf with a custom (owner) password via pdftk. ONLY LOCKS EDITING.
#!/bin/sh
# Locks a pdf with a custom password via pdftk.
# ONLY LOCKS EDITING. CAN STILL BE OPENEND WITHOUT PASSWORD
# HOW TO:
# pdftk has to be globally accessible. https://www.pdflabs.com/
# run sh lock.sh [filename_without_filetype] [password]
filename=$1
password=$2
echo locking "$filename".pdf &&