Skip to content

Instantly share code, notes, and snippets.

View phette23's full-sized avatar
🌹
"you're right, no human being would stack books like this"

Eric Phetteplace phette23

🌹
"you're right, no human being would stack books like this"
View GitHub Profile
@phette23
phette23 / fluid-width-youtube-vid.html
Last active December 15, 2015 15:08
Markup for making a fluid-width YouTube video embed. Better to do it in markup than use FitVids, where the markup was taken from.
<!-- just replace {{id}} with the video's ID
e.g. 9bZkp7q19f0 -->
<div style="width:100%;position:relative;padding:0;padding-top:75%">
<iframe
style="position:absolute;top:0;left:0;width:100%;height:100%;"
src="http://www.youtube-nocookie.com/embed/{{id}}?rel=0"
frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen>
</iframe>
</div>
@anarchivist
anarchivist / permissive.py
Created November 24, 2012 22:36
Permissive MARC Reader subclass for pymarc
import pymarc
from pymarc.exceptions import RecordLengthInvalid, RecordLeaderInvalid
from pymarc.exceptions import BaseAddressInvalid, BaseAddressNotFound
from pymarc.exceptions import RecordDirectoryInvalid, NoFieldsFound
class PermissiveMARCReader(pymarc.MARCReader):
"""PermissiveMARCReader: recovers from most pymarc exceptions"""
def __init__(self, marc_target, to_unicode=False, force_utf8=False,
hide_utf8_warnings=False, utf8_handling='strict'):
super(PermissiveMARCReader,self).__init__(marc_target, to_unicode,
@jasonclark
jasonclark / cite-this-uncompressed.js
Created October 4, 2012 14:02
CiteThis Bookmarklet (Javascript unencoded and uncompressed)
javascript: (function () {
var h = document.createElement('div');
var t = document.getElementsByTagName('title')[0];
var info = '<p><strong>Title(' + t.innerHTML.length + '):</strong> ' + t.innerHTML + '</p>';
var m = document.getElementsByTagName('meta');
for (var i = 0; i < m.length; i++) {
if (null !== m[i].getAttribute('name')) {
var c = m[i].getAttribute('content');
info += '<p><strong>' + m[i].getAttribute('name') + '(' + c.length + '):</strong> ' + c + '</p>';
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mattfarina
mattfarina / custom.module
Created December 27, 2011 16:05
Protocol Relative URLs in Drupal 7
<?php
/**
* Implements hook_file_url_alter().
*
* Make all URLs be protocol relative.
* Note: protocol relatice URLs will cause IE7/8 to download stylesheets twice.
* @see http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-download/
*/
function custom_file_url_alter(&$url) {