Skip to content

Instantly share code, notes, and snippets.

@Zauberfisch
Zauberfisch / SilverStripe-Clean-ModelAdmin.md
Last active October 11, 2017 13:47
Clean up SilverStripe ModelAdmin (no sidebar, no filter, no import, no print)

Clean up SilverStripe ModelAdmin (no sidebar, no filter, no import, no print)

@Zauberfisch
Zauberfisch / install-wkhtml2pdf.sh
Last active March 14, 2017 10:53
Install wkhtml2pdf on ubuntu precise 64bit (12.04 LTS) with patched QT
# I managed to get the compiled version with patched QT working on ubuntu precise 64bit (12.04 LTS) and thought I'd share my bash history in the hopes it might spare others some trouble shooting.
# Also note that this install process takes rather long, you might want to consider running it in a screen or something
# you will be needing git if you haven't got it yet
sudo apt-get install git-core
# as per installation instructions, install dependencies for wkhtmltopdf
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
# clone the repo
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf
@Zauberfisch
Zauberfisch / TranslatableControllerExtension.php
Last active December 23, 2015 13:41
SilverStripe Translatable defaults snippets
<?php
// file: mysite/code/TranslatableControllerExtension.php
class TranslatableControllerExtension extends Extension {
/**
* save the current controller to ensure we have access to it,
* this is necessary because Security crates a fake Page_Controller to render templates
* @var Controller
*/
protected static $actual_current_controller;
@Zauberfisch
Zauberfisch / DataObjectAsPage.php
Last active January 15, 2020 07:16
SilverStripe 3.x DataObject as Page with URLSegment
<?php
/**
* @author Zauberfisch
* @method ManyManyList Products()
*/
class ProductCategoryPage extends Page {
private static $many_many = array(
'Products' => 'Product',
);
@Zauberfisch
Zauberfisch / OrderableManyManyGridField.php
Created March 10, 2014 06:34
SilverStripe 3.x GridField with Orderable/Sortable ManyMany List
<?php
class Page extends SiteTree {
private static $many_many = array(
'RelatedPages' => 'Page',
);
// be careful to name the many_many_extraField something that does not conflict with existing DB fields.
// eg: 'Sort' already exists on class SiteTree, so using that will get you into trouble.
private static $many_many_extraFields = array(
'RelatedPages' => array(
@Zauberfisch
Zauberfisch / A_SilverStripe_SkyScrapers_Example.md
Last active August 29, 2015 14:02
SilverStripe SkyScrapers Example

SilverStripe SkyScrapers Example

simple example of DataObjects
managed with ModelAdmin
filterable in the frontend

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
@Zauberfisch
Zauberfisch / BaseValidator.php
Last active August 29, 2015 14:13
Better SilverStripe Form Validator
<?php
/**
* @author zauberfisch
*/
class BaseValidator extends Validator {
protected $validateFields, $requireFields;
/**
* @param bool|string[]|\FormField[]|\FieldList $validateFields
@Zauberfisch
Zauberfisch / PhoneNumberField.php
Created July 22, 2015 20:10
Custom SilverStripe PhoneNumberField
<?php
/*
class MyDataObject extends DataObject {
private static $db = [
'FoobarCountryCode' => 'Varchar',
'FoobarAreaCode' => 'Varchar',
'FoobarPhoneNumber' => 'Varchar',
'FoobarExtension' => 'Varchar',
];
@Zauberfisch
Zauberfisch / i3-disable-focus-wrapping.md
Last active March 18, 2024 04:08
i3 Window Manager - disable focus wrapping / cycling

i3 Window Manager - disable focus wrapping / cycling

Switching window focus ($mod+Up / $mod+Right / $mod+Down / $mod+Left) in i3 cycles through all windows on a workspace, meaning when you hit one edge of the screen, it will start again on the other side.

I was looking for a way to disable that, but was unable to find a way to change this via configuration. Therefore I have created the following script.

Place i3-focus-nowrap.sh somewhere within your path (eg /usr/local/bin) or use an absolute reference in the keybindings below. And replace the keybindings in your .i3 config (eg ~/.i3/config)