This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imagine you meant to type this: | |
var x:Array = [[],[]]; | |
//But you typed this instead. These are compile-time syntax errors: | |
var x:Array = [[][]]; | |
var x:Array = [["a"][]]; | |
//But these are run-time errors: | |
var x:Array = [[]["b"]]; | |
var x:Array = [["a"]["b"]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
from functools import partial | |
import inspect | |
def accepts_block(f): | |
class _accepts_block(object): | |
#use something like this to handle calls without a with()? | |
def __call__(self, *args): | |
self.thefunction = partial(f, *args) | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These warehouse wages | |
Kill the ends introduction | |
man I should have schooled it up | |
When I was younger should have stuck to plan | |
Always had the dreams of being more self assertive | |
And my kids a teenager now he needs the health insurance | |
So break my body | |
Break break my soul down | |
Just another zombie walking blindly through your ghost town | |
Pull up to the bar to politic and tap the power |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function title { | |
echo -ne "\033]0;$1\007" | |
} | |
#put this in your .bashrc, then just type <title my_tab_name> to set the tab title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#demonstrate nested list comprehensions as cartesian set | |
deck_of_cards = [(suit, rank) for suit in ("hearts", "diamonds", "spades", "clubs") | |
for rank in range(13)] | |
####################################### | |
#demonstrate functions as first-class values | |
def double_str(x): | |
return str(x) + str(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_name(name): | |
#delete (nicknames) | |
name = re.sub("\(.*?\)", "", name) | |
names = name.split(" ") | |
first_name = names[0] | |
if len(names) > 2: | |
middle_names = [names[1]] | |
for i, n in enumerate(names[2:]): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gzip: stdin: unexpected end of file | |
Pinax-0.7.1-bundle/requirements/0.7.1/Markdown-2.0.1.tar.gz | |
tar: Unexpected EOF in archive | |
tar: Unexpected EOF in archive | |
tar: Error is not recoverable: exiting now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.wolframalpha.com/input/?i=latitude+-16.1333333,+longitude+180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valuestr = ", ".join("%%(%s)s" % r for r in column_names) | |
fetchnone_query(conn, """ | |
INSERT INTO %%(table_name)s (%%(column_names)s) | |
VALUES (%s) | |
""" % valuestr, locals()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def perm1c(lst): | |
"""A modification of perm1b to return a copied list instead of modified in place""" | |
initial = lst[:] | |
yield lst | |
lst = lst[:] | |
if len(lst) == 1: return | |
n = len(lst) - 1 | |
while 1: |