Skip to content

Instantly share code, notes, and snippets.

View theking2's full-sized avatar
🎯
contemplating the odds

Johannes kingma theking2

🎯
contemplating the odds
View GitHub Profile
@theking2
theking2 / git-clone.reg
Created April 18, 2024 13:14
Clone here
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\git-clone]
@="Clone here"
[HKEY_CLASSES_ROOT\Directory\shell\git-clone\command]
@="Powershell -NoProfile -Command \"Set-Location -LiteralPath '%V' ; git clone $(Get-Clipboard)\""
@theking2
theking2 / sql
Created March 30, 2024 16:10
BIN_TO_UUID
CREATE FUNCTION `BIN_TO_UUID`(b binary(16))
RETURNS char(36) CHARSET ascii
BEGIN
DECLARE hexStr CHAR(32);
SET hexStr = HEX(b);
RETURN LOWER(CONCAT(
SUBSTR(hexStr, 25, 12), '-',
SUBSTR(hexStr, 21, 4), '-',
SUBSTR(hexStr, 13, 4), '-',
SUBSTR(hexStr, 17, 4), '-',
@theking2
theking2 / sql
Created March 30, 2024 16:09
UUID_TO_BIN
CREATE FUNCTION `UUID_TO_BIN`(uuid char(36))
RETURNS binary(16)
BEGIN
RETURN UNHEX( CONCAT(
SUBSTRING(uuid, 25, 12),
SUBSTRING(uuid, 20, 4),
SUBSTRING(uuid, 15, 4),
SUBSTRING(uuid, 10, 4),
SUBSTRING(uuid, 1, 8)
));
@theking2
theking2 / gist:c31ba732ccc7c8bc8bc08b037d40c4f3
Created February 5, 2024 19:30
HTTP - Responses Methods
| method | response code | reason |
| - | - | - |
| * | 500 | internal error, the request is not processd, the response paylood might include more detail |
| * | 502 | request validated but upstream service were not available. Request was not fullfilled|
| * | 405 | request not validated or allowed |
| * | 403 | the request validated but was not allwowed, reason in payload |
| HEAD | 200 | success |
| POST | 201 | rsourcce created,payload contains the id and a identifying url |
| POST | 303 | resource is availabel unique url|
@theking2
theking2 / settings.inc.php
Created January 27, 2024 16:14
php settings
<?php
if( !defined( 'ROOT' ) ) {
define( 'ROOT', $_SERVER[ 'DOCUMENT_ROOT'] . '/' );
}
if(!defined( 'SETTINGS_FILE' ) ) {
define('SETTINGS_FILE', ROOT . 'settings.ini' );
}
if( !defined( 'SETTINGS') ) {
@theking2
theking2 / notify.js
Last active January 27, 2024 11:01
JS Notification
class Notifier
{
construct( title ) {
this.title = title;
};
askNotificationPermission() {
function handlePermission(permission) {
if (!('permission' in Notification)) {
Notification.permission = permission;
}
@theking2
theking2 / gist:fe206ad6377cfed97b92b6a2ae336051
Created January 1, 2024 19:39
Calculate storage of DECIMAL(m,d)
Storage of `DECIMAL(_m_,_d_)` can be calculated with this function:
```sql
DELIMITER $$
CREATE FUNCTION `fn_DECIMAL_SIZE`(`M` INT, `D` INT) RETURNS int(11)
DETERMINISTIC
BEGIN
set @m = m;
set @d = d;
const style = document.createElement('style');
document.haad.appendChild(style);
const styleSheet = style.sheet;
styleSheet.insertRule('h1{font-size:123px;}');
/* DEVSENSE */
"[php]": {
"editor.defaultFormatter": "DEVSENSE.phptools-vscode"
},
"php.format.codeStyle": "PSR-2",
"php.format.rules.arrayInitializersNewLineAfterLastElement": true,
"php.format.rules.callParametersNewLineBeforeRightParen": true,
"php.format.rules.spaceBeforeColonInControlStatements": true,
@theking2
theking2 / gist:f12f45afb40209e8262ac583032ebdea
Created April 3, 2023 11:37
wordpress-mariadb-phpmyadmin
version: "3"
# Defines which compose version to use
services:
# Services line define which Docker images to run. In this case, it will be MySQL server and WordPress image.
db:
image: mariadb:10.4
restart: always
environment:
MARIADB_ROOT_PASSWORD: MyR00tMySQLPa$$5w0rD
MYSQL_DATABASE: wordpress