Skip to content

Instantly share code, notes, and snippets.

View pdc's full-sized avatar

Damian Cugley pdc

View GitHub Profile
@pdc
pdc / README.md
Created February 25, 2017 11:17
Draft plate for keyboard X-1

Draft drawings of plate with kerf=0.18

@pdc
pdc / flext.css
Last active October 4, 2016 16:24
Thing list using Flexbox
body {
margin: 0;
padding: 0;
font-family: "Source Sans Pro", "Helvetica Neue", "Arial", "Helvetica", sans-serif;
line-height: 1.25;
color: rgba(0, 0, 0, 0.8);
}
.thing-icon {
@pdc
pdc / build.log
Created February 26, 2016 16:57
Git-based dependency on Material UI doesn’t auto-build
> material-ui-example-webpack@0.14.4 build /ssd/workspaces/webpack-example
> webpack --config webpack-production.config.js --progress --colors
Hash: 80afde4fdbabcf757e1f
Version: webpack 1.12.14
Time: 3023ms
[0] multi main 28 bytes {0} [built]
+ 165 hidden modules
ERROR in ./src/app/Main.jsx
@pdc
pdc / commands.txt
Created February 19, 2015 15:48
Cannot import numpy on pypy 2.5 on Mac OS X 10.8.5
mkvirtualenv --python=$(which pypy) trynumpy
pip install git+https://bitbucket.org/pypy/numpy.git
pypy -c 'import numpy'
@pdc
pdc / README.markdown
Last active August 29, 2015 14:08
How many users added per day, including rows for days with no registrations

Wanted to make a table of net user growth for further analysis in some spreadsheet or other.

The obvious query (in the snippet it is the inner query) only generates rows for days with at least one registration. For this to make nice charts, we need to add blank rows with the missing dates. The set returning function generate_series creates the equivalent of a temporary table to join with.

@pdc
pdc / directions.markdown
Created September 29, 2014 13:59
Which direction do rotations go in on various systems?

Rotation directions

WhatDirectionUnit
HTML5 CanvasClockwiseRadians
ImageMagickClockwiseDegrees
@pdc
pdc / x.markdown
Last active August 29, 2015 13:57
Experiment with gist.io

More on this subject in a document at Gist.io

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget diam quis elit volutpat pulvinar. Vestibulum non magna vel mi varius tincidunt quis eu justo. Sed lorem purus, gravida nec consectetur a, ultricies ut turpis.

Aliquam ornare justo ut felis porttitor consectetur. Morbi posuere quam vitae ultricies sagittis. Sed gravida augue vel enim faucibus, non feugiat erat venenatis. Nulla non urna ac orci tincidunt interdum. Phasellus semper tellus nec lobortis hendrerit.

Sed quis nunc nec augue tempus posuere. Curabitur rutrum arcu in risus laoreet laoreet. Sed in quam non dui ornare pulvinar. Donec id dolor enim. Aliquam nec risus consectetur, dignissim massa sed, cursus tellus. Phasellus sollicitudin erat sem, vitae tempus nisl scelerisque a. Duis tincidunt massa vel quam dignissim luctus. Phasellus massa nisl, gravida in venenatis semper, bibendum sed est.

@pdc
pdc / install_less.sh
Created February 28, 2014 10:48
My Heroku deployment script installs LESS via NPM and is having trouble!
#!/usr/bin/env bash
set -eo pipefail
if [ -x .heroku/python/bin/lessc ]; then exit; fi
npm install -g less
@pdc
pdc / testy.py
Created September 2, 2011 14:23
Mocking time to do time-sensitive unit tests in Python
import unittest
from mock import *
from datetime import datetime, timedelta
import time # so we can override time.time
mock_time = Mock()
mock_time.return_value = time.mktime(datetime(2011, 6, 21).timetuple())
class TestCrawlerChecksDates(unittest.TestCase):
@patch('time.time', mock_time)