Skip to content

Instantly share code, notes, and snippets.

View theodorejb's full-sized avatar

Theodore Brown theodorejb

View GitHub Profile
@derickr
derickr / stv.php
Created September 6, 2022 17:00
stv.php
<?php
/* Find files */
$files = glob( $argv[1] );
sort( $files );
echo "Reading from: \n- ", implode( "\n- ", $files ), "\n\n";
/* Read Amount of Seats from Command Line */
array_shift( $argv );
array_shift( $argv );
$seats = (int) $argv[0];
@M1ke
M1ke / psalm-query.php
Created April 27, 2022 15:06
This tool processes a SQL query and generates a guess at an appropriate Psalm object-like array definition
<?php
const PSALM_STRING = ': string';
const SELECT_ALL = '*';
// These must be upper case to avoid accidental positives
const SQL_SELECT = 'SELECT';
const SQL_FROM = 'FROM';
const ARG_DEBUG = '--debug';
// This is lower case as the field names are forced to lower case
const SQL_AS = ' as ';
@andrewdalpino
andrewdalpino / PHP SplStack vs SplQueue vs Array
Last active August 13, 2023 10:39
This is a performance benchmark comparing PHP SplStack, SplQueue, and plain array performance for insert and read/remove operations.
<?php
namespace PhpBenchmarks;
use SplStack;
use SplQueue;
const NUM_TEST_ITEMS = 100000;
const DATA_SIZE = 32; //Bytes.
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - freek@spatie.be</title>
</head>
<body>
<outline text="PHP" title="PHP">
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/>
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/>
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/>
@staltz
staltz / introrx.md
Last active May 24, 2024 07:56
The introduction to Reactive Programming you've been missing