Skip to content

Instantly share code, notes, and snippets.

Avatar

Alyson Hurt alykat

View GitHub Profile
@alykat
alykat / iterm_dgnext.scpt
Last active Jan 28, 2019
AppleScript to launch a three-paned iTerm2 window for nprapps/dailygraphics-next
View iterm_dgnext.scpt
tell application "iTerm"
tell current window
tell current session
-- dailygraphics-next tool pane
set name to "dailygraphics-next"
set webserver to (split vertically with default profile)
-- CHANGE path to your needs
write text "cd ~/src/dailygraphics-templates/"
write text "git pull"
-- CHANGE path to your needs
@alykat
alykat / gist:5fabb42475a6111ccc38591bac09550a
Created Apr 1, 2016
D3: Wrap label text and make SVG taller
View gist:5fabb42475a6111ccc38591bac09550a
/*
* Wrap a block of text to a given width
* via http://bl.ocks.org/mbostock/7555321
*/
var wrapText = function(texts, width, lineHeight) {
texts.each(function() {
var text = d3.select(this);
var words = text.text().split(/\s+/).reverse();
var word = null;
@alykat
alykat / dailygraphics.applescript
Last active Jun 7, 2016 — forked from dannydb/gist:74399d474ed14da3637b
NPR dailygraphics launcher from iTerm2
View dailygraphics.applescript
tell application "iTerm"
activate
tell the current terminal
activate current session
-- launch dailygraphics tab
launch session "Default Session"
tell the last session
set name to "dailygraphics"
@alykat
alykat / workon_project.applescript
Last active Aug 29, 2015 — forked from dannydb/workon_project.applescript
Applescript NPR project launcher for iTerm2
View workon_project.applescript
tell application "iTerm"
activate
set projectSlug to the text returned of (display dialog "Which project?" default answer "")
tell the current terminal
activate current session
launch session "Default Session"
View keybase.md

Keybase proof

I hereby claim:

  • I am alykat on github.
  • I am alykat (https://keybase.io/alykat) on keybase.
  • I have a public key whose fingerprint is 1F37 2C61 4F2B 48EB C59C 3CF4 6328 DBDE 3BB8 9EE5

To claim this, I am signing this object:

@alykat
alykat / dailygraphics-pym-child.js
Created May 27, 2014
Blog Post: dailygraphics pym child
View dailygraphics-pym-child.js
var pymChild = null;
...
$(window).load(function() {
pymChild = new pym.Child({
renderCallback: render
});
})
@alykat
alykat / dailygraphics-pym.html
Created May 27, 2014
Blog Post: dailygraphics pym embed
View dailygraphics-pym.html
<div id="responsive-embed-my-new-graphic">
</div>
<script src="http://apps.npr.org/dailygraphics/graphics/my-new-graphic/js/lib/pym.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var pymParent = new pym.Parent(
'responsive-embed-my-new-graphic',
'http://apps.npr.org/dailygraphics/graphics/my-new-graphic/child.html',
{}
);
@alykat
alykat / copytext_table.html
Last active Aug 29, 2015
Blog post: Jinja/copytext sample code
View copytext_table.html
<table>
<thead>
<tr>
<th>{{ COPY.labels.hdr_category }}</th>
<th>{{ COPY.labels.hdr_jan }}</th>
<th>{{ COPY.labels.hdr_feb }}</th>
<th>{{ COPY.labels.hdr_mar }}</th>
</tr>
</thead>
View filmstrip-resize.js
...
var $filmstrip_cotton = $('#boxes').find('.filmstrip-wrapper');
var $filmstrip_cotton_wrapper = $('#boxes').find('.filmstrip-outer-wrapper');
...
var filmstrip_cotton_aspect_width = 720;
var filmstrip_cotton_aspect_height = 528;
...
function size_filmstrip() {
var filmstrip_cotton_width = $filmstrip_cotton_wrapper.width();
var filmstrip_cotton_height = Math.ceil((filmstrip_cotton_width * filmstrip_cotton_aspect_height) / filmstrip_cotton_aspect_width);
View filmstrip-keyframes.css
@-webkit-keyframes filmstrip {
0% {background-position:0 -0%;-webkit-animation-timing-function:steps(1);}
4% {background-position:0 -100%;-webkit-animation-timing-function:steps(1);}
8% {background-position:0 -200%;-webkit-animation-timing-function:steps(1);}
...