Skip to content

Instantly share code, notes, and snippets.

View simPod's full-sized avatar
💥
Trying to BC break your OSS

Simon Podlipsky simPod

💥
Trying to BC break your OSS
View GitHub Profile
@Ocramius
Ocramius / psalm-compendium.php
Last active April 23, 2025 01:22
A small compendium of what is possible with `vimeo/psalm` 3.9.x to add some decent type system features to PHP
<?php
// -- types are a compile-time propagated concept
// https://psalm.dev/r/338f74a96c
class TheType
{
/** @var string */
public $foo = 'bar';
}
@ciaranmcnulty
ciaranmcnulty / notes.md
Last active March 25, 2024 06:36
Notes on using Docker on ARM Macs (November 2021)

Docker for Mac

On M1 machines, Docker for Mac is running a lightweight linux ARM VM, then running containers within that, so containers are essentially running natively. Don't be fooled by the fact the UI or binary CLI tools (e.g. docker) might require Rosetta.

Within that VM is an emulation layer called QEmu. This can be used by docker to run Intel containers. This does not use Rosetta at all, and has a roughly 5-6X performance penalty. (If you just upgraded your CPU this may result in a similar performance to your old machine!)

Pulling and running with Docker

Many images in public registries are multi-architecture. For instance at the time of writing on Docker Hub the php:8.0-cli image has the following digests:

@Ocramius
Ocramius / handling-optional-input-fields-with-type-safe-abstractions.md
Last active January 22, 2025 09:32
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",

@syahzul
syahzul / how-to-install-php-oci8-for-macos-ventura-sonoma-and-above-on-apple-silicon-macs-arm64-version.md
Last active February 17, 2025 16:07
How to install PHP OCI8 for macOS Ventura/Sonoma on Apple Silicon Macs (arm64 version)

How to install PHP OCI8 for macOS Ventura/Sonoma on Apple Silicon Macs (arm64 version)

This tutorial will guide you on how to install OCI8 for PHP8.3 using Oracle Instant Client arm64.

1. Install Command Line Tools for Xcode

Run the command below if you haven't installed it on your machine.

xcode-select --install
@dcower
dcower / remove_crashed_sessions.js
Created November 8, 2024 16:35
Remove crashed sessions in Tabs Outliner
function search_and_remove() {
// Search for crashed windows and tabs. Reverse the list so that we delete
// from the bottom, which is MUCH faster.
elements = Array.from(document.querySelectorAll('li.savedwinNTASC,li.savedtabNTASC')).reverse();
if (elements.length == 0) {
console.log("Finished removing stale windows and tabs.");
return;
}