I hereby claim:
- I am wolever on github.
- I am wolever (https://keybase.io/wolever) on keybase.
- I have a public key whose fingerprint is B5A9 A97F CE49 06AF 8E13 DE44 43D2 86AB B230 230D
To claim this, I am signing this object:
global_var = 42 | |
def outer_func(): | |
outer_var = 21 | |
un_used_outer_var = 16 | |
def inner_func(): | |
inner_var = 7 | |
def inner_inner_func(): | |
inner_inner_var = 3 | |
# note: the outer_var must be explicitly referenced, otherwise it won't |
""" | |
Python 2: | |
$ python-2.7 finallyfun.py | |
e: Exception() | |
Python 3: | |
$ python3.3 finallyfun.py | |
Traceback (most recent call last): | |
File "finallyfun.py", line 9, in <module> | |
foo() |
""" | |
Python's ``else:`` block is *only* executed when the ``try:`` block does not reutrn: | |
$ python else_block_example.py | |
Running function, returning in 'try:' block: False | |
in 'else' block | |
in 'finally' block | |
Running function, returning in 'try:' block: True | |
in 'finally' block | |
""" |
I hereby claim:
To claim this, I am signing this object:
mkpkg() { | |
if [[ -z "$1" ]]; then | |
echo "mkpkg: $0 PKG_DIR" | |
return 1 | |
fi | |
if [[ ! -d "$1" ]]; then | |
mkdir "$1" || return $? | |
fi | |
touch "$1/__init__.py" | |
} |
from django.conf import settings as s | |
from django.template import Parser, Lexer, Context, Library, StringOrigin | |
lib = Library() | |
def parse_template(library, origin, template_string): | |
if s.TEMPLATE_DEBUG: | |
from django.template.debug import DebugLexer, DebugParser | |
lexer_class, parser_class = DebugLexer, DebugParser | |
else: |
""" | |
The Notice Board pattern: returns the most recent value associated with a key, | |
or blocks waiting for a new value if the current value has already been seen. | |
History is not stored; only the most recent value is available. | |
The physical analogy is a notice board like you might see at a train station: | |
when you arrive at the station you can glance at the board to check the current | |
departure time for your train, or you can stand around watching the board | |
waiting for the inevitable message that your train has been delayed. |
vs() { | |
# Guesses which version control system is correct for the current | |
# directory, then executes it with "${@}": | |
# $ cd hg_repo/ | |
# $ vs version | |
# Mercurial Distributed SCM | |
# ... | |
# $ cd ../git_repo | |
# $ vs version | |
# git version 1.8.1.1 |
def monkeypatch_logging_getMessage(): | |
""" Monkey patch logging.LogRecord.getMessage so it will never, ever raise an exception. """ | |
from unstdlib import to_str | |
from logging import LogRecord | |
oldGetMessage = LogRecord.getMessage | |
def getMessage(self): | |
try: | |
return oldGetMessage(self) | |
except Exception as e: |
Are you a passionate web developer who wears skinny jeans, checks Foursquare before heading out, and builds sleek, sylish apps? We are looking for you!
We are Second Funnel - a small, growing startup making the web more visually interesting and relevant. We believe advertising currently sucks, but can be made awesome. Or at least less terrible. How? Through visuals that peek curiousity and lead to interesting, engaging content (think Pinterest meets marketing).