Skip to content

Instantly share code, notes, and snippets.

View tedsecretsource's full-sized avatar

Ted Stresen-Reuter tedsecretsource

View GitHub Profile
@tedsecretsource
tedsecretsource / Leveling Matrices.md
Last active March 14, 2022 08:55
A list of leveling matrices, professional ladders, career frameworks
@tedsecretsource
tedsecretsource / 1. Building PHP-MAMP on Apple Silicon M1.md
Created April 23, 2021 08:04 — forked from lennardv2/1. Building PHP-MAMP on Apple Silicon M1.md
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
Rosetta2 191.654 sec 1.96 MOp/s
Intel i7-4790K (imac 2014) 156.791 sec 2.39 MOp/s
Intel i5-8500B (mini 2018) 141.381 sec 2.65 MOp/s
ARM m1 43.745 sec 8.58 MOp/s
@tedsecretsource
tedsecretsource / strict_bash.sh
Created April 19, 2021 08:42
Default bash script in strict mode
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Run this script with bash -x (script name) to execute commands one a time
# while IFS=' ', read -r col1 col2 col3 col4 col5; do echo "I got: $col1 | $col2"; done < authors.csv
# while IFS=' ', read LINE; do echo $LINE | cut -f 2; done < authors.csv
#/ Usage: ./process_authors.sh -p migration-support/authors.tsv -s ''
#/
#/ Description: Transform authors.xml into TSV and then
<?php
/* Feature stub: Caption a picture
*
* Description: grab an image from the Internet, download it to your server and display it with a caption. The caption
* should also come from the Internet and be no longer than 12 words (in English or Lipsum).
*
* Given a visit to this page
* When the page is finished loading
* Then the page displays an image followed by a caption
*/
@tedsecretsource
tedsecretsource / wordpress-plugin-svn-to-git.md
Created May 8, 2019 15:36 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@tedsecretsource
tedsecretsource / models-filtered-by-related-attributes
Last active March 2, 2018 20:52
Get models filtered on related attributes
@tedsecretsource
tedsecretsource / get_next_ID.md
Last active December 9, 2018 17:17
Get the next AUTO_INCREMENT ID from MySQL

Get the Next AUTO_INCREMENT ID from MySQL

There are two methods for getting the next auto_increment ID from MySQL. Both of these examples are using Laravel. Please note that this method, non-blocking, opens the door for a "race condition" in the sense that one person could get the next ID, pause for a moment, and then another request gets the same ID (since it hasn't been incremented yet) leading to a situation in which two requests both have the same ID reserved.

Method 1

\DB::select('SELECT AUTO_INCREMENT as "id"