Consistency in naming makes reading and memory retrieval much, much easier. Conversely, changing rules and mixing conventions are very confusing and significantly increase cognitive load. Follow language, company, and project conventions for names, even if you don't like them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Splits a large XML file with many elements into individual XML files per element using PHP and DOMDocument | |
* | |
* The script does the following: | |
* - Load original XML | |
* - Create template XML and remove elements | |
* - For each element of the original XML | |
* - Create a clone of the template XML | |
* - Add element of the original XML to the clone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Make a DNS a request to a custom nameserver, this is similar to dns_get_record, but allows you to query any nameserver | |
* Usage: dns_get_record_from('ns.server.tld', 'A', 'mydomain.tld'); | |
* => ['42.42.42.42'] | |
* @author bohwaz | |
*/ | |
function dns_get_record_from(string $server, string $type, string $record, string $protocol = 'udp'): array | |
{ |
This is a solution to run the original enc2ly
CLI program within a Docker container.
There are two CLI programs that convert Encore musical files to LilyPond.
Unfortunately I wasn't able to run these programs on my MacOS.
So, here are the instructions for using the original enc2ly
CLI programm within a Docker container.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Preact HTM Example</title> | |
</head> | |
<body> | |
<script type="module"> | |
// 1. imports from unpkg.com | |
import * as Preact from 'https://unpkg.com/[email protected]/dist/preact.module.js' | |
import htm from 'https://unpkg.com/[email protected]/dist/htm.module.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php -f | |
<?php | |
error_reporting(~E_WARNING); | |
//Create a UDP socket | |
if(!($sock = socket_create(AF_INET, SOCK_DGRAM, 0))) { | |
$errorcode = socket_last_error(); | |
$errormsg = socket_strerror($errorcode); | |
die("Couldn't create socket: [$errorcode] $errormsg \n"); | |
} | |
echo "Socket created \n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('array_group_by')) { | |
/** | |
* Groups an array by a given key. | |
* | |
* Groups an array into arrays by a given key, or set of keys, shared between all array members. | |
* | |
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function. | |
* This variant allows $key to be closures. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
traefik: | |
restart: unless-stopped | |
image: traefik:v2.0.2 | |
ports: | |
- "80:80" | |
- "443:443" | |
labels: | |
- "traefik.http.services.traefik.loadbalancer.server.port=8080" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"x-send-defaults": true, | |
"openapi": "3.0.0", | |
"x-api-id": "json-rpc-example", | |
"info": { | |
"title": "JSON-RPC OpenAPI", | |
"version": "1.0.0", | |
"description": "Example of how to describe a JSON-RPC 2 API in OpenAPI" | |
}, | |
"servers": [ |
NewerOlder