Skip to content

Instantly share code, notes, and snippets.

View muskie9's full-sized avatar

Nic muskie9

View GitHub Profile
@H3nr1-1
H3nr1-1 / gist:78ab0e6a379b5c52df89364958d6f3a9
Last active May 1, 2025 19:20
Dynamic Bootstrap Utility List
# Variable For Commonly Used Bootstrap Utilities.
## Accordion
--bs-accordion-color: #{$accordion-color};
--bs-accordion-bg: #{$accordion-bg};
--bs-accordion-transition: #{$accordion-transition};
--bs-accordion-border-color: #{$accordion-border-color};
--bs-accordion-border-width: #{$accordion-border-width};
--bs-accordion-border-radius: #{$accordion-border-radius};
@wilr
wilr / admin.yml
Last active June 30, 2025 07:48
Big & Beautiful Silverstripe Elemental Previews
---
Name: "admin-custom"
---
SilverStripe\Admin\LeftAndMain:
extra_requirements_css:
- "app/client/element-preview.css"
<?php
namespace Nightjar\SS4UpgradeTasks;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use SilverStripe\Assets\File;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
Add the following methods to your `Image` subclass to allow SVG uploads via `$has_one` `UploadField`'s and uploads via the Asset Admin.
Hat-tip to https://github.com/restruct/silverstripe-svg-images. All I've done is:
* Removed superfluous SVG template logic
* Called `isSVG()` from everywhere
* Added comments where appropriate
* Put all necessary YML config into one place
YML config:
@mlewis-everley
mlewis-everley / SingleSelectListBoxDropdownField.php
Created May 17, 2019 15:39
Custom dropdown field that pretends to submit an array (but only allows selection of one item)
<?php
namespace App\Forms;
use SilverStripe\Forms\DropdownField;
class SingleSelectListBoxDropdownField extends DropdownField
{
/**
* Force this field to appear as if it saves an array
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@wernerkrauss
wernerkrauss / SilverstripeDataObject.php
Last active May 25, 2016 06:34
Some PHPStorm / Intellij IDEA file templates for SilverStripe development
<?php
#parse("PHP File Header.php")
class ${NAME} extends DataObject {
private static \$db = array();
private static \$has_one = array();
private static \$has_many = array();
<?php
class SomeModelAdmin extends ModelAdmin {
private static $managed_models = array(
"MyDataObject"
);
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
@anselmdk
anselmdk / FeatureContext.php
Last active May 24, 2016 04:08
Behat tests for SilverStripe modules
<?php
namespace SilverStripe\Mysite\Test\Behaviour;
use SilverStripe\Cms\Test\Behaviour;
// PHPUnit
require_once 'PHPUnit/Autoload.php';
require_once 'PHPUnit/Framework/Assert/Functions.php';
/**
* Features context
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active December 29, 2024 07:04
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to: