""" | |
Django ORM Optimization Tips | |
Caveats: | |
* Only use optimizations that obfuscate the code if you need to. | |
* Not all of these tips are hard and fast rules. | |
* Use your judgement to determine what improvements are appropriate for your code. | |
""" | |
# --------------------------------------------------------------------------- |
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# [email protected] | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
from wtforms import fields | |
import json | |
class JSONField(fields.StringField): | |
def _value(self): | |
return json.dumps(self.data) if self.data else '' | |
def process_formdata(self, valuelist): | |
if valuelist: |
Hi Nicholas,
I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:
The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't
CREATE EXTENSION plpython2u; | |
-- TODO: | |
-- 1) Кэш соединения с ZMQ | |
-- 2) Найти оптимальный способ сериализаци данных | |
-- 3) Рассмотреть вариант с LISTEN/NOTIFY и PGQ | |
CREATE OR REPLACE FUNCTION row_trigger() | |
RETURNS TRIGGER | |
AS $$ | |
import json, zmq |
Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution
I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)
#!/bin/bash | |
NAME=flower | |
DESC="flower daemon" | |
# Name of the projects settings module. | |
export DJANGO_SETTINGS_MODULE="yourproject.settings" | |
# Path to virtualenv | |
ENV_PYTHON="/home/youruser/.virtualenvs/yourvirtualenv/bin/python" |
// MultiExporter.jsx | |
// Version 0.1 | |
// Version 0.2 Adds PNG and EPS exports | |
// Version 0.3 Adds support for exporting at different resolutions | |
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize | |
// Version 0.5 Fixed cropping issues | |
// Version 0.6 Added inner padding mode to prevent circular bounds clipping | |
// | |
// Copyright 2013 Tom Byrne | |
// Comments or suggestions to [email protected] |
SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass