Skip to content

Instantly share code, notes, and snippets.

View tobyjsullivan's full-sized avatar

Toby Sullivan tobyjsullivan

View GitHub Profile
@tobyjsullivan
tobyjsullivan / print_pdf.md
Last active January 9, 2021 19:52
How to print any Adobe doc to PDF

How to print to PDF from Adobe Reader (on a mac)

Motivation

Adobe has introduced some obnoxious new PDF form technology which I am seeing more commonly in the wild. These PDF forms can only be used with the official Adobe Reader® software.

You will know you've hit one of these documents when you try to open a PDF in your web browser or Preview and you only see this text.

Please wait...
@tobyjsullivan
tobyjsullivan / beautifulFilesize.js
Created November 20, 2020 20:38
Format File Sizes in JavaScript
const UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte', 'petabyte'];
function beautifulFilesize(filesizeBytes) {
let unitIdx = 0;
let magnitude = filesizeBytes;
while (magnitude > 1000 && unitIdx < UNITS.length - 1) {
unitIdx++;
magnitude /= 1000.0;
}
const numberFmt = new Intl.NumberFormat('en', {
@tobyjsullivan
tobyjsullivan / adblock_comment_filter.txt
Last active July 28, 2017 00:41
Block comment sections via AdBlock
[Adblock Plus 2.0]
news.ycombinator.com##table.comment-tree
@tobyjsullivan
tobyjsullivan / abbreviateNum.js
Created May 31, 2017 00:57
Abbreviate large numbers in Javascript
// Iterated from: https://stackoverflow.com/questions/10599933/convert-long-number-into-abbreviated-string-in-javascript-with-a-special-shortn
function abbreviateNumber(value) {
let newValue = value;
const suffixes = ["", "K", "M", "B","T"];
let suffixNum = 0;
while (newValue >= 1000) {
newValue /= 1000;
suffixNum++;
}
@tobyjsullivan
tobyjsullivan / personality-insights.json
Created January 6, 2017 23:15
1 year of my own tweets, run through IBM Watson's Personality Insights service
{
"word_count": 5054,
"processed_language": "en",
"personality": [
{
"trait_id": "big5_openness",
"name": "Openness",
"category": "personality",
"percentile": 0.79548652792948,
"children": [

Keybase proof

I hereby claim:

  • I am tobyjsullivan on github.
  • I am tobyjsullivan (https://keybase.io/tobyjsullivan) on keybase.
  • I have a public key whose fingerprint is 83B7 3260 0458 4279 4822 08B3 6841 6B6A C3FD 5E88

To claim this, I am signing this object:

@tobyjsullivan
tobyjsullivan / format-preserving-scrubber.sql
Created July 6, 2016 21:23
The Worst FP-scrubber ever
select
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
REPLACE(
Taken from: https://www.google.com/js/th/xcoWlAKVx6cl2goeDVagdx3OJQvQ3hwXRwBhFWqI9A0.js
@tobyjsullivan
tobyjsullivan / vim.md
Created May 28, 2016 18:25
Uji's VIM Session at PolglotConf 2016

Polyglot Conference 2016

Agenda

10:47 Current Vim topic 10:59 Vim plugins / Basic Vim editing 11:15 Buffer 11:30 :wq!

  1. Knows everything in vimtutor
@tobyjsullivan
tobyjsullivan / MIC.csv
Created April 18, 2016 16:46 — forked from elvinio/MIC
MIC or Market Identifier Code from ISO10383 uniquely identifies exchanges and trading platforms. The list is from the MIC ISO page: http://www.iso15022.org/MIC/homepageMIC.htm
MIC COUNTRY ISO COUNTRY CODE (ISO 3166) OPERATING MIC O/S NAME-INSTITUTION DESCRIPTION ACRONYM CITY STATUS DATE
360T GERMANY DE 360T O 360T FRANKFURT SEPTEMBER 2007
AATS UNITED STATES OF AMERICA US AATS O ASSENT ATS JERSEY CITY OCTOBER 2011
ACEX INDIA IN ACEX O ACE DERIVATIVES & COMMODITY EXCHANGE LTD MUMBAI APRIL 2011
AFET THAILAND TH AFET O AGRICULTURAL FUTURES EXCHANGE OF THAILAND BANGKOK JANUARY 2008
AIXE SWITZERLAND CH AIXE O AIXECUTE BERNE OCTOBER 2013
ALDP UNITED STATES OF AMERICA US XNYS S NYSE ALTERNEXT DARK AMEXDARK NEW YORK MAY 2011
ALTX SOUTH AFRICA ZA XJSE S JSE ALTERNATE EXCHANGE ALTX JOHANNESBURG APRIL 2015
ALXA THE NETHERLANDS NL XAMS S EURONEXT - ALTERNEXT AMSTERDAM AMSTERDAM MAY 2015
ALXB BELGIUM BE XBRU S EURONEXT - ALTERNEXT BRUSSELS BRUSSELS APRIL 2015