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 python | |
import sys | |
import itertools | |
TIME_HIGH_GOAL = int(sys.argv[1]) | |
TIME_LOW_GOAL = int(sys.argv[2]) | |
print 'Seeking optimal R1, R2 and C1 values for a %i pulse every %i milliseconds...' % (TIME_HIGH_GOAL, TIME_LOW_GOAL) |
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
### Keybase proof | |
I hereby claim: | |
* I am onyxfish on github. | |
* I am onyxfish (https://keybase.io/onyxfish) on keybase. | |
* I have a public key whose fingerprint is 9D2F F7F8 83C0 E286 25B5 3BA2 B7C0 7A1B 908A E10B | |
To claim this, I am signing this object: |
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
We use Google Spreadsheets as a de facto CMS for most of our apps team projects. Examples: | |
http://apps.npr.org/best-books-2013/ | |
http://www.lobbyingmissouri.org/ | |
We store both the data and the text (copy) for the apps in those spreadsheets. Whenever we deploy we curl those spreadsheets, pull the data out of them and plug it into the app. This allows us the flexibility of collaboratively aggregating and editing application content with our reporters, without them needing to be able to run the app. | |
The Achilles hill of this process is that it currently requires us to manually go to File -> Publish to Web -> Republish now, in order for the latest data to be downloaded. This is very inconvenient when we are iterating quickly. I understand we could work around this by auth'ing to the API, but that's a) unnecessarily complicated and b) requires we deal with storing all those credentials or having a shared user account. | |
Two solutions spring to mind: |
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
// Never relayout the grid more than twice a second | |
var relayout = _.throttle(function() { | |
$books_grid.isotope('reLayout'); | |
}, 500); | |
/* | |
* Begin unveiling visible books in the grid. | |
*/ | |
var unveil_grid = function() { |
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
var BITMAPS = { | |
BIRD_OF_PREY: [ | |
[0,0,0,0,0,0,0,0,0], | |
[0,0,1,1,1,1,1,1,0], | |
[0,1,0,1,0,0,0,0,0], | |
[0,1,1,1,0,0,0,0,0], | |
[0,1,0,0,1,0,0,0,0], | |
[0,1,0,0,0,1,1,1,0], | |
[0,1,0,0,0,1,1,1,0], | |
[0,1,0,0,0,1,1,0,0], |
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
function render_glyphs(glyph_set) { | |
/* | |
* Render the SVG ornament glyphs. | |
*/ | |
for (var i = 0; i < glyph_rects.length; i++) { | |
glyph_rects[i].remove(); | |
} | |
glyph_rects = []; |
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
svg = request.form.get('image', None) | |
svg = re.sub('(height|width)=\"[0-9]+\"', '', svg, 2) | |
# Fix for duplicate namespaces in IE... | |
if svg.count('xmlns="http://www.w3.org/2000/svg"') > 1: | |
svg = svg.replace('xmlns="http://www.w3.org/2000/svg"', '', 1) |
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
<!-- GOOGLE ANALYTICS --> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js'; | |
_gaq.push(['_require', 'inpage_linkid', pluginUrl]); | |
_gaq.push(['_setAccount', 'UA-5828686-4']); | |
_gaq.push(['_setDomainName', 'npr.org']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
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 python | |
class SevenObject(object): | |
def __add__(self, other): | |
return 7 + other | |
def __sub__(self, other): | |
return 7 - other | |
seven = SevenObject() |