Skip to content

Instantly share code, notes, and snippets.

View gordonbanderson's full-sized avatar

Gordon Anderson gordonbanderson

  • Nonthaburi, Thailand
View GitHub Profile
/* An HTML template in 180 bytes (minified)
Features: Escapes HTML, accepts either strings or functions as values, and that's all (it doesn't handle looping).
Usage:
OneEightyT(
"<h1>{name}</h1><div>{content} @ {currentTime}</div>",
{
name: "Stella",
@sheadawson
sheadawson / ss-inline-requirements
Created June 18, 2015 01:34
SilverStripe Custom Requirements - put css and js file contents into the page
<?php
class Page_Controller extends ContentController{
/**
* Require a custom script from a file
* @param string $filepath
* @param bool $addMinLive - prepend .min to file extension if not in dev mode
*/
public function inlineJS($filepath, $addMinLive = true){
if(($addMinLive || $addMinLive != 'false') && !Director::isDev()) $filepath = str_replace('.js', '.min.js', $filepath);