Skip to content

Instantly share code, notes, and snippets.

@blueo
blueo / DeleteGeneratedImagesTask.php
Created November 21, 2018 19:45
Delete generated images from SS4
<?php
namespace App\Tasks;
use SilverStripe\Dev\BuildTask;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Security\Permission;
use SilverStripe\Assets\Image;
use SilverStripe\ORM\DataObject;
@blueo
blueo / phpcs.xml
Created April 27, 2018 04:22
phpcs.xml.dist slevomat + silverstripe
<?xml version="1.0"?>
<ruleset name="SS4">
<description>Coding standard for SilverStripe 4.x</description>
<!-- Don't sniff third party libraries -->
<exclude-pattern>./vendor/*</exclude-pattern>
<exclude-pattern>*/thirdparty/*</exclude-pattern>
<!-- Show progress and output sniff names on violation, and add colours -->
<arg value="sp"/>
@blueo
blueo / config
Last active March 18, 2018 03:00
spotifyd log
[global]
username = username
password = password
backend = alsa
mixer = PCM
device_name = SpotifyD
cache_path = /tmp
volume-normalisation = true
normalisation-pregain = -10
@blueo
blueo / ICanHazSSH.php
Last active December 19, 2015 10:49
A simple phing task to help with deploying to shared hosting. My shared host requires I register my IP to use ssh, but my IP changes as I'm on a cheapy dynamic connection.... oh yeah, and they blacklist me if I use an old one... So this task simply checks that the IP passed in the phing task (eg <ICanHazSSH CurrentIP="1.1.1.1"/>) matches my curr…
<?php
class ICanHazSSH extends Task {
private $CurrentIP = null;
private $ichip = "icanhazip.com";
private $IP = null;
private function setIP(){
$data = $this->get_data($this->ichip);
$this->IP = trim($data);
}
public function setCurrentIP($str) {