Skip to content

Instantly share code, notes, and snippets.

View julianwachholz's full-sized avatar
🤓

Julian Wachholz julianwachholz

🤓
View GitHub Profile
%% Erlang Programming, exercise 4-2
%%
%% A variant where the message is passed M times around.
%%
-module (ring).
-compile(export_all).
%% N processes in a ring pass around Message a total of M times.
start(N, Message, M) ->
@julianwachholz
julianwachholz / fields.py
Created September 26, 2013 19:21
Easy single `<input>` month/year form field for Django.
class CreditCardExpirationField(forms.DateField):
default_error_messages = {
'min_value': _("This card has expired."),
'invalid': _("Please specify a valid expiration date.")
}
widget = forms.DateInput(format='%m/%Y')
input_formats = ('%m/%Y', '%m/%y')
default_validators = [
MinValueValidator(now().date()),
]
https://speakerdeck.com/mdo/frameworks-of-tomorrow
# Today
- Bootstrap
- Foundation
- Gumby
- tuktuk
- Pure (Adobe)
@julianwachholz
julianwachholz / product.php
Created July 2, 2013 15:12
Lovely ancient jQuery code.
function remove(obj){
if( $(obj).parent().parent().hasClass('unstored') ){
$(obj).parent().parent().remove();
}else{
$(obj).parent().parent().find('input[type="text"], textarea').val('');
$(obj).parent().parent().hide();
}
return false;
}
class ImageQuerysetMixin(object):
"""
Make sure to use the correct arguments for getting a single image.
With this mixin it's not possible to request an image just by its
primary key, we'll also need the correct username.
"""
def get_queryset(self):
return self.model.objects.filter(
def has_verified_email(self):
try:
verification = self.emailverification
except EmailVerification.DoesNotExist:
return True
return verification.is_verified()
has_verified_email.boolean = True
activation_link = user.registrationprofile.get_absolute_url()
self.assertIn(activation_link, mail.outbox[0].body)
import sys
from tcunittest import TeamcityTestRunner
from tcmessages import TeamcityServiceMessages
from pycharm_run_utils import adjust_django_sys_path
from nose_utils import TeamcityNoseRunner
adjust_django_sys_path()
jsoncontactlist = PAGE
jsoncontactlist {
10 = USER_INT
10 {
userFunc = Tx_Extbase_Core_Bootstrap->run
extensionName = hsgtalents
pluginName = message
controller = Message
controllerConfiguration {
Message = findRecipients