Skip to content

Instantly share code, notes, and snippets.

View cpdean's full-sized avatar

Conrad cpdean

View GitHub Profile
@cpdean
cpdean / README.md
Last active February 28, 2016 18:22
dynamic network
type DocumentBody = Raw String | Words List String
tokenize: DocumentBody -> List String
tokenize s =
case s of
Raw str_body -> String.split " " str_body |> (List.map String.toLower)
Words list_body -> List.map String.toLower list_body
-- Tests
@cpdean
cpdean / ergodox.ascii.txt
Last active August 31, 2016 21:20
Stealing this from a forum. want to keep better track of ergodox layout outside of massdrop's tool
/* LAYER 0
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | Esc | 1 | 2 | 3 | 4 | 5 | + = | | +L2 | 6 | 7 & | 8 * | 9 ( | 0 ) | -_ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | \ | | | { | Y | U | I | O | P | } ] |
* |--------+------+------+------+------+------| \ | | | [ |------+------+------+------+------+--------|
* | LCtrl | A | S | D | F | G |------| |------| H | J | K | L | ; : | ' " |
* |--------+------+------+------+------+------| ~L1 | | ~L1 |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | ,< | . > | / ? | RShift |
@cpdean
cpdean / .bash_profile
Created August 5, 2015 20:30
source aws creds from the cred file
export AWS_CREDENTIAL_FILE=/Users/deanc/.aws_credential_file
export AWS_SECRET_ACCESS_KEY=$(cat $AWS_CREDENTIAL_FILE | grep -i secret | cut -d "=" -f 2)
export AWS_ACCESS_KEY_ID=$(cat $AWS_CREDENTIAL_FILE | grep -i access | cut -d "=" -f 2)

which?

$ which which
/usr/bin/which
$ which $(!!)
which $(which which)
/usr/bin/which
$ which $(!!)
which $(which $(which which))
/usr/bin/which

Collecting examples that break or do not break.

Next step is refactoring the broken bq example into the https requests example using the same http lib that bq does.

need to get to the root of why SSLErrors are thrown

@cpdean
cpdean / gist:f842ec19b485e76e7228
Created January 24, 2015 21:46
look at that ipython magic
In [8]: !ls
README.tmpenv bin include lib share
In [9]: [i.upper() for i in _]
Out[9]: ['README.TMPENV', 'BIN', 'INCLUDE', 'LIB', 'SHARE']
@cpdean
cpdean / examples.sh
Created December 3, 2014 22:08
parallel demo
#!/bin/bash
# pull out census data per city file and put it into its own file
for i in $(ls raw_city_data/);
do
echo "parsing $i"
grep -i "census:population" raw_city_data/$i > census_populations/$i
done
# do the exact same thing, but takes a third the time (and makes your computer very very warm)
@cpdean
cpdean / test.py
Last active August 29, 2015 14:10
default vim python indentation example
# if you just start typing
def really_long_func_def(
a,
b,
c):
really_long_func_def(
a, # "continuation line over-indented for hanging indent"
b,
c
@cpdean
cpdean / README.md
Last active August 29, 2015 14:06
understanding zoom behavior bindings

Zoom and pan by scrolling and clicking and dragging.

view on bl.ocks.org

The difference between these two maps is how the zoom behavior is bound to them. I had been using the one on the right and unhappy with how the ability to pan was compromised the further you zoomed in. Also it had seemed jittery. After closely studying the examples from Mike Bostock I finally figured out that you have to bind the zoom behavior to the parent SVG element but have all the juicy map details as a child element, and have the zoom function manipulate that child directly. The way I had set it up originally, the zoom function was manipulating the child, but the zoom behavior was also bound directly to the child. At least that's how I understand that I did it.

What's the difference between these two ways to use the zoom behavior? Why does the one on the right act so buggy?