Skip to content

Instantly share code, notes, and snippets.


James McKinney jpmckinney

View GitHub Profile
jpmckinney / tz_identifiers_to_rails_identifiers.rb
Created Jan 5, 2011
Maps tz database time zone identifiers to Rails time zone identifiers
View tz_identifiers_to_rails_identifiers.rb
# blog post:
"Australia/Adelaide" => "Adelaide",
"Australia/Broken_Hill" => "Adelaide",
"America/Anchorage" => "Alaska",
"America/Juneau" => "Alaska",
"America/Nome" => "Alaska",
"America/Yakutat" => "Alaska",
"Pacific/Gambier" => "Alaska",
"Asia/Almaty" => "Almaty",
jpmckinney / .block
Last active Jun 29, 2020
WeWork Place Ville-Marie Mac OS X Printing Instructions
View .block
license: cc-by-4.0
jpmckinney /
Last active Nov 30, 2019
Compare differences after making changes to Sphinx

Written as part of

curl -O
diff -rq build t | grep Only | sort
diff -ru -x '*.js' -x '.buildinfo' -x '_sources' build t | less
View framework-agreement-tmp-paraguay.json
"tender": {
"title": "Adquisición de Útiles de Oficina",
"id": "355477-adquisicion-utiles-oficina",
"procuringEntity": {
"id": "50",
"name": "Dirección Nacional de Contrataciones Públicas (DNCP)"
"procurementMethod": "open",
"procurementMethodDetails": "Licitación Pública Nacional",
jpmckinney / twitter_list_members.rb
Last active Aug 22, 2019
Download all Twitter list members to CSV
View twitter_list_members.rb
require 'csv'
require 'twitter'
Twitter.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
jpmckinney /
Created Jul 20, 2019
Test the performance of approaches to flattening JSON to CSV.

Building a dict by reference is faster than recursively building a dict (slowest) or list of tuples.


return {key: obj}
d = {}
import gettext
import os
import re
import sys
from collections import OrderedDict
from docutils import frontend
from docutils import nodes
from docutils.parsers import rst
from docutils.utils import new_document
jpmckinney / memcache_model.rb
Created Nov 1, 2010
ActiveModel class with Memcache backend
View memcache_model.rb
# blog post:
# No transactions or exceptions (yet).
module MemcacheModel
def self.included(base)
base.class_eval do
extend ActiveModel::Naming
extend ActiveModel::Translation
extend ActiveModel::Callbacks
extend MemcacheModel::ClassMethods
jpmckinney / character-class.rb
Created Feb 14, 2017
Character class to match encoding errors
View character-class.rb
jpmckinney /
Last active Feb 3, 2017
Languages used by government GitHub repositories

These files list government GitHub repositories, and the number of bytes of code written in each language.

Produced by running the languages:github Rake task from open_source_canada against the list of 'U.S. City' and 'U.S. Federal' GitHub organizations. Data for Canadian GitHub organizations is elsewhere.

You can’t perform that action at this time.