Skip to content

Instantly share code, notes, and snippets.

View dougwt's full-sized avatar

Douglas Tyler dougwt

View GitHub Profile
@dougwt
dougwt / combinations.py
Created March 4, 2012 01:10
Python: All Possible Combinations
def combinations(n, list, combos=[]):
# initialize combos during the first pass through
if combos is None:
combos = []
if len(list) == n:
# when list has been dwindeled down to size n
# check to see if the combo has already been found
# if not, add it to our list
if combos.count(list) == 0:
import collections
import random
class RollingAverage:
"""Generates a function that tracks a rolling average of a given size."""
def __init__(self, size):
self.size = size
self.deque = collections.deque(list(), self.size)
self.count = 0
@dougwt
dougwt / snippet.css
Last active June 24, 2018 19:04
[CSS Debugging] Add borders around all your HTML elements using CSS’s universal selector. Source: https://techstacker.com/posts/byLe6TPW8Qnm38s97/css-workflow-use-borders-for-debugging-your-layouts-fast
* {
outline: 1px solid red;
}
@dougwt
dougwt / snippet.sh
Created June 25, 2018 05:37
push to execute post-receive #git
git commit --allow-empty -m "push to execute post-receive"
git push web +master:refs/heads/master
@dougwt
dougwt / css-reset.css
Last active July 17, 2018 20:27
css reset
* {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
box-sizing: border-box;
vertical-align: baseline;
background: transparent;
}