Skip to content

Instantly share code, notes, and snippets.

View juanriaza's full-sized avatar
🎯
Focusing

Juan Riaza juanriaza

🎯
Focusing
View GitHub Profile
@juanriaza
juanriaza / System Design.md
Created April 18, 2016 17:11 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. 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?
@juanriaza
juanriaza / cache.py
Last active August 29, 2015 14:11 — forked from kmike/cache.py
# -*- 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):
@juanriaza
juanriaza / xpathfuncs.py
Last active August 29, 2015 14:07 — forked from rmax/xpathfuncs.py
"""XPath extension functions for lxml, inspired by:
https://gist.github.com/shirk3y/458224083ce5464627bc
Usage:
import xpathfuncs; xpathfuncs.setup()
"""
import string
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
@juanriaza
juanriaza / LICENSE.txt
Created May 30, 2011 08:32 — forked from vjeux/LICENSE.txt
140byt.es -- Array Shuffle
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:
@juanriaza
juanriaza / geventreactor.py
Created April 26, 2011 22:08 — forked from inportb/geventreactor.py
Twisted reactor running on gevent (libevent+greenlet)
## 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:
"""
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
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

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@juanriaza
juanriaza / domready.js
Created February 24, 2011 09:46 — forked from ded/domready.js
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()}