Skip to content

Instantly share code, notes, and snippets.

View D1360-64RC14's full-sized avatar
👨‍💻
Learning

Diego Garcia D1360-64RC14

👨‍💻
Learning
View GitHub Profile
@D1360-64RC14
D1360-64RC14 / index.php
Last active June 13, 2025 16:19
Example of how easy can be creating memoizeble/lazy-initializable attributes using PHP 8.4's property Hooks.
<?php
function LOGOP($value, ?string $identifier = null)
{
echo 'LOGOP';
echo $identifier ? "($identifier)" : '';
echo ': ' . (string) $value . "\n";
return $value;
}
@D1360-64RC14
D1360-64RC14 / index.js
Last active May 19, 2025 14:11
if, for some reason, all images in the Discord Support Forum doesn't load, you can try executing this script in the console. There's a chance of it not working -- because technologies update every time --, but you can give it a try. Have a good day!
function easyCreateElement(name, attrs = {}) {
const el = document.createElement(name);
for (const [k, v] of Object.entries(attrs)) {
el.setAttribute(k, v instanceof Element ? v.getAttribute(k) : k);
}
return el;
}
@D1360-64RC14
D1360-64RC14 / php.ini
Last active February 5, 2025 12:45
My development configurations for PHP.ini
# If installed throught `pecl install xdebug`
# zend_extension="<php lib path [/opt/local/lib/php]>/extensions/no-debug-zts-20240924/xdebug.so"
[XDebug]
# -- Debugging
xdebug.mode="debug"
xdebug.start_with_request="trigger"
# -- Profilling
# xdebug.mode="profile"
@D1360-64RC14
D1360-64RC14 / LowerYourVolumeWithMe.js
Last active February 1, 2025 06:23
Lower Your Volume with Me, websites!
// ==UserScript==
// @name Lower Your Volume with Me
// @namespace http://tampermonkey.net/
// @version 2025-01-31
// @description Lower Your Volume with Me
// @author You
// @match *://*/*
// @exclude https://*.youtube.com/watch*
// @icon https://www.google.com/s2/favicons?sz=64&domain=instagram.com
// @require https://cdn.jsdelivr.net/gh/vanjs-org/mini-van@latest/public/mini-van-latest.nomodule.min.js
@D1360-64RC14
D1360-64RC14 / ArrayRemapper.php
Last active January 13, 2025 13:16
Create a remap object that maps an input array to an output array by a given schema. Requires minimum PHP 8.1.
<?php
/**
* Create a remap object that maps an input array to an output array by a given
* schema.
*
* The schema is an array of `key`-`value` pairs, or a `string` value, where the
* `key` is the key from the input array and the `value` is the key to be mapped
* to in the output array. If a `string` is given, the value will be passed-through.
*
@D1360-64RC14
D1360-64RC14 / easy-picsum.html
Created November 16, 2024 05:42
An easy Lorem Picsum editor through data URL
<!-- data:text/html;base64,PHNjcmlwdCBzcmM9Imh0dHBzOi8vdW5wa2cuY29tL3BldGl0ZS12dWUiIGRlZmVyIGluaXQ+PC9zY3JpcHQ+PGRpdiB2LXNjb3BlPSJ7dzo4MDAsIGg6ODAwfSIgc3R5bGU9ImRpc3BsYXk6IGlubGluZS1ibG9jayI+PGZpZWxkc2V0PjxsZWdlbmQ+RWFzeSBQaWNzdW0gLSBDb25maWd1cmF0aW9uPC9sZWdlbmQ+PHRhYmxlIHN0eWxlPSJ3aWR0aDogMTAwJSI+PHRyPjx0ZCBzdHlsZT0id2lkdGg6IDAiPldpZHRoOjwvdGQ+PHRkPjxpbnB1dCB0eXBlPSJudW1iZXIiIHYtbW9kZWw9InciIG1pbj0iMSIgc3R5bGU9IndpZHRoOiAxMDAlIj48L3RkPjwvdHI+PHRyPjx0ZCBzdHlsZT0id2lkdGg6IDAiPkhlaWdodDo8L3RkPjx0ZD48aW5wdXQgdHlwZT0ibnVtYmVyIiB2LW1vZGVsPSJoIiBtaW49IjEiIHN0eWxlPSJ3aWR0aDogMTAwJSI+PC90ZD48L3RyPjx0cj48dGQgc3R5bGU9IndpZHRoOiAwIj5VUkw6PC90ZD48dGQ+PGlucHV0IHJlYWRvbmx5IHYtbW9kZWw9ImBodHRwczovL3BpY3N1bS5waG90b3MvJHt3fS8ke2h9YCIgc3R5bGU9IndpZHRoOiAxMDAlIj48L3RkPjwvdHI+PC90YWJsZT48L2ZpZWxkc2V0PjxmaWVsZHNldD48aW1nIDpzcmM9ImBodHRwczovL3BpY3N1bS5waG90b3MvJHt3fS8ke2h9YCIgc3R5bGU9Im1heC13aWR0aDogOTB2dzsgbWF4LWhlaWdodDogODV2aCI+PC9maWVsZHNldD48L2Rpdj4= -->
<script src="https://unpkg.com/petite-vue" defer init></script>
<div v-
@D1360-64RC14
D1360-64RC14 / index.js
Created March 15, 2024 17:53
Hello Wold!
console.log("Hello World!")
@D1360-64RC14
D1360-64RC14 / golang-update.sh
Last active December 16, 2023 20:59
Update golang with only one command. REQUIRED program "jq".
#!/bin/bash
LAST_VERSION_NUMBER=$(curl -s "https://go.dev/dl/?mode=json" | jq ".[0].version" | sed 's/"//g' | sed 's/go//')
DOWNLOAD_URL="https://go.dev/dl/go${LAST_VERSION_NUMBER}.linux-amd64.tar.gz"
BASE_DIR="/opt/go"
FOLDER_NAME="go-${LAST_VERSION_NUMBER}"
UNPACK_DST="${BASE_DIR}/${FOLDER_NAME}"
if [ -d "${UNPACK_DST}" ]; then
echo "Already installed last version ${LAST_VERSION_NUMBER}!"
@D1360-64RC14
D1360-64RC14 / extension.js
Created December 7, 2023 13:24
HTMX Extension class boilerplate
import htmx from "htmx.org";
class ExtensionName {
/** @private @type {WeakMap<HTMLElement, ExtensionName>} */
static _elementInstances = new WeakMap();
/** @private @type {HTMLElement} */ _rootElement;
/**
* @param {HTMLElement} element
@D1360-64RC14
D1360-64RC14 / git-pushme
Last active March 25, 2025 14:09
Git commands to automate repetitive tasks. Store then in a directory accessible by PATH and do `git <command>`, like `git spull`.
#!/bin/bash
# Push setting current branch as default upstream
git push -u origin $(git branch --show-current)