Skip to content

Instantly share code, notes, and snippets.

View erochest's full-sized avatar

Eric Rochester erochest

View GitHub Profile
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Creator</title>
</head>
<body vocab="http://bibframe.org/vocab/" resource="http://id.loc.gov/resources/bibs/11185095.html" typeof="Work">
<h1>
<a href="http://id.loc.gov/resources/bibs/11185095.html">
import datetime
input_time = 'Fri May 29 09:23:40 EDT 2015'
parsed = datetime.datetime.strptime(input_time, '%a %b %d %H:%M:%S %Z %Y')
print(parsed.toordinal())
# 735747
print(str(parsed))
@erochest
erochest / reply.coffee
Created April 7, 2015 17:13
Using an object/map/set instead of a switch statement.
inputs = [
"hello"
"howdy"
"how's it going?"
"what's up?"
"yo"
]
output = "Hey!"
@erochest
erochest / Validating.lhs
Last active August 29, 2015 14:17
Validating Data with Types
Validating Data with Types
==========================
Recently, I had to opportunity to help J. Warren York, a graduate student in
the Department of Politics here at UVa. He's looking at how tax law affects
political contributions and support for bills, so this was an interesting
project that may tell us something useful about how the US government works
[insert your favorite broken-government joke here].
To do this, he needed to download data from a number of different sources in
@erochest
erochest / Dockerfile
Last active August 29, 2015 14:15
Docker stuff to get WordPress/Ivanhoe running using Fig (http://www.fig.sh/wordpress.html). Excuse me, docker-compose.
FROM orchardup/php5
ADD . /code

Hey,

I think I have a better idea of what you're trying to accomplish from this. Hopefully, we'll get it sorted out soon. Maybe.

I think that the easiest -- if not the prettiest -- way of handling this is to include the modal in the exhibit's Narrative. In the exhibit settings page, click the Source button in the Narrative field.

At the bottom of the text box, add something like this:

#!/usr/bin/env python3
import shutil
import subprocess
def git_status():
return subprocess.check_output(
['git', 'status', '--short']
def get_field(item, key):
"""Returns key from the sourceResource as a list of strings."""
values = item[u'sourceResource'].get(key, [u' '])
if isinstance(values, basestring):
values = [values]
return values
def get_text(f, json_data):
for each in json_data:
f = <function f at 0x10b218938>
F.m = <unbound method F.m>
i.m = <bound method F.m of <__main__.F instance at 0x10b214998>>
F.cm = <bound method classobj.cm of <class __main__.F at 0x10b1e1a10>>
F.sm = <function sm at 0x10b218b18>

Keybase proof

I hereby claim:

  • I am erochest on github.
  • I am erochest (https://keybase.io/erochest) on keybase.
  • I have a public key whose fingerprint is CFD1 1209 83DF 681D FE50 7325 0EB4 C610 E150 F161

To claim this, I am signing this object: