January 6, 2013
I recently saw a post on Twitter from @chpwn that described the alogorithm that Apple uses for its “rubber band” or “bungee” scrolling.
b = (1.0 – (1.0 / ((x * c / d) + 1.0))) * d
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
Build URL Validation Regex. | |
See the according *\_urls list for a definition of what we | |
want to match and what not. | |
Note that according to RFC 2612 (HTTP 1.1, Section 3.1.2) there is | |
no such thing as a maximum URI length. Since servers should |
import pytz | |
import re | |
""" | |
Trying to find a fast way to search through a list. | |
As example we use pytz's all_timezones list and set, which | |
are both pretty nicely filled with strings. | |
OSX 10.6.7, 2.53ghz Core2Duo: |
# coding: utf-8 | |
""" | |
Convert a XHTML 1.1 compliant form to a php array with Python (YIKES! :D) | |
""" | |
import re | |
# Put your form in here! | |
s = """ | |
<form action="foobar.php" method="post" accept-charset="utf8"> |
""" | |
Extract unique Python-Exceptions with their Traceback from a log/text file. | |
Usage:: | |
python extract_exceptions.py -f logfile.txt | |
Furthermore it supports excluding exceptions you don't want to have:: | |
python extract_exceptions.py -f logfile.txt -e ValueError,AttributeError |
// Note: There are no fancy error checks in here. This is just meant to quickly demonstrate this. | |
// I was extremely frustrated because most posts on stackoverflow are missing the important point | |
// of checking for the "presentedViewController". | |
// If you are working in a view that is *already living* in the view hierarchy. | |
var topMostController = view.window!.rootViewController! | |
// or | |
// If you don't have a view in the hierarchy yet (as it might happen in viewDidLoad etc.) | |
// (there is also the possibility to use UIApplication.sharedApplication().keyWindow, though it seems | |
// that the internet's general opinion is that it's safer to use the delegate's window) |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object: