A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
import subprocess, StringIO, csv | |
from simplejson import dumps | |
from firebase import Firebase | |
from time import sleep, time | |
# to install Firebase, pip install -e git://github.com/mikexstudios/python-firebase.git#egg=python-firebase | |
firebase = Firebase('https://<your_app>.firebaseio.com/stations') | |
def fetch_data(): |
x | y | z | lp_x | lp_y | lp_z | hp_x | hp_y | hp_z | ||
---|---|---|---|---|---|---|---|---|---|---|
0.235458 | -0.597702 | -0.724487 | 0.232433 | -0.593757 | -0.717156 | 0.003025 | -0.003945 | -0.007332 | ||
0.235458 | -0.597702 | -0.724487 | 0.232735 | -0.594152 | -0.717889 | 0.002723 | -0.003550 | -0.006598 | ||
0.217346 | -0.597702 | -0.724487 | 0.231197 | -0.594507 | -0.718549 | -0.013850 | -0.003195 | -0.005939 | ||
0.217346 | -0.579590 | -0.724487 | 0.229812 | -0.593015 | -0.719143 | -0.012465 | 0.013425 | -0.005345 | ||
0.199234 | -0.579590 | -0.724487 | 0.226754 | -0.591673 | -0.719677 | -0.027520 | 0.012083 | -0.004810 | ||
0.199234 | -0.597702 | -0.760712 | 0.224002 | -0.592276 | -0.723781 | -0.024768 | -0.005426 | -0.036931 | ||
0.163010 | -0.579590 | -0.706375 | 0.217903 | -0.591007 | -0.722040 | -0.054893 | 0.011417 | 0.015665 | ||
0.108673 | -0.597702 | -0.724487 | 0.206980 | -0.591676 | -0.722285 | -0.098307 | -0.006026 | -0.002203 | ||
0.090561 | -0.615814 | -0.724487 | 0.195338 | -0.594090 | -0.722505 | -0.104777 | -0.021724 | -0.001982 |
# lsusb | |
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub | |
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. | |
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. | |
Bus 001 Device 006: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub | |
Bus 001 Device 009: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset | |
# cat d.py | |
import pyaudio |
// Determine if an element is in the visible viewport | |
function isInViewport(element) { | |
var rect = element.getBoundingClientRect(); | |
var html = document.documentElement; | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || html.clientHeight) && | |
rect.right <= (window.innerWidth || html.clientWidth) | |
); |
-moz-appearance
to none
. This will "reset" the styling of the element;text-indent
to 0.01px
. This will "push" the text a tiny bit[1] to the right;sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Photos with Friends!</title> | |
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script> | |
<script> | |
/** | |
* This is the getPhoto library | |
*/ |
o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
O.......Recursively open the selected directory..................|NERDTree-O|
""" | |
File watchdog. | |
REQUIREMENT | |
Watchdog Python package <http://packages.python.org/watchdog/> | |
USAGE | |
python watchdog-file.py echo something changed. # Ctrl-C to stop. | |
python watchdog-file.py "make test && make install" | |
""" |