Skip to content

Instantly share code, notes, and snippets.

View gabesullice's full-sized avatar

Gabe Sullice gabesullice

View GitHub Profile
@gabesullice
gabesullice / example.php
Last active June 26, 2023 09:57
self vs static vs $this
<?php
class ParentClass {
public static string $foo = 'ooh';
public string $bar = 'lala';
public function __construct($arg) {
$this->bar = $arg;
@gabesullice
gabesullice / meminfo.go
Created January 6, 2023 11:16
Graph /proc/meminfo with Go and Graphite
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"strconv"
"time"
@gabesullice
gabesullice / notes.md
Last active January 10, 2023 16:04
FrankenPHP w/ Drupal notes
  • Overrides
    • Changed the root directive in the Caddyfile to web instead of public
    • Used -v $PWD:/app instead of /app/public
    • Added error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT to php.ini and used -v $PWD/php.ini:/usr/local/lib/php.ini to suppress warnings. Deprecations were still being printed out.
  • Observations
    • Many warnings like this one: **Warning**: ini_set(): Session ini settings cannot be changed after headers have already been sent in **/app/web/core/lib/Drupal/Core/DrupalKernel.php** on line **1000**
    • Many deprecations were printed out, such as: __Deprecated function__: Creation of dynamic property Drupal\Core\Installer\InstallerKernel::$_serviceId is deprecated in __Drupal\Core\DependencyInjection\ContainerBuilder->set()__ (line __83__ of __/app/web/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php__).
    • Drupal is still not compatible with PHP 8.2: https://www.drupal.org/project/drupal/issues/3283358
  • FrankenPHP compiles PHP
@gabesullice
gabesullice / fetcher.js
Last active February 5, 2021 19:34
Tiny Go server to test browser implementations of the vary: accept header
"use strict"
// Fetches the browser window's URL with an accept header set to the mediaType.
async function doFetch(mediaType, host) {
const loc = window.location
const url = `${loc.protocol}//${host || loc.host}${loc.pathname}`;
const options = {
headers: {
accept: mediaType,
},
let count = undefined;
let startTime = undefined;
export class ErrorNotStarted extends Error {
constructor() {
super("The counter has not been started.");
}
}
export class ErrorAlreadyStarted extends Error {
@gabesullice
gabesullice / jsonapi_operations.experiment.patch
Created May 16, 2019 18:50
Experiment (ignore everything about the "registry")
diff --git a/jsonapi_operations.services.yml b/jsonapi_operations.services.yml
index bbb3da6..d6fd805 100644
--- a/jsonapi_operations.services.yml
+++ b/jsonapi_operations.services.yml
@@ -6,3 +6,8 @@ services:
- '@jsonapi.resource_type.repository'
- '@database'
- '@http_kernel'
+
+ jsonapi_operations.local_id_registry:
@gabesullice
gabesullice / error.sh
Created September 5, 2017 16:12
Make output
[0] gabe EW7833UAC_linux_v4.3.21_17997.20160531 $ sudo make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.12.4-1-ARCH/build M=/home/gabe/Downloads/edimax/EW7833UAC_linux_4.3.21_kernel_3.16-4.4/EW7833UAC_linux_v4.3.21_17997.20160531 modules
make[1]: Entering directory '/usr/lib/modules/4.12.4-1-ARCH/build'
CC [M] /home/gabe/Downloads/edimax/EW7833UAC_linux_4.3.21_kernel_3.16-4.4/EW7833UAC_linux_v4.3.21_17997.20160531/os_dep/linux/ioctl_linux.o
/home/gabe/Downloads/edimax/EW7833UAC_linux_4.3.21_kernel_3.16-4.4/EW7833UAC_linux_v4.3.21_17997.20160531/os_dep/linux/ioctl_linux.c: In function ‘rtw_ioctl_wext_private’:
/home/gabe/Downloads/edimax/EW7833UAC_linux_4.3.21_kernel_3.16-4.4/EW7833UAC_linux_v4.3.21_17997.20160531/os_dep/linux/ioctl_linux.c:14004:5: error: implicit declaration of function ‘is_compat_task’; did you mean ‘is_idle_task’? [-Werror=implicit-function-declaration]
if(is_compat_task())
^~~~~~~~~~~~~~
is_idle_task
@gabesullice
gabesullice / flags.sh
Last active August 31, 2017 19:55
Simple Shell Flag Parsing
#!/bin/bash
set -e
declare -A options
options["your"]=false
options["options"]=false
options["here"]=false
main () {
@gabesullice
gabesullice / settings.environment.php
Created June 20, 2017 21:58
Example Drupal Environment Configuration
<?php
// You may uncomment this once you have a database installed.
$databases['default']['default'] = [
'database' => '<database_name>',
'username' => '<database_username>',
'password' => '<database_password>',
'host' => '<db.yourdomain.com>',
'port' => '3306',
'driver' => 'mysql',
// parent
{% set defaults = {
'footer': '@fph-components/regions/footer/footer.twig'
} %}
{% set overrides = {
'footer-tertiary': '@fph-components/regions/footer/footer--tertiary.twig'
} %}
{%
include defaults['footer'] with {