- Rule of Modularity: Write simple parts connected by clean interfaces.
- Rule of Clarity: Clarity is better than cleverness.
- Rule of Composition: Design programs to be connected to other programs.
- Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
- Rule of Simplicity: Design for simplicity; add complexity only where you must.
- Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
- Rule of Transparency: Design for visibility to make inspection and debugging easier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author qiao / https://github.com/qiao | |
* @author mrdoob / http://mrdoob.com | |
* @author alteredq / http://alteredqualia.com/ | |
* @author WestLangley / http://github.com/WestLangley | |
* @author erich666 / http://erichaines.com | |
*/ | |
/*global THREE, console */ | |
// This set of controls performs orbiting, dollying (zooming), and panning. It maintains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
body { margin:0; padding:0; } | |
#map { width:960px; height:500px; background:cyan; } | |
</style> | |
</head> | |
<body> |
Elaborating on the reasons given in Dijkstra's memo on the topic, we observe the following:
- Ranges are of the form 1 ≤ i < N + 1.
- The last element of a sequence has index N.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
from itertools import permutations | |
def normalize_cm(connectivity_matrix): | |
"""Render a square connectivity matrix into a normal form. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Memory-aware LRU Cache function decorator | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
A modification of the builtin ``functools.lru_cache`` decorator that takes an | |
additional keyword argument, ``use_memory_up_to``. The cache is considered full | |
if there are fewer than ``use_memory_up_to`` bytes of memory available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/env/sh | |
# Test various ways of flipping '1's and '0's in a Python binary string. | |
TEST="'111101111010001000100100001'" | |
TESTINT="129831201" | |
echo "Bit manipulation given decimal int:" | |
PYSTRING="i = $TESTINT; bin((i ^ (2 ** (i.bit_length()+1) - 1)))[3:]" | |
echo "$PYSTRING\n" |
Forked from @agnoster's zsh theme. Incorporates changes from @smileart's fork.
- The current path is right aligned, so it's out of the way when working in deeply nested directories. The main, left-aligned prompt only the current directory's name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json, StringIO, gzip, alfred, urllib, urllib2, datetime, time | |
def voiteImg(votes): | |
if votes < 0: | |
imgStr = 'so--1.png' | |
elif votes == 0: | |
imgStr = 'so-0.png' | |
elif votes >0 and votes <10: | |
imgStr = 'so-1-1.png' | |
elif votes >= 10 and votes <50: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" original github repos | |
Bundle 'wincent/Command-T' | |
Bundle 'sjl/gundo.vim' | |
Bundle 'tpope/vim-abolish' | |
Bundle 'tpope/vim-commentary' | |
Bundle 'digitaltoad/vim-jade' | |
Bundle 'tpope/vim-repeat' | |
Bundle 'tpope/vim-speeddating' | |
Bundle 'tpope/vim-unimpaired' | |
Bundle 'kchmck/vim-coffee-script' |