Skip to content

Instantly share code, notes, and snippets.

@litzinger
litzinger / FluidField.php.diff
Last active December 11, 2023 14:20
Proposed changes to EE's Fluid Field - See https://github.com/ExpressionEngine/ExpressionEngine/issues/1643 for past convos
--- Model/FluidField_unedited.php 2023-07-17 11:25:23
+++ Model/FluidField.php 2023-07-07 16:49:14
@@ -119,7 +119,9 @@
$rows = ee()->extensions->call(
'fluid_field_get_field_data',
$this->field_id,
- $this->field_data_id
+ $this->field_data_id,
+ $this->fluid_field_id,
+ $this->entry_id
@litzinger
litzinger / ft.colorpicker.php
Created December 12, 2022 16:30
Refactor the EE ColorPicker fieldtype to support named colors
<?php
/**
* ExpressionEngine (https://expressionengine.com)
*
* @link https://expressionengine.com/
* @copyright Copyright (c) 2003-2022, Packet Tide, LLC (https://www.packettide.com)
* @license https://expressionengine.com/license
*/
use Mexitek\PHPColors\Color;
@litzinger
litzinger / cron.sh
Created October 25, 2022 14:15
Force macOS Calendar to sync with Exchange
0 * * * * launchctl stop com.apple.CalendarAgent && launchctl start com.apple.CalendarAgent
@litzinger
litzinger / build.php
Created August 8, 2022 16:19
localize vendor packages
<?php
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($addonDir, \RecursiveDirectoryIterator::SKIP_DOTS),
\RecursiveIteratorIterator::LEAVES_ONLY
);
download_and_extract_package('basee', 'Basee', $outputDir, $addonDir);
download_and_extract_package('file-field', 'FileField', $outputDir, $addonDir);
@litzinger
litzinger / ddev.md
Created December 4, 2020 19:43
Use Xdebug 3 in PHP 7.3/4

https://stackoverflow.com/questions/65137275/how-can-i-use-xdebug-3-0-with-php-7-3-or-7-4-in-ddev/65137276#65137276

DDEV-Local depends on the deb.sury.org Debian packages for PHP, so will follow those as the changes are made. Currently deb.sury.org 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:

ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN apt-get update &amp;&amp; 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
litzinger / .phpstorm.meta.php
Last active February 26, 2024 14:38
PhpStorm meta file for ExpressionEngine
<?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 https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
*/
Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/system [NC]
RewriteCond %{QUERY_STRING} !ACT|URL [NC]
RewriteCond %{REQUEST_METHOD} !=POST [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
litzinger / FieldAbstract.php
Created August 2, 2019 17:10
ExpressionEngine fieldtype abstract and interface for simplifying building fieldtypes
<?php
abstract class FieldAbstract extends EE_Fieldtype
{
/**
* The settings from the db that EE passes to the ft file
* @var array
*/
public $settings = [];
@litzinger
litzinger / DateTime.php
Created June 5, 2019 14:43
Crude attempt at supporting Elasticsearch date math values in PHP's DateTime object
<?php
namespace MyNamespace;
/**
* @author Ton Sharp
* @author Brian Litzinger
* @see https://gist.github.com/66Ton99/60571ee49bf1906aaa1c
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.3/common-options.html#date-math
*/
@litzinger
litzinger / index.js
Last active December 21, 2021 17:01
Simple Puppeteer screenshot script
/*
If saving AWS creds locally they need to be in ~/.aws/credentials
[default]
aws_access_key_id = foo
aws_secret_access_key = bar
*/
const puppeteer = require('puppeteer');
const AWS = require('aws-sdk');