Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
class DotNestedDict(dict): | |
""" | |
Working with nested dicts (common with mongodb resources) in | |
a easy way | |
nested = DotNestedDict({ | |
'lvl1': {'lvl2': {'lvl3': 'here'}}, | |
'collection': [0, 1, 2, 3, {'nested': 4}], | |
}) |
" Ctrl-p behaviour {{{ | |
nnoremap <Leader><Leader> :Unite -start-insert file_rec/async<CR> | |
call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
call unite#filters#sorter_default#use(['sorter_reverse']) | |
call unite#custom#source('file_mru,file_rec,file_rec/async,grep,locate', | |
\ 'ignore_pattern', join(['\.git/', 'tmp/', 'bundle/'], '\|')) | |
let g:unite_prompt = '>>> ' | |
let g:unite_winheight = 15 |
""" | |
The MIT License (MIT) | |
Copyright (c) <2013> <David Medina> | |
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 |
from django.core.exceptions import ImproperlyConfigured | |
from django.db.models import get_app | |
from django.utils.importlib import import_module | |
from rest_framework.routers import DefaultRouter | |
from rest_framework.urlpatterns import format_suffix_patterns | |
class App(DefaultRouter): | |
""" |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
threading, multiprocessing, eventloop, coroutines, celery, twisted, gevent, libevent, eventlet, libev, epoll, select, kqueue, greenlet ...
Aquí el fin último es la asincronia, no bloquear la aplicación/ejecución y para ello nos apoyamos en la concurrencia y paralelismo. También conocido como asyncronous I/O
En aplicaciones web donde networking I/O está a la orden del día, sumado a alto rendimiento (x000 request/sec) soluciones como gevent se hacen necesarias.
from base64 import b64encode | |
from suds.wsse import UsernameToken | |
try: | |
from haslib import sha1 | |
except: | |
from sha import new as sha1 |
class Noun(object): | |
def __call__(self): | |
pass | |
verb = Noun() | |
verb() |
------------------------------- ------------------ Django -------------------- | Browser: GET /udo/contact/2 | === wsgi/fcgi ===> | 1. Asks OS for DJANGO_SETTINGS_MODULE | ------------------------------- | 2. Build Request (from wsgi/fcgi callback) | | 3. Get settings.ROOT_URLCONF module | | 4. Resolve URL/view from request.path | # url(r'^udo/contact/(?P<id>\w+)', view, name='url-identifier') | 5. Apply request middlewares | # settings.MIDDLEWARE_CLASSES
class decorator(object): | |
def __init__(self, easy_args, with=1, objects=2, decorators=3) | |
self.easy_args = easy_args | |
# ... | |
def __call__(self, func): | |
@wraps(func) # django.utils.functionals.wraps or functools.update_wrapper (easy debug) | |
def wrapper(*args, **kwargs): | |
if self.do_something_with_my_args(): |