I hereby claim:
- I am originell on github.
- I am luisnell (https://keybase.io/luisnell) on keybase.
- I have a public key ASBSXlh0oSykmXPzBbtfCfhn7L78G_MEjr3WiytHvw1U-go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // 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) |
| """ | |
| 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 |
| # 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"> |
| 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: |
| #!/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 |