As configured in my dotfiles.
start new:
tmux
start new with session name:
| def my_local(init): | |
| key = object() | |
| def getter(): | |
| t = _app_ctx_stack.top | |
| l = getattr(t, 'my_locals') | |
| if l is None: | |
| t.my_locals = l = {} | |
| if key not in l: | |
| l[key] = init() | |
| return l[key] |
| def find(diamonds, share, shift=0, skip=()): | |
| for i in range(shift, len(diamonds)): | |
| if i in skip: | |
| continue | |
| d = diamonds[i] | |
| if d > share: | |
| continue |
| from inspect import getattr_static | |
| class dep: | |
| name = None | |
| def __init__(self, type): | |
| self.type = type |
| __author__ = 'archeg' | |
| import httplib | |
| import urllib | |
| import urllib2 | |
| import re | |
| def URLRequest(url, params, headers, method="GET"): | |
| if method == "POST": |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] | |
| jsoneditor.js:4923 [] |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| def add_preview_for(*fields): | |
| """ | |
| This is a decorator for model classes that adds preview methods. | |
| So instead of manually adding preview methods: | |
| >>> class Student(models.Model): | |
| ... photo = models.ImageField() | |
| ... icon = models.ImageField() | |
| ... |
| def find_best_subarray(array): | |
| best_sum = 0 | |
| best_start = 0 | |
| best_end = 0 | |
| cur_sum = 0 | |
| cur_start = 0 | |
| cur_end = 0 | |
| for i, x in enumerate(array): |
| import requests | |
| from boto.s3.connection import S3Connection | |
| c = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KET) | |
| data = 'file content' | |
| filename = 'dir/name.txt' | |
| bucket_name = 'your-bucket-name' | |
| headers = {'Content-Type': 'text/plain'} |
| """ | |
| This module is no more needed. It could be useful for implementing Django-level authentication. | |
| Now it works using DRF-level authentication -- dating.apps.mongo_auth.authentication.MongoTokenAuthentication. | |
| So it's here JFYI. | |
| """ | |
| # from django.contrib import auth | |
| from django.utils.functional import SimpleLazyObject | |
| from .models import User, AnonymousUser |