Skip to content

Instantly share code, notes, and snippets.

View denmch's full-sized avatar

Den McHenry denmch

View GitHub Profile

STIKHOI

STIKHOI: Displaying Greek & Latin Verse on the Web

This is a method for rendering Greek and Latin verse on the web, designed from the perspective of progressive enhancement using semantic HTML and employing CSS and optional jQuery for presentation.

If, for any reason, either JavaScript or CSS doesn't load, the presentation of the poetry will degrade gracefully to reveal the semantic markup, which retains proper line numbering.

Why this matters

There hasn't been a standard for citing classical verse on the web in a way that is (1) semantic and (2) aesthetic (i.e., aligned with print conventions). People often copy and paste snippets of poetry within a blockquote element when citing smaller pieces or painstakingly creating tables with manual line numbers when displaying larger works. Like the makers of every infomercial, I believe there has to be a better way.
@denmch
denmch / wordnik-shell-function.sh
Last active February 23, 2018 05:02
A shell function that looks up a word via the Wordnik API, grabs each definition via json, and cats out the results with line numbers
# Define a word in the terminal via the Wordnik API with numbered output
function def() {
params="$@"
params_encoded=${params/ /%20}
curl --silent http://api.wordnik.com:80/v4/word.json/"$params_encoded"/definitions\?api_key\="$WORDNIK_KEY" \
| json --array text \
| cat -b
}
@denmch
denmch / no-likes.css
Created June 16, 2017 23:05
Remove "So-and-So liked" from your Twitter feed on desktop
/* Use with a browser add-on like Stylebot to modify Twitter's styles */
[data-suggestion-json*="suggestion_type"] {
display: none;
}
@denmch
denmch / Upcoming to Twtter
Created April 7, 2017 18:43
A dumb little bookmarklet for your browser's bookmarks bar to jump from someone's Upcoming.org profile to their Twitter profile
javascript:(function(){var loc=location.href; loc=loc.replace('upcoming.org/@','twitter.com/'); location.replace(loc);})()
@denmch
denmch / bc-state-dropdown-fix
Last active June 5, 2016 09:21
On certain browsers on Android devices, the country and state dropdowns for express checkout on Bigcommerce can't be selected. This is a Band-Aid to allow those users to make purchases till the real problem is solved. It simply replaces the dropdown with a plain text input in both the billing and shipping sections.
/* Temporary fix for BigCommerce express checkout issue re: state dropdown menu */
$(document).ajaxComplete(function() {
if ($('#uniform-FormField_12').hasClass('selector')) {
$('#uniform-FormField_12').
removeClass('selector').
empty().
append('<input type="text" name="FormField[2][12]" id="FormField_12" aria-required="1" class="FormField JSHidden Field200 field-xlarge Textbox"></input>');
}
@denmch
denmch / bc-inject-title.js
Created June 4, 2016 22:22
Bigcommerce doesn't give the option of setting a meta title different from post title.
/************************************************************************/
/* Change title & metatitle for SEO using a data attribute on blog */
/* posts in Bigcommerce. Embed the title within the post like this: */
/* <span id="meta-title" data-title="This is a good SEO title!"></span> */
/************************************************************************/
$(document).ready(function() {
var newTitle = $('#meta-title').data('title'),
noMetaTitle = $('meta[name="title"]').length === 0,
hasDataTitle = newTitle !== undefined,
notACollection = $('body').hasClass('BlogPost'),

Keybase proof

I hereby claim:

  • I am denmch on github.
  • I am denmch (https://keybase.io/denmch) on keybase.
  • I have a public key ASC-C8zRfY5hcNfTD6WCdtvuNKQuXQZi0KSzGzIU91j3YAo

To claim this, I am signing this object:

@denmch
denmch / confirm-ending.js
Created December 22, 2015 00:05
"Check if a string (first argument) ends with the given target string (second argument)."
function end(str, target) {
var ending = str.substring(str.length - target.length);
return target === ending;
}
end("Bastian", "n");
@denmch
denmch / falsy-bouncer.js
Created December 22, 2015 00:02
"Remove all falsy values from an array."
function bouncer(arr) {
// Don't show a false ID to this bouncer.
function falsy(value) {
return Boolean(value);
}
return arr.filter(falsy);
}
bouncer([7, "ate", "", false, 9]);
@denmch
denmch / smallest-common-multiple.js
Created December 22, 2015 00:01
"Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters."
// Callback to calculate the Greatest Common Divisor,
// used within the scm callback.
function gcd(a, b) {
if (!b) {
return a;
}
return gcd(b, a % b);
}
// Callback to calculate the Smallest Common Multiple,