Skip to content

Instantly share code, notes, and snippets.

View hubertusanton's full-sized avatar

Bart van Irsel hubertusanton

View GitHub Profile
<% loop $Menu(1) %>
$RenderLayout
<% end_loop %>
function is_mobile() {
var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry','Android', 'webos', ,'iPod', 'iPhone', 'iPad', 'Blackberry', 'BlackBerry'];
var ismobile=false;
for(i in agents) {
if (navigator.userAgent.split(agents[i]).length>1) {
ismobile = true;
}
}
return ismobile;
}
@hubertusanton
hubertusanton / gist:6606096
Created September 18, 2013 08:08
Silverstripe 3 date region filter
public function AllChildrenInDateRegion() {
return VacaturePage::get()->filter(
array(
'ParentID' => $this->ID,
'DatumFrom:LessThan' => date('Y-m-d').' 00:00:00',
'DatumTo:GreaterThan' => date('Y-m-d').' 23:59:59'
)
);
@hubertusanton
hubertusanton / gist:6426203
Created September 3, 2013 16:29
nicer checkboxfield
$form_checkboxfield =
CheckboxField::create('ShowForm', 'Formulier tonen')
->setFieldHolderTemplate('FormField_holder_small')
->setRightTitle('Formulier tonen');
@hubertusanton
hubertusanton / gist:5901650
Created July 1, 2013 15:06
ss31 language from template with arg
<%t SITENAME.TEST 'With an argument {arg}' arg="Argument" %>
@hubertusanton
hubertusanton / gist:5900547
Last active December 19, 2015 04:58
Silverstripe 3.1 nice internal / external link field
<?php
// nice internal / external link field
$fields->replaceField('LinkExteralOrInternal', (SelectionGroup::create(
"LinkExteralOrInternal",
array(
SelectionGroup_Item::create(
"external",
TextField::create(
"ExternalLink",
"Externe link"
@hubertusanton
hubertusanton / gist:5884169
Created June 28, 2013 11:55
convert spaces to tabs shortcut sublime text
{ "keys": ["ctrl+shift+alt+~"], "command": "unexpand_tabs", "args" : {"set_translate_tabs" : true} }
#!/bin/bash
#
# ss-upgrader.sh
#
# INTRODUCTION
#
# There are some threads on the SS forums that describe the techdocs for upgrading a 2.4 site to 3.x as being too technical. Mainly from content authors who
# also happen to be site maintainers - they are not coders.
# The aim of this script is to therefore to automate - in as much as this is possible in a user-configured, open-source software project - to help those new to
# SS3 upgrade from 2.x as smoothly as possible.

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@hubertusanton
hubertusanton / gist:5856496
Created June 25, 2013 06:51
collapsible widgets Silverstripe 3
(function($) {
$('div.usedWidgetsHolder div.Widget h3').entwine({
onclick: function(){
this.nextAll().slideToggle();
}
});