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
{ | |
"vars": { | |
"@gray-darker": "lighten(#000, 13.5%)", | |
"@gray-dark": "#646464", | |
"@gray": "lighten(#000, 33.5%)", | |
"@gray-light": "lighten(#000, 46.7%)", | |
"@gray-lighter": "lighten(#000, 93.5%)", | |
"@brand-primary": "#323232", | |
"@brand-success": "#5cb85c", | |
"@brand-info": "#5bc0de", |
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
{ | |
"vars": { | |
"@gray-darker": "lighten(#000, 13.5%)", | |
"@gray-dark": "#646464", | |
"@gray": "lighten(#000, 33.5%)", | |
"@gray-light": "lighten(#000, 46.7%)", | |
"@gray-lighter": "lighten(#000, 93.5%)", | |
"@brand-primary": "#323232", | |
"@brand-success": "#5cb85c", | |
"@brand-info": "#5bc0de", |
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
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 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
Suggestions from the 11 hackers at the table: | |
* Use connection pooling (pgpool). | |
* Don't expect reporters to get excited until you can show them something. (Find a way to appeal to reporters interests.) | |
* Only update what's changed. (e.g. on election results: show changes, not raw numbers) | |
* Use the AP's "dbready" format for election results. | |
* Use CSV for everything. | |
* Use pdb with runserver for debugging. | |
* Beware circular imports when using Haystack. | |
* Make the case for building news apps with government data. (Niran will provide numbers showing that people look at it.) |
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 attach_foreignkey(objects, field, select_related=None): | |
""" | |
Shortcut method which handles a pythonic LEFT OUTER JOIN. | |
``attach_foreignkey(posts, Post.thread)`` | |
""" | |
field = field.field | |
qs = field.rel.to.objects.filter(pk__in=distinct(getattr(o, field.column) for o in objects)) | |
if select_related: | |
qs = qs.select_related(*select_related) |