Skip to content

Instantly share code, notes, and snippets.

View valyagolev's full-sized avatar
💭
hey there! i'm using github

Valentin Golev valyagolev

💭
hey there! i'm using github
View GitHub Profile
anonymous
anonymous / config.json
Created July 2, 2014 21:35
Bootstrap Customizer Config
{
"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",
anonymous
anonymous / config.json
Created July 2, 2014 21:21
Bootstrap Customizer Config
{
"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",
@zaius
zaius / background.sh
Created January 16, 2011 23:29
How to redirect a running process output to a file and log out
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)
@onyxfish
onyxfish / Advice from #djangocon 2010 Django-in-Journalism open-session
Created September 9, 2010 17:31
Advice from #djangocon 2010 Django-in-Journalism open-session
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.)
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)