Skip to content

Instantly share code, notes, and snippets.

View reefdog's full-sized avatar

Justin Reese reefdog

View GitHub Profile
@reefdog
reefdog / multiple_note_embed.html
Last active August 29, 2015 14:19
Embedding multiple DocumentCloud notes
<!-- The page DOM needs a container for each note, uniquely identified as `DC-note-{note_id}`. These can go anywhere in your page, though, so long as it's BEFORE the JavaScript below. -->
<div id="DC-note-{first_note_id}" class="DC-note-container"></div>
<div id="DC-note-{second_note_id}" class="DC-note-container"></div>
<div id="DC-note-{third_note_id}" class="DC-note-container"></div>
<!-- Only include the loader once; this and the other script tag should go at/near the bottom of the page. -->
<script src="//s3.amazonaws.com/s3.documentcloud.org/notes/loader.js"></script>
<script>
// Load each note individually.
(* "Most Played Artists" by Michael Henley (mike.com@mac.com) v1.0 2006-Feb-17 *)
-- Check system version --
if (system attribute "sysv") < 4160 then if button returned of (display dialog "Sorry, this script requires Database Events.app, which is only distributed with Mac OS 10.4 Tiger and later." buttons {"Ignore", "Quit"} default button 2) is "Quit" then error number -128
-- Retrieve raw data --
tell application "iTunes" to set {every_artist, every_play} to {artist, played count} of the first playlist's tracks
set tracks to the length of every_artist
-- Tally up play counts --
@reefdog
reefdog / gist:3178666
Created July 25, 2012 21:03
Possible form validation autothing
(function($){
$.fn.observeRequirements = function(fnRequirementsMet, fnRequirementsUnmet) {
fnRequirementsMet = fnRequirementsMet || function(){}; // Empty fns may not be necessary
fnRequirementsUnmet = fnRequirementsUnmet || function(){};
var $wrappers = $(this); // I do this to help distinguish `this` once things get nesty
var requirementsMet = true;
$wrappers.each(function(){ // .each to support operating on element collections
@reefdog
reefdog / favstar-to-twitter.js
Created October 30, 2015 19:03
Favstar to Twitter redirect bookmarklet
(function() {
var href = window.location.href;
var parts = href.match(/favstar\.fm\/users\/([\w]{1,15})\/status\/([0-9]+)$/);
if (parts) {
window.location = 'https://twitter.com/' + parts[1] + '/status/' + parts[2];
}
})();
@reefdog
reefdog / twincities-css-override.css
Created December 3, 2015 21:13
Override rules to make DC viewer work on http://blogs.twincities.com/
#container .DV-docViewer,
#container .DV-docViewer-Container,
#container .DV-footer,
#container .DV-collapsibleControls,
#container .DV-textPage,
#container .DV-textContents,
#container .DV-thumbnails,
#container .DV-annotationContent,
#container .DV-annotationExcerpt,
#container .DV-annotationExcerptImage,
@reefdog
reefdog / note-embed-example.html
Created February 18, 2016 21:31
Example of DocumentCloud note embed code
<div id="DC-note-53674" class="DC-note-container"></div>
<script src="//assets.documentcloud.org/notes/loader.js"></script>
<script>
dc.embed.loadNote('//www.documentcloud.org/documents/282753-lefler-thesis/annotations/53674.js');
</script>
<noscript>
<a href="https://www.documentcloud.org/documents/282753-lefler-thesis/annotations/53674.html">View note</a>
</noscript>
@reefdog
reefdog / document-embed-example.html
Last active February 18, 2016 21:31
Example of DocumentCloud document embed code
<div id="DV-viewer-282753-lefler-thesis" class="DV-container"></div>
<script src="//assets.documentcloud.org/viewer/loader.js"></script>
<script>
DV.load("https://www.documentcloud.org/documents/282753-lefler-thesis.js", {
sidebar: false,
text: false,
container: "#DV-viewer-282753-lefler-thesis"
});
</script>
<noscript>
@reefdog
reefdog / page-embed-example.html
Last active February 18, 2016 21:32
Example of DocumentCloud page embed code
<div class="DC-embed" data-version="1.1">
<div style="font-size:10pt;line-height:14pt;">
Page 1 of <a class="DC-embed-resource" href="https://www.documentcloud.org/documents/282753-lefler-thesis.html#document/p1" title="View entire Lefler Thesis on DocumentCloud in new window or tab" target="_blank">Lefler Thesis</a>
</div>
<img src="//assets.documentcloud.org/documents/282753/pages/lefler-thesis-p1-normal.gif?1455829953" srcset="//assets.documentcloud.org/documents/282753/pages/lefler-thesis-p1-normal.gif?1455829953 700w, //assets.documentcloud.org/documents/282753/pages/lefler-thesis-p1-large.gif?1455829953 1000w" alt="Page 1 of Lefler Thesis" style="max-width:100%;height:auto;margin:0.5em 0;border:1px solid #ccc;-webkit-box-sizing:border-box;box-sizing:border-box;clear:both">
<div style="font-size:8pt;line-height:12pt;text-align:center">
Contributed to
<a href="https://www.documentcloud.org/" title="Go to DocumentCloud in new window or tab" target="_blank" style="font-weight:700;font-fa
@reefdog
reefdog / search-embed-example.html
Created February 18, 2016 21:32
Example of DocumentCloud search embed code
<div id="DC-search-projectid-24031-language-tests" class="DC-search-container"></div>
<script src="//assets.documentcloud.org/embed/loader.js"></script>
<script>
dc.embed.load('http://www.documentcloud.org/search/embed/', {
q: "projectid: 24031-language-tests ",
container: "#DC-search-projectid-24031-language-tests",
title: "",
order: "created_at",
per_page: 12,
@reefdog
reefdog / 160519.html
Last active May 19, 2016 15:32
Recode of Steve Yedlin's RAW letter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Viewing_RAW</title>
<style type="text/css">