Skip to content

Instantly share code, notes, and snippets.

View ryancatalani's full-sized avatar

Ryan Catalani ryancatalani

View GitHub Profile
<option value="AL">AL</option><option value="AK">AK</option><option value="AS">AS</option><option value="AZ">AZ</option><option value="AR">AR</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DE">DE</option><option value="DC">DC</option><option value="FL">FL</option><option value="GA">GA</option><option value="GU">GU</option><option value="HI">HI</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="IA">IA</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="ME">ME</option><option value="MD">MD</option><option value="MA">MA</option><option value="MI">MI</option><option value="MN">MN</option><option value="MS">MS</option><option value="MO">MO</option><option value="MT">MT</option><option value="NE">NE</option><option value="NV">NV</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><opt
@ryancatalani
ryancatalani / embed_zoom_registration.js
Created February 1, 2022 03:16
Take a Zoom registration link and replace it with an embed.
function replaceZoomRegistration(html) {
const regex = />(http.+zoom.us\/meeting\/register.+?)</gi;
if (!!html.match(regex)) {
return html.replaceAll(regex, `><iframe src="$1" frameborder="0" style="width: 100%; height: 100vh">Loading…</iframe>
<p style="font-size: 0.8em; font-style: italic;">Can’t see the registration form? <a href="$1" target="_blank">Click here to open it in a new window.</a></p><`);
}
return html;
}
@ryancatalani
ryancatalani / link_bills.js
Last active January 27, 2022 01:55
Automatically add links to bill numbers (Hawaiʻi state legislature)
// Requires:
// Leaflet: http://leafletjs.com/
// Leaflet.curve: https://github.com/elfalem/Leaflet.curve
//
// Assumes:
// var map is a Leaflet map and already set up.
var latlngs = [];
var latlng1 = [LATITUDE, LONGTITUDE],
@ryancatalani
ryancatalani / letsencrypt_heroku.txt
Created March 14, 2017 16:54
Renewing and updating Let's Encrypt certificates on Heroku
0. Replace DOMAIN with actual domain.
1. Renew Let's Encrypt certificate.
sudo certbot certonly --debug --force-renew -a manual -d DOMAIN
2. Update Heroku certificate.
sudo heroku certs:update /etc/letsencrypt/live/DOMAIN/fullchain.pem /etc/letsencrypt/live/DOMAIN/privkey.pem
@ryancatalani
ryancatalani / easy-retina-background-image.scss
Last active April 26, 2016 20:15
A simple SASS mixin and function for retina background images. Assumes files are named according to Apple's @2x convention (e.g. image.jpg, image@2x.jpg).
@mixin background-image-retina($url) {
background-image: url($url);
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
background-image: url( str-replace($url, '.', '@2x.') );
}
}
@function str-replace($string, $search, $replace: '') {
// By Hugo Giraudel: http://www.sassmeister.com/gist/1b4f2da5527830088e4d
$index: str-index($string, $search);
@ryancatalani
ryancatalani / snow_calculator_share.js
Last active August 29, 2015 14:19
Berkeley Beacon snow day calculator
// Twitter
var twt_text = "My canceled classes at @EmersonCollege are worth $" + Math.ceil(total_cost) + ". " + window.location.toString() + " via @BeaconUpdate";
var encoded_twt_text = encodeURIComponent(twt_text);
var twt_link = "https://twitter.com/intent/tweet?&text=" + encoded_twt_text;
// Facebook
var fb_link = "https://www.facebook.com/dialog/feed?" +
"app_id=APP_ID" +
"&display=popup" +
"&caption=See%20how%20much%20your%20canceled%20classes%20at%20Emerson%20are%20worth." +
@ryancatalani
ryancatalani / PeltonEmersonInauguration.md
Last active January 3, 2016 23:28
A Markdown version of Emerson College president M. Lee Pelton's inaugural address. The page on Emerson's website from which it was previously accessible was apparently deleted (http://www.emerson.edu/inauguration/inaugural-address), so I went to the Internet Archive and saved a permanent copy here.

Source

President Pelton's Inaugural Address | Emerson College

September 14, 2012

Cutler Majestic Theatre, Boston, Massachusetts

As prepared for delivery

Thank you. I would like to acknowledge Board President Jeff Greenhawt, Presidents emeriti Jackie Liebergott and Richard Chapin, the Emerson College Board of Trustees, Governor Deval Patrick, Mayor Tom Menino (who was with us this morning), other elected officials, Ron Crutcher, and our speaker Andy Delbanco. I also extend greetings to the Emerson College community, and our friends and family.

@ryancatalani
ryancatalani / singlepage.js
Last active December 22, 2015 00:00
Make Boston.com slideshows a single page.
var count = 0;
if ($('.fancy-dropdown').length > 0) {
count = parseInt($('.pic-story-nav').find('.fancy-dropdown').find('ul').find('li:last').find('a').attr('href').replace('?pg=',''));
} else {
count = $('.thumbnail').length
}
var container = ($('.pic-story-content').length > 0) ? '.pic-story-content' : '.image-focused-gallery';
for (var i = 2; i <= count; i++) {
var parent = $(container);
$.get(window.location.href+"?pg="+i, function(data){
@ryancatalani
ryancatalani / presidents_weddings.csv
Created July 31, 2013 16:17
Ages at which each president was married. Presidents unmarried at the time of their presidency (i.e. there was no First Lady) are marked with an X in the First Lady column.
# First Lady Wedding President DOB Age
1 Martha Washington Jan 6, 1759 George Washington Feb 22, 1732 26
2 Abagail Adams Oct 25, 1764 John Adams Oct 30, 1735 28
3 X Jefferson 0
4 Dolley Madison Sep 14, 1794 James Madison Mar 16, 1751 43
5 Elizabeth Monroe Feb 16, 1786 James Monroe Apr 28, 1758 27
6 Louisa Adams Jul 26, 1797 John Q Adams Jul 11, 1767 30
7 X Jackson 0
8 X Van Buren 0
9 Anna Harrison Nov 22, 1795 William Henry Harrison Feb 9, 1773 22