Skip to content

Instantly share code, notes, and snippets.

View reefdog's full-sized avatar

Justin Reese reefdog

View GitHub Profile
@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 / 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.

Keybase proof

I hereby claim:

  • I am reefdog on github.
  • I am reefdog (https://keybase.io/reefdog) on keybase.
  • I have a public key ASCqa2f2aXw58ur8A3cWX9sfFhUJdckLLHEzty9K4_2lYAo

To claim this, I am signing this object:

@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
(* "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 --