Skip to content

Instantly share code, notes, and snippets.

@ninty9notout
ninty9notout / dabblet.css
Created December 26, 2013 01:46
Hangar 18 Website
/**
* Hangar 18 Website
*/
/* html5doctor.com Reset v1.6.1 (http://html5doctor.com/html-5-reset-stylesheet/) - http://cssreset.com */
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}
body{line-height:1}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}
nav ul{list-style:none}
blockquote,q{quotes:none}
blockquote:before,blockquote:after,q:before,q:after{content:none}
@ninty9notout
ninty9notout / Page.php
Created April 3, 2019 01:51
SilverStripe subsite tree drop down
<?php
$subsites = DataObject::get(Subsite::class)->map('ID', 'Title');
$fields->insertBefore('internal_linkID',
DropdownField::create('internal_linkID_SubsiteID', 'Subsite')
->setSource($subsites->map('ID', 'Title'))
->addExtraClass('subsitestreedropdownfield-chooser no-change-track')
);
$internalLinkField = SubsitesTreeDropdownField::create(
@ninty9notout
ninty9notout / CMSMainExtension.php
Last active April 4, 2019 02:07
Remove the preview field from SilverStripe
<?php
use SilverStripe\Core\Extension;
use SilverStripe\Forms\Form;
class CMSMainExtension extends Extension
{
/**
* Removes the CMS preview by removing the literal field which
* renders the page. This needs to be attached to `CMSMain`:
@ninty9notout
ninty9notout / Housekeeping.php
Created May 5, 2020 15:25
SilverStripe 2 Versioned Records Housekeeping
<?php
ini_set('memory_limit', '256M');
ini_set('max_execution_time', '600');
class Housekeeping extends BuildTask
{
/**
* @var string
*/
@ninty9notout
ninty9notout / detect.js
Last active October 28, 2021 13:37
Detect browser and add class to <html> tag
// Credit to https://stackoverflow.com/a/9851769
(function () {
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = (!!navigator.userAgent.match(/iPad/i) || !!navigator.userAgent.match(/iPhone/i) && !!navigator.userAgent.match(/WebKit/i) && !navigator.userAgent.match(/CriOS/i)) || /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));
// Internet Explorer 6-11