- Use “Instant Run” whenever possible: https://developer.android.com/studio/run/index.html#instant-run
- Genymotion is a fast emulator: https://www.genymotion.com/
https://developer.android.com/studio/write/annotations.html
- Nullness
- VisibleForTesting
| import subprocess | |
| import time | |
| import select | |
| import sys | |
| def stream_procs(procs, poll_interval_ms=100, timeout_ms=None): | |
| """ | |
| yields output for all processes until they're all finished |
| import subprocess | |
| import time | |
| from queue import Queue, Empty | |
| from threading import Thread | |
| import sys | |
| def _enqueue_output(out, queue): | |
| for line in iter(out.readline, b''): | |
| queue.put(line) |
| /** | |
| * Implementing promises from scratch. Turns out simple | |
| * | |
| * There are only two possibilities: | |
| * 1. then() gets called before the async function finishes | |
| * 2. then() gets called after the async function finishes | |
| * | |
| * as long as we handle both, we're good! | |
| */ |
| # encrypt | |
| openssl enc -aes-256-cbc -in un_encrypted.data -out encrypted.data | |
| # decrypt | |
| openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data |
| from multiprocessing import Process, Queue | |
| import time | |
| import os | |
| def worker(q, output_q): | |
| while True: | |
| print 'im the worker', os.getpid() | |
| print 'got ', q.get() | |
| output_q.put(55) |
https://developer.android.com/studio/write/annotations.html