Skip to content

Instantly share code, notes, and snippets.

View tiller1010's full-sized avatar

Tyler Trout tiller1010

View GitHub Profile
@tiller1010
tiller1010 / docker_root.md
Created November 11, 2025 18:53
Docker Root (windows)
winpty docker exec -it --user root CONTAINER_ID sh
@tiller1010
tiller1010 / subclass_method_overrides_with_extension_points.md
Last active April 4, 2025 20:18
SilverStripe Subclass extension points

SilverStripe DataObject subclasses cannot override a base class method with an extension point ($this->extend()) and define an extension point themselves. This will cause extend to be called twice, which can lead to duplication.

<?php

class ExampleDataObject extends DataObject
{
  public function getCMSFields()
  {
@tiller1010
tiller1010 / filesize_configs.md
Last active January 27, 2025 17:06
Filesize Configs

Filesize Configs

PHP

  • upload_max_filesize - The maximum size of an uploaded file.
  • post_max_size - The maximum size of POST data that PHP will accept.
  • memory_limit - The maximum amount of memory a script may consume.
  • max_execution_time - The maximum time in seconds a script is allowed to run before it is terminated by the parser.

Nginx

  • http { client_max_body_size } - The maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client.
@tiller1010
tiller1010 / inline-css-argument.md
Created October 7, 2024 21:13
Argument for inline css vs sass compilation

There are a few cases where inline styles would be more appropriate than using SASS or CSS.

  • Styling is done in one file, vs adding a class, opening a sass file, and compiling it to css.
  • Styling is explicit, no guesswork needs to be done to determine what styles a class would add.
  • Style rules are strong, nothing besides !important rules will conflict with them.
  • Styles are brief, and the need to come up with a name for a class is avoided.
  • Sometimes we just want to add one or a few styles, and a css class would be overkill.

There are cases where sass works better.

  • If you need to add 3 or more styles, a class looks cleaner than inline styling does.
  • If it is something that is going to be re-used often like in different parts of the project, a class is more appropriate. Doing the styles inline would force you to edit each line to make a change.
@tiller1010
tiller1010 / override-silverstripe-database-properties.md
Created April 29, 2024 19:03
Override the db, has_one, etc... properties with yml

This PR originally had info about this, but it was requested out. silverstripe/developer-docs#345

DataObject subclasses' db, has_one, has_many, etc... properties cannot be overridden in DataExtensions.

Instead, you need to use yml to override these.

---
Name: override-db-properties
---
@tiller1010
tiller1010 / replace-fieldlist-with-tabset.php
Last active July 5, 2024 15:28
Replaces a SilverStripe Fieldlist with a tabset in a DataExtension
<?php
/* Capture original fields by value */
$orignalFields = FieldList::create($fields->toArray());
/* Remove all original fields to prevent conflicts with replacement */
$fields->each(function($field) use (&$fields) {
$fields->remove($field);
});
@tiller1010
tiller1010 / git-bash-fix.txt
Created April 10, 2024 17:10
Fixes git bash issues with certain interactive shell programs
Git bash has issues with certain interactive shell programs
- mongo
- ngrok
- nvim
- gh pr create
These programs can be run, however, by using winpty
Example:
`winpty nvim`
@tiller1010
tiller1010 / add-above-svgs.txt
Created April 10, 2024 17:08
Fix SVGs for SilverStripe
<?xml version="1.0" encoding="utf-8"?>
@tiller1010
tiller1010 / mysql-measure-db.sql
Created April 10, 2024 17:06
Measure a database size in MySQL
select table_schema 'DB', ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables where table_schema = 'SS_sitedb' GROUP BY table_schema;
@tiller1010
tiller1010 / mysql-into-csv.sql
Created April 10, 2024 17:04
Ouput mysql query to csv file
SELECT * FROM `table_name`
into outfile '/var/lib/mysql-files/output-new.csv' fields terminated by "," enclosed by '"' lines terminated by "\n";