Skip to content

Instantly share code, notes, and snippets.

View sminnee's full-sized avatar

Sam Minnée sminnee

View GitHub Profile
//Visit http://substack.neocities.org/video.html and paste this into the text box.
var t = 0;
var t = 0;
return function (r, w) {
t += 0.2;
var gRad = Math.sin(t/5) * 50;
var bRad = Math.sin(t/7) * 90;
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php54 --with-apache --without-snmp --with-tidy
# Follow the instructions for enabling php54 on Apache
brew install mysql
# Now edit the Apache config
@sminnee
sminnee / CRMAdmin.php
Last active August 29, 2015 14:16
Simple custom GridField plugin
<?php
class CRMAdmin extends ModelAdmin {
private static $url_segment = "crm";
private static $menu_title = "CRM";
private static $managed_models = array(
"Client",
"Contact",
@sminnee
sminnee / GridFieldSortOptionSet.php
Last active August 29, 2015 14:16
2nd GridField example
<?php
/**
* Add an OptionSetField of sort options
*/
class GridFieldSortOptionSet implements GridField_HTMLProvider, GridField_DataManipulator, GridField_ActionProvider {
/**
* Returns the optionset in the header
*/
@sminnee
sminnee / GridFieldSortOptionSet.php
Created March 6, 2015 14:59
Extension exercises - solution
<?php
/**
* Add an OptionSetField of sort options
*/
class GridFieldSortOptionSet implements GridField_HTMLProvider, GridField_DataManipulator,
GridField_ActionProvider, GridField_ColumnProvider {
protected $suppressOnSort = array();
@sminnee
sminnee / FeatureContext.php
Last active August 29, 2015 14:16
Behat and SilverStripe
<?php
namespace Mysite\Test\Behaviour;
use SilverStripe\BehatExtension\Context\SilverStripeContext,
SilverStripe\BehatExtension\Context\BasicContext,
SilverStripe\BehatExtension\Context\LoginContext,
SilverStripe\BehatExtension\Context\FixtureContext,
SilverStripe\BehatExtension\Context\EmailContext;
//SilverStripe\Framework\Test\Behaviour\CmsFormsContext,
@sminnee
sminnee / StaffHolder.php
Created June 18, 2015 11:59
Adding a dropdown to a StaffHolder...
<?php
class StaffHolder extends Page
{
//...
public function getCMSFields() {
$fields = parent::getCMSFields();
@@ -8,4 +8,8 @@ After:
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
- theme: 'sam'
\ No newline at end of file
+ theme: 'sam'
+
+SiteConfig:
+ extensions:
@sminnee
sminnee / CustomConfig.php
Created June 18, 2015 13:03
Adding a GridField to SiteConfig
Add the following lines to the bottom of updateCMSFields();
<?php
$fields->addFieldToTab('Root.Quotes',
GridField::create('Quotes', 'Quotes',
InspirationalQuote::get(),
GridFieldConfig_RecordEditor::create())
);
<?php
$blob = new DropdownField(
'EmployeeOfTheMonthID',
'Employee of the month',
$this
->Children()
->filter('ClassName', 'StaffPage')
->sort('Title')
->map('ID', 'Title')