Skip to content

Instantly share code, notes, and snippets.

View jonathanhefner's full-sized avatar

Jonathan Hefner jonathanhefner

View GitHub Profile
@jonathanhefner
jonathanhefner / index.html
Last active August 29, 2015 14:18
Fast Youtube playback
<html>
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script type="text/javascript">
var youtubeVideoId = window.location.hash ? window.location.hash.substring(1) : 'ylLzyHk54Z0';
@jonathanhefner
jonathanhefner / gist:3278279
Created August 6, 2012 20:46
Finding saddle points in a matrix
arr1 = [[39, 43, 49, 29, 18], [30, 47, 24, 29, 15], [49, 50, 39, 20, 33], [18, 38, 35, 32, 35], [29, 44, 18, 34, 44]]
arr2 = [[50, 27, 36, 43, 39], [36, 14, 35, 40, 19], [20, 33, 48, 32, 40], [41, 40, 15, 22, 19], [21, 24, 24, 31, 18]]
arr3 = [[39, 43, 49, 29, 18], [30, 47, 24, 29, 15], [49, 50, 39, 20, 33], [18, 38, 35, 32, 38], [29, 44, 18, 34, 44]]
# The simple solution: excluding the transpose, is O(3n) ==> O(n).
[arr1, arr2, arr3].each do |matrix|
saddle_points = []
@jonathanhefner
jonathanhefner / gist:3229878
Created August 1, 2012 19:13
CSS-only technique to remove whitespace from between inline-block elements
<!--
Here is a CSS-only technique to remove whitespace from between inline-block
elements. Note that any text nodes that are direct children of the
containing-element will need their font-size manually readjusted.
-->
<style type="text/css">
.big-text {
font-size: 48px;
}
@jonathanhefner
jonathanhefner / gist:3173850
Created July 25, 2012 01:29
CSS-only technique to keep vertical rhythm with 1-2 line headings
<!--
Here is a CSS-only technique to keep vertical rhythm even with
2-line headings that have an out-of-sync line-height. Headings
with 3 or more lines still break rhythm, but hopefully they are
sufficiently uncommon.
-->
<style type="text/css">
.container {
width: 400px;