Skip to content

Instantly share code, notes, and snippets.

Brian Litzinger litzinger

Block or report user

Report or block litzinger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@litzinger
litzinger / .phpstorm.meta.php
Last active Feb 16, 2020
PhpStorm meta file for ExpressionEngine
View .phpstorm.meta.php
<?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
*/
View Static rules
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 Aug 2, 2019
ExpressionEngine fieldtype abstract and interface for simplifying building fieldtypes
View FieldAbstract.php
<?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 Jun 5, 2019
Crude attempt at supporting Elasticsearch date math values in PHP's DateTime object
View DateTime.php
<?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 Jul 20, 2019
Simple Puppeteer screenshot script
View index.js
/*
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');
@litzinger
litzinger / ee-tips.md
Last active Dec 19, 2019
ExpressionEngine Quick Tips
View ee-tips.md

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
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: https://go.microsoft.com/fwlink/?linkid=830387
// Set the IDEKEY in the browser Xdebug Helper extension to "vscode"
"version": "0.2.0",
"configurations": [
{
@litzinger
litzinger / hook.php
Created Oct 31, 2017
Publisher hook example
View hook.php
<?php
$query = $this->query->modify(
'ORDER BY',
' AND ae.publisher_lang_id = '. $publisher_lang_id .' AND ae.publisher_status = "'. $publisher_status .'" ORDER BY',
$sql
);
// Publisher is disabled, but we still need to get default rows,
// otherwise it'll show duplicate rows.
@litzinger
litzinger / relationship-entry_ids.diff
Created Jul 24, 2017
{relationship_field:entry_ids} is not available in EE2, but is in EE3. Take the code from EE3 and put it into EE2.
View relationship-entry_ids.diff
.../expressionengine/libraries/relationship_parser/Parser.php | 10 ++++++++++
.../libraries/relationship_parser/Tree_builder.php | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git system/expressionengine/libraries/relationship_parser/Parser.php system/expressionengine/libraries/relationship_parser/Parser.php
index 6a7d61d21..3cb6bdeed 100644
--- system/expressionengine/libraries/relationship_parser/Parser.php
+++ system/expressionengine/libraries/relationship_parser/Parser.php
@@ -188,6 +188,16 @@ class EE_Relationship_data_parser {
You can’t perform that action at this time.