Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
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 r(f){/in/(document.readyState)?setTimeout(r,9,f):f()} |
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 django.db import models | |
from django.db.models import signals | |
class DeletingFileField(models.FileField): | |
""" | |
FileField subclass that deletes the refernced file when the model object | |
itself is deleted. | |
WARNING: Be careful using this class - it can cause data loss! This class | |
makes at attempt to see if the file's referenced elsewhere, but it can get |
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
""" | |
jQuery templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} means something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
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
## Copyright (C) 2011 by Jiang Yio <http://inportb.com/> | |
## Please find instructions at <http://wiki.inportb.com/python:geventreactor> | |
## The latest code is available at <https://gist.github.com/848058> | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining a copy | |
## of this software and associated documentation files (the "Software"), to deal | |
## in the Software without restriction, including without limitation the rights | |
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
## copies of the Software, and to permit persons to whom the Software is | |
## furnished to do so, subject to the following conditions: |
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
Copyright (c) 2011 Christopher Chedeau, http://blog.vjeux.com/ | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
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
Step #1 - views https://github.com/enjoydjango/dwitter/compare/step-00-startproject...step-01-views | |
Step #2 - templates https://github.com/enjoydjango/dwitter/compare/step-01-views...step-02-templates | |
Step #3 - tags https://github.com/enjoydjango/dwitter/compare/step-02-templates...step-03-tags | |
Step #4 - filters https://github.com/enjoydjango/dwitter/compare/step-03-tags...step-04-filters | |
Step #5 - inheritance https://github.com/enjoydjango/dwitter/compare/step-04-filters...step-05-inheritance | |
Step #6 - models https://github.com/enjoydjango/dwitter/compare/step-05-inheritance...step-06-models | |
Step #7 - database https://github.com/enjoydjango/dwitter/compare/step-06-models...step-07-database | |
Step #8 - tweetpage https://github.com/enjoydjango/dwitter/compare/step-07-database...step-08-tweetpage | |
Step #9 - profile https://github.com/enjoydjango/dwitter/compare/step-08-tweetpage...step-09-profile | |
Step #10 - followers https://github.com/enjoydjango/dwitter/compare/step-09-profile...step-10-followers |
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
"""XPath extension functions for lxml, inspired by: | |
https://gist.github.com/shirk3y/458224083ce5464627bc | |
Usage: | |
import xpathfuncs; xpathfuncs.setup() | |
""" | |
import string |
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
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
import os | |
from scrapy.contrib.httpcache import FilesystemCacheStorage | |
from .dupefilter import splash_requst_fingerprint | |
class SplashAwareFSCacheStorage(FilesystemCacheStorage): | |
def _get_request_path(self, spider, request): |
#System Design Cheatsheet
Picking the right architecture = Picking the right battles + Managing trade-offs
##Basic Steps
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
OlderNewer