Skip to content

Instantly share code, notes, and snippets.

View gordonbanderson's full-sized avatar

Gordon Anderson gordonbanderson

  • Nonthaburi, Thailand
View GitHub Profile
@gordonbanderson
gordonbanderson / collation.yml
Created December 12, 2021 18:14
Set Collation in SilverStripe
# Allow emoji 🥳 - https://github.com/silverstripe/silverstripe-framework/issues/8062
SilverStripe\ORM\Connect\MySQLDatabase:
connection_charset: utf8mb4
connection_collation: utf8mb4_unicode_ci
charset: utf8mb4
collation: utf8mb4_unicode_ci
---
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 April 25, 2018 02:49
Running SilverStripe Module Tests With Docker
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 April 25, 2018 02:46
Running SilverStripe Tests Locally For a Module Using Docker
# 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"
Testing embed
This is a test Gist for the SilverStripe shortcode handler
//split complimentaryish
$rotate: 160;
$baseColor1: #ED1C24;
$baseColor2: #241D4F;
$baseColor3: #bd10d4;
$baseColor4: #ffff00;
$baseColor5: #4E573A;
@gordonbanderson
gordonbanderson / ClearElasticFieldCacheExtension.php
Created September 16, 2015 09:56
How to hook into /dev/build using SilverStripe and Extensions
<?php
class ClearElasticFieldCacheExtension extends Extension {
public function onAfterInit() {
$cache = SS_Cache::factory('whatever');
$cache->clean();
}
}
@gordonbanderson
gordonbanderson / grabss
Created September 11, 2015 06:01
Transfer latest screenshots from Kodi box - note use ssh config to make 'ssh kodi' work to your username/IP requirements
#!/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 August 8, 2015 15:14
Example of how to aggregate with filtering using Elastica
$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);