Skip to content

Instantly share code, notes, and snippets.

@jrast
jrast / Anmeldungen.ss
Created March 30, 2012 21:36
Silverstripe Tasks with templated email
<!-- This is located at /paht/project/themes/jotoedi/Email/Anmeldungen.ss -->
<h1>Anmeldungen für die nächsten Touren</h1>
<% control Touren %>
<h2>$TourName</h2>
<% end_control %>
@jrast
jrast / Gist.ss
Created June 14, 2012 21:47
Tutorial: ShortCodes in Silverstripe
<script src="http://gist.github.com/{$GistID}.js<% if File %>?file=$File<% end_if %>"></script>
@jrast
jrast / MyObject_Step1.php
Created July 13, 2012 17:59
Tutorial: Suche für eigene DataObjects
<?php
class MyObject extends DataObject {
static $db = array(
'Title' => 'Varchar(255)',
'Content' => 'HTMLText'
);
}
@jrast
jrast / Calendar.php
Created September 5, 2012 21:19
Passing control down to component
<?php
class Calendar extends Page {
public static $has_many = array(
'Years' => 'Year'
);
}
class Calendar_Controller extends Page_Controller {
@jrast
jrast / CancelFormAction.php
Created September 14, 2012 13:13
Tutorial: FormActions selbst gebaut
<?php
class CancelFormAction extends FormAction {
private $link;
public function __construct($link = '', $title = '', $form = null, $extraData = null, $extraClass = '') {
if(!$title) $title = _t('CancelFormAction.CANCEL', 'Cancel');
$this->setLink($link);
@jrast
jrast / MultiColumnField.py
Last active August 29, 2015 14:00 — forked from olivergeorge/gist:718687
Django model field which maps a single model field to mutliple db columns
from django.core.exceptions import ValidationError
from django.db.models import Field, CharField
__all__ = ['MultiColumnField']
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
@jrast
jrast / conf.py
Last active August 29, 2015 14:01
Acrylamid Intro-Filter Bug
# -*- encoding: utf-8 -*-
# This is your configuration file. Please write valid python!
# See http://posativ.org/acrylamid/conf.py.html
SITENAME = 'demo'
WWW_ROOT = 'http://demo.ch/'
AUTHOR = 'Demo'
EMAIL = 'mail@demo.ch'
@jrast
jrast / run_test.py
Created July 8, 2014 19:43
Nose2: such and unittest.TestCase
# -*- coding: utf-8 -*-
if __name__ == '__main__':
import logging
import nose2
logging.basicConfig(filename="such.log", level=logging.INFO)
nose2.discover()
@jrast
jrast / howTo.md
Created December 7, 2015 09:48
How To Make WinPython: Overhaul

How to make Winpython-201506 of August 2015

This procedure may help You doing your own Winpython-201506 of August 2015 distribution in about 2 hours. (multiply by 4, if you're taking the slow path)

Changelog

(v08, 2015-08-08):

  • we now use gcc Compiler provided by mingwpy wheel (same author as mingw64-static: Carl Kleffner, much simpler integration: a wheel)
  • we now use a dos batch script instead of runnin make.py interactively
@jrast
jrast / cameraCallback.py
Created March 3, 2016 14:50
Async Image grab with pymba and Vimba 1.4, not working
# -*- coding: utf-8 -*-
from pymba import *
import time, Queue
import numpy as np
def frame_cb(frame):
print("Start Callback {} with Frame {}".format(str(frame_cb), str(frame)))
img = np.ndarray(buffer=frame.getBufferByteData(),