Skip to content

Instantly share code, notes, and snippets.

View oertels's full-sized avatar

Stefan T. Oertel oertels

  • Cologne, Germany
View GitHub Profile
import React, { Component } from 'react';
import { Navigation } from 'react-native-navigation';
import { Text, View } from 'react-native';
Navigation.registerComponent('FirstTabScreen', () => <View><Text>Screen 1</Text></View>);
Navigation.registerComponent('SecondTabScreen', () => <View><Text>Screen 2</Text></View>);
Navigation.startTabBasedApp({
tabs: [
>>> complicated_multiply = lambda x: lambda y: x*y
>>> complicated_multiply(10)(20)
200

Keybase proof

I hereby claim:

  • I am schneck on github.
  • I am schneck (https://keybase.io/schneck) on keybase.
  • I have a public key whose fingerprint is D9AC 7092 E63A 2D60 8E3A BC2D 4758 FDAE 7923 026C

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.conf import settings
class LoginRequired(object):
def __init__(self):
self.login_url = getattr(settings, 'LOGIN_URL', '/accounts/login/')
def process_request(self, request):
@typecheck
def foo(bar:int) -> int:
return bar * 2
>>> foo(3)
6
>>> foo('bar')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@oertels
oertels / cigarettes.py
Created January 23, 2012 19:53
Cigarettes
from datetime import timedelta, datetime
cigarettes_at = (
datetime(2012,01,5,16,0,30),
datetime(2012,01,12,12,3,30),
datetime(2012,01,22,18,12,30),
datetime(2012,01,23,18,12,30),
)
print "Not smoking since: %s" % max(cigarettes_at)
print "Longest streak: %s" % max((x-y) for (x, y) in zip(cigarettes_at[1:], cigarettes_at[:-1]))