Skip to content

Instantly share code, notes, and snippets.

Gordon Anderson gordonbanderson

Block or report user

Report or block gordonbanderson

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 themes.ymll
---
Name: mytheme
---
SilverStripe\View\SSViewer:
themes:
- '$public'
- 'forms-ss4-bootstrap-theme'
- 'default-ss4-bootstrap-theme'
- 'blog-ss4-bootstrap-theme'
- 'homepage-ss4-bootstrap-theme'
@gordonbanderson
gordonbanderson / .env
Created Apr 25, 2018
Running SilverStripe Module Tests With Docker
View .env
SS_BASE_URL="http://localhost"
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_NAME="unittesting"
SS_DATABASE_PASSWORD=""
SS_DATABASE_SERVER="database"
SS_DATABASE_USERNAME="root"
SS_ENVIRONMENT_TYPE="dev"
@gordonbanderson
gordonbanderson / .env
Created Apr 25, 2018
Running SilverStripe Tests Locally For a Module Using Docker
View .env
# Generated by SilverStripe Installer
SS_BASE_URL="http://localhost"
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_NAME="unittesting"
SS_DATABASE_PASSWORD=""
SS_DATABASE_SERVER="database"
SS_DATABASE_USERNAME="root"
SS_ENVIRONMENT_TYPE="dev"
View Test Gist
This is a test Gist for the SilverStripe shortcode handler
View Example color.scss file
//split complimentaryish
$rotate: 160;
$baseColor1: #ED1C24;
$baseColor2: #241D4F;
$baseColor3: #bd10d4;
$baseColor4: #ffff00;
$baseColor5: #4E573A;
@gordonbanderson
gordonbanderson / ClearElasticFieldCacheExtension.php
Created Sep 16, 2015
How to hook into /dev/build using SilverStripe and Extensions
View ClearElasticFieldCacheExtension.php
<?php
class ClearElasticFieldCacheExtension extends Extension {
public function onAfterInit() {
$cache = SS_Cache::factory('whatever');
$cache->clean();
}
}
@gordonbanderson
gordonbanderson / grabss
Created Sep 11, 2015
Transfer latest screenshots from Kodi box - note use ssh config to make 'ssh kodi' work to your username/IP requirements
View grabss
#!/usr/bin/ruby
nfiles = ARGV[0]
puts "Transferring latest #{nfiles} screenshots to current directory"
cmd="ssh kodi <<'ENDSSH'
ls -t ~/Pictures/*.png | head -n #{nfiles}
ENDSSH"
files = `#{cmd}`
for file in files.lines
@gordonbanderson
gordonbanderson / Aggregation.php
Created Aug 8, 2015
Example of how to aggregate with filtering using Elastica
View Aggregation.php
$queryString = new QueryString($_GET['q']);
$isoTerm = new Term();
$isoTerm->setTerm('ISO',4000);
$apeterm = new Term();
$apeterm->setTerm('Aperture',2.7);
$andFilter = new BoolAnd();
$andFilter->addFilter($apeterm);
@gordonbanderson
gordonbanderson / HtmlEditorField.js
Created Jul 20, 2015
Modified version of HtmlEditorField.js, SilverStripe 3.13, with addition of console logging. See https://github.com/silverstripe/silverstripe-cms/issues/1166
View HtmlEditorField.js
/**
* Functions for HtmlEditorFields in the back end.
* Includes the JS for the ImageUpload forms.
*
* Relies on the jquery.form.js plugin to power the
* ajax / iframe submissions
*/
var ss = ss || {};
/**
You can’t perform that action at this time.