Skip to content

Instantly share code, notes, and snippets.

View ryancatalani's full-sized avatar

Ryan Catalani ryancatalani

View GitHub Profile
String lets = "729711211212132661051141161041009712133";
int[] spaces = {2,2,3,3,3,2,2,3,3,3,3,3,2,3,2};
int curpos = 0;
for (int i=0; i<spaces.length; i++) {
System.out.print((char)(Integer.parseInt(lets.substring(curpos,curpos+spaces[i]))));
curpos += spaces[i];
@ryancatalani
ryancatalani / 1_100_top_only_lexemes.js
Created May 4, 2012 04:41
Most commonly used words in the English language
// #1: 100 top words
// Only includes lexemes. E.g. "be" is included, but not "is", "are", "were", or "was".
// From http://en.wikipedia.org/wiki/Most_common_words_in_English
["the","be","to","of","and","a","in","that","have","I","it","for","not","on","with","he","as","you","do","at","this","but","his","by","from","they","we","say","her","she","or","an","will","my","one","all","would","there","their","what","so","up","out","if","about","who","get","which","go","me","when","make","can","like","time","no","just","him","know","take","person","into","year","your","good","some","could","them","see","other","than","then","now","look","only","come","its","over","think","also","back","after","use","two","how","our","work","first","well","even","new","want","because","any","these","give","day","most","us"]
@ryancatalani
ryancatalani / States_and_Countries.txt
Created November 14, 2012 00:08
Arrays of states and countries
["Alabama","Alaska","American Samoa","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Marianas Islands","Ohio","Oklahoma","Oregon","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Virgin Islands","Washington","West Virginia","Wisconsin","Wyoming"]
"Alabama",
"Alaska",
"American Samoa",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
@ryancatalani
ryancatalani / analyze_tweets.rb
Last active December 16, 2015 22:09
Some methods to analyze your Twitter history.
require 'csv'
require 'net/http'
require 'uri'
require 'json'
require 'time'
replies = 0
replies_to = []
retweets = 0
retweets_from = []
@ryancatalani
ryancatalani / ec2013_analysis.rb
Created May 12, 2013 20:38
Some methods for analyzing tweets (tuned to updates from #ec2013, the 2013 Emerson College commencement).
require "csv"
require "cgi"
require "net/http"
require "uri"
require 'nokogiri'
require 'open-uri'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
times = []
@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
@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 / 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 / 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 / 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);