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 / install-go.sh
Last active September 7, 2025 20:44
Download and install golang version into /opt/go folder. Supports version managing though alternatives command.
#!/bin/env bash
set -e
DOWNLOAD_URL='https://go.dev/dl/go1.25.1.linux-amd64.tar.gz'
# goM.mm.ff.linux-amd64.tar.gz
GOLANG_TAR_GZ="$(basename $DOWNLOAD_URL)"
# goM.mm.ff.linux-amd64
GOLANG="$(basename $GOLANG_TAR_GZ .tar.gz)"
@D1360-64RC14
D1360-64RC14 / README.md
Created August 25, 2025 18:34
PHP 8.4 -- Benchmark between `get_class()` vs `instanceof`.

PHP 8.4 -- Benchmark of get_class() vs instanceof.

Result from onlinephp.io (link w/ code):

float(0.5350112915039062)
float(0.308990478515625)
float(0.5180835723876953)
float(0.2639293670654297)
float(0.5099773406982422)
@D1360-64RC14
D1360-64RC14 / unwrapE.php
Last active August 21, 2025 19:21
Function to unwrap scientific notation into float number. Made with PHP 8.4.3.
<?php
function unwrapE(float $value)
{
$strVal = strval($value);
if (!str_contains($strVal, 'E')) {
return $strVal;
}
@D1360-64RC14
D1360-64RC14 / rm-useless-gitkeeps.sh
Created July 25, 2025 19:24
Delete all .gitkeeps within a folder already with files.
for ign in $(find . -name '.gitkeep' ! -path './vendor/*'); do
if [[ $(ls $(dirname $ign) | wc -l | tr -d ' ') > 0 ]]; then
rm $ign
fi;
done
@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-