Skip to content

Instantly share code, notes, and snippets.

View gordonbanderson's full-sized avatar

Gordon Anderson gordonbanderson

  • Nonthaburi, Thailand
View GitHub Profile
@gordonbanderson
gordonbanderson / screenshots.rb
Created September 19, 2011 04:41
Pass in a host and a file containing URLs for that host. Screenshtos will then be created
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'yaml'
host = ARGV[0]
urlsFile = ARGV[1]
<h3 class="hide">Top Level Navigation</h3>
<div id="myslidemenu" class="jqueryslidemenu">
<a name="topLevelNavigation" class="hide"></a>
<ul class="primary-menu">
<% control Menu(1) %>
<li><a href="$Link" class="$LinkOrSection">$Title</a>
<% if Children %>
<ul>
<% control Children %>
@gordonbanderson
gordonbanderson / PHP cleaner
Created February 27, 2012 09:01
Find leading and trailing space
<?php
/***********************
*@author: Ritesh Agrawal
*@description: Identifies php files that contain leading or trailing spaces before or after PHP opening or closings tags
*@version: 1.0
*@date: Nov 06, 2007
@todo – check only *.PHP or *.CTP files rather than checking all of the files
– html based output
***********************/
//Set Source Path
@gordonbanderson
gordonbanderson / bootstrap-collapse.js
Created October 2, 2012 09:30
Resolve Issue of Navbar Collapse not Expanding Vertically in Bootstrap with optional CSS Class
/* =============================================================
* bootstrap-collapse.js v2.1.1
* http://twitter.github.com/bootstrap/javascript.html#collapse
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@gordonbanderson
gordonbanderson / cricketwood
Created October 19, 2012 04:31
Phallic Cricket X1
Phallic X1
Graeme Wood
Quinton de Kock
Peter Willey
Nigel Cock
Artie Dick
David Stiff
Dong Chao
John Thomas
@gordonbanderson
gordonbanderson / gist:5187802
Created March 18, 2013 15:05
Get translatable strings working in silverstripe templates
public function init() {
parent::init();
// needed for _t to work, see http://doc.silverstripe.org/multilingualcontent#setting_the_i18n_locale
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
}
@gordonbanderson
gordonbanderson / PageWithMap.php
Created March 30, 2013 06:25
Adding an editable map to a Silverstripe DataObject or Page
class PageWithMap extends DemoPage {
}
class PageWithMap_Controller extends DemoPage_Controller {
}
@gordonbanderson
gordonbanderson / ContactPage.php
Last active December 15, 2015 17:29
Adding multiple maps to a page using Mappable for SilverStripe 3
<?php
class ContactPage extends DemoPage {
static $has_many = array(
'Locations' => 'ContactPageAddress'
);
function getCMSFields() {
$fields = parent::getCMSFields();
<?php
class ContactPage extends DemoPage {
static $has_many = array(
'Locations' => 'ContactPageAddress'
);
function getCMSFields() {
$fields = parent::getCMSFields();
<?php
class ContactPageAddress extends DataObject {
static $db = array(
'PostalAddress' => 'Text'
);
static $has_one = array( 'ContactPage' => 'ContactPage' );
public static $summary_fields = array(