Skip to content

Instantly share code, notes, and snippets.

litzinger /
Created Dec 4, 2020
Use Xdebug 3 in PHP 7.3/4

DDEV-Local depends on the Debian packages for PHP, so will follow those as the changes are made. Currently packages PHP8.0 with xdebug 3.0, but it's not hard to get xdebug 3.0 with earlier PHP versions until that changes.

You can compile and install xdebug 3.0 for PHP7.3 or 7.4. Place this file as .ddev/web-build/Dockerfile in your project's .ddev directory:

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests php-dev php-pear build-essential
litzinger / .phpstorm.meta.php
Last active Feb 18, 2020
PhpStorm meta file for ExpressionEngine
View .phpstorm.meta.php
* ExpressionEngine PhpStorm Meta
* This file is not a CODE, it makes no sense and won't run or validate
* Its AST serves PhpStorm IDE as DATA source to make advanced type inference decisions.
* @see
View Static rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{DOCUMENT_ROOT}/static/default_site/static%{REQUEST_URI}/index\.php -f
RewriteRule ^ /static/default_site/static%{REQUEST_URI}/index\.php [L,QSA]
litzinger / FieldAbstract.php
Created Aug 2, 2019
ExpressionEngine fieldtype abstract and interface for simplifying building fieldtypes
View FieldAbstract.php
abstract class FieldAbstract extends EE_Fieldtype
* The settings from the db that EE passes to the ft file
* @var array
public $settings = [];
litzinger / DateTime.php
Created Jun 5, 2019
Crude attempt at supporting Elasticsearch date math values in PHP's DateTime object
View DateTime.php
namespace MyNamespace;
* @author Ton Sharp
* @author Brian Litzinger
* @see
* @see
litzinger / index.js
Last active Jan 4, 2021
Simple Puppeteer screenshot script
View index.js
If saving AWS creds locally they need to be in ~/.aws/credentials
aws_access_key_id = foo
aws_secret_access_key = bar
const puppeteer = require('puppeteer');
const AWS = require('aws-sdk');
litzinger /
Last active Dec 19, 2019
ExpressionEngine Quick Tips

Forcing a database update

If you're in a situation where you've already updated EE, but then need to run the database upgrades again, this will help force the installer to run the updates again. This situation may occur if you've upgrade a local or dev version of a site, but need to grab a newer version of the production database to get it up-to-date too.

  1. Change $config['app_version'] to the previous version you've already upgraded from.

  2. Add define('INSTALL_MODE', TRUE); to your admin.php file, then reload admin.php. Clicking the version number in the footer should show an update is available, even though it may match what says is currently installed. Run the update normally, then remove define('INSTALL_MODE', TRUE); from your admin.php file.

litzinger / grid.css
Created Sep 19, 2018
Simple CSS Grid layout without a framework
View grid.css
.container {
padding: 0 1rem;
margin: 0 auto;
@media screen and (min-width: 992px) {
.container {
max-width: 1140px;
.grid-wrapper {
display: grid;
View gist:7719412e728bb0f7579b6dcaad1d3d91
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit:
// Set the IDEKEY in the browser Xdebug Helper extension to "vscode"
"version": "0.2.0",
"configurations": [
litzinger / hook.php
Created Oct 31, 2017
Publisher hook example
View hook.php
$query = $this->query->modify(
' AND ae.publisher_lang_id = '. $publisher_lang_id .' AND ae.publisher_status = "'. $publisher_status .'" ORDER BY',
// Publisher is disabled, but we still need to get default rows,
// otherwise it'll show duplicate rows.