Skip to content

Instantly share code, notes, and snippets.

Stephen Holdaway stecman

Block or report user

Report or block stecman

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
View How to

Note: this is an extract from Heyday's internal docs, written by me. Published as a Gist to share the love.

Authoring commits

We like sensible commit messages. There're a lot of good articles about writing great, useful commit messages, but here's the gist of what we like:

  • The single most important thing is: commit messages should explain why you are making the change.
  • Think, "what would future me want to know about this change?"
  • Avoid committing multiple sets of ideas/changes in the same commit: split them up.
  • Don't assume the reader understands what the original problem was.
stecman / GridFieldStreamExportButton.php
Created Apr 5, 2016
Streamed CSV export for SilverStripe GridField
View GridFieldStreamExportButton.php
* Improved GridFieldExportButton that streams CSV data to the client instead of building
* the entire CSV in memory and sending that (which doesn't work for large data sets).
class GridFieldStreamExportButton extends GridFieldExportButton
stecman /
Last active Mar 17, 2016
Prototype: get SilverStripe database (when a beam.json configis available)

getdb prototype

This is an experimental database fetching tool for projects using SilverStripe with _ss_environment.php files for database config and Beam. A project's beam.json config is used to find SSH connection details, and the database details for that environment are read from the _ss_environment.php file on the server.

This is essentially a wrapper to build and run a shell command like this:

stecman /
Last active Jul 6, 2016
Steam auto trader

Maximum Hax

Automates the UI actions (clicks, typing) to sell Steam trading cards from the Steam web interface. To use this:

  1. Log into your Steam account in Chrome
  2. Go to [Username] -> Inventory
  3. Open the Javascript console (View -> Developer -> Javascript Console)
  4. Paste in the entire script below and press enter
  5. To start selling all trading cards in your inventory, type doHax() in the console and press enter
  6. ...
stecman / SiteTreePermissionsExtension.php
Last active Dec 7, 2015
SilverStripe extension to use the permissions for SiteTree on other dataobjects
View SiteTreePermissionsExtension.php
* Apply the SiteTree edit/view/delete permissions/roles to any DataObject
* By default DataObjects are only writable by admin users, which isn't all that useful.
* The null return values indicate to the calling code in DataObject that the extended
* method shouldn't affect the outcome of the permission check.
* @see DataObject::extendedCan()
stecman / silverstripe-remove-empty-tabs.php
Last active Aug 13, 2019
Remove empty tabs in the SilverStripe CMS
View silverstripe-remove-empty-tabs.php
* Recurse through tabs and remove any with no child fields
* The way SilverStripe's field scaffolding works can leave empty tabs around after
* fields are moved or removed by the slices module.
* @param FieldList $fields
* @return FieldList
protected function removeEmptyTabs(FieldList $fields)
stecman /
Last active Dec 20, 2016
bash-completion extract for dealing with colons

Extract from bash-completion for working with stecman/symfony-console-completion

This is an example extract of the minimum amount of the bash-completion project required to use these two functions:

  • __ltrim_colon_completions
  • _get_comp_words_by_ref

The functions here are copied verbatim from the bash_completion source. I recommend not using this extract unless there are no other alternatives. Instead, prefer installing the bash-completion package from your package manager, or install bash-completion from source.

View beam-shell-profile.bash
# Helper shell functions and completions for use with Beam
# Print the .beamlog file for a beam target.
# Target defaults to live if not given
# usage: whatsup [target]
function whatsup() {
local server="${1-live}";
stecman / less-fix.php
Last active Oct 6, 2015
Script to fix vertical whitespace in LESS/CSS-like files
View less-fix.php
#!/usr/bin/env php
* Fix vertical whitespace in LESS/CSS-like files
* This script fixes selectors that are bunched together with no spacing, and selectors
* that are bunched together with properties and have no vertical spacing. This could be
* done with sed, but the regex escaping was a pain and it's harder to document.
stecman /
Last active May 12, 2016
heyday/silverstripe-slices 0.x to 1.0 config conversion script
#!/usr/bin/env python
# YAML config conversion script for heyday/silverstripe-slices 0.x going to 1.0
# Comments and whitespace aren't preserved - this is more to help you out by doing
# the repeatitive part of the conversion. The converted config is written to stdout.
# Note that this needs a python module installed to work:
# $ pip install pyyaml
You can’t perform that action at this time.