Skip to content

Instantly share code, notes, and snippets.

View ScopeyNZ's full-sized avatar

Guy Marriott ScopeyNZ

View GitHub Profile
@use "sass:string";
@use "sass:selector";
@mixin with-block-modifier($modifier) {
$selector: #{&};
$pseudo: string.index($selector, '::');
@if ($pseudo) {
$selector: string.slice($selector, 0, $pseudo - 1);
$pseudo: string.slice(#{&}, $pseudo);
@ScopeyNZ
ScopeyNZ / projects.md
Last active May 31, 2020 05:04
Guy's on-going/unfinished SilverStripe projects
@ScopeyNZ
ScopeyNZ / hub-pr-extension.sh
Created September 4, 2018 23:18
Attempts to calculate the proper head branch when running `hub pull-request`
# Find the right head
LOCAL_BRANCH=`git name-rev --name-only HEAD`
REMOTE_BRANCH=`git branch -r | grep "$LOCAL_BRANCH"`
IFS='/'
read -r REMOTE BLAH <<< "$REMOTE_BRANCH"
IFS=' '
# Trim the remote name
REMOTE=`echo $REMOTE | sed -e 's/^[ \t]*//'`
@ScopeyNZ
ScopeyNZ / missing-tests.php
Last active July 26, 2018 05:29
Show the modules that are installed that aren't part of a test suite (for use with recipes)
<?php
$lock = json_decode(file_get_contents("composer.lock"), true);
$testXML = file_get_contents('phpunit.xml.dist');
foreach ($lock['packages'] as $package) {
if (strpos($package['type'], 'silverstripe') !== false && strpos($testXML, $package['name']) === false) {
// Attempt to locate a test folder
$directory = 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package['name']). DIRECTORY_SEPARATOR;
if (is_dir($directory) && is_dir($directory .'tests')) {
echo $package['name'].PHP_EOL;