Skip to content

Instantly share code, notes, and snippets.

View jpmckinney's full-sized avatar

James McKinney jpmckinney

View GitHub Profile
import json
import os
import re
import sys
from textwrap import dedent
tables_replacements = {
'```eval_rst': '',
'```': '',
}
@jpmckinney
jpmckinney / proxy.php
Created March 19, 2012 18:34 — forked from evolvingweb/proxy.php
An AJAX-Solr proxy written in PHP.
<?php
/**
* @file
* Implements a Solr proxy.
*
* Currently requires json_decode which is bundled with PHP >= 5.2.0.
*
* You must download the SolrPhpClient and store it in the same directory as this file.
*
@jpmckinney
jpmckinney / .block
Last active June 29, 2020 16:34
WeWork Place Ville-Marie Mac OS X Printing Instructions
license: cc-by-4.0
@jpmckinney
jpmckinney / README.md
Last active November 30, 2019 05:16
Compare differences after making changes to Sphinx

Written as part of open-contracting/standard_profile_template#33

curl -O https://gist.githubusercontent.com/jpmckinney/ba38d531e245c175e254ea3bc4218001/raw/bbb015f613ba936b3b42f25c576e833d196e5181/diff-reduce.py
python diff-reduce.py
diff -rq build t | grep Only | sort
diff -ru -x '*.js' -x '.buildinfo' -x '_sources' build t | less
{
"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
jpmckinney / twitter_list_members.rb
Last active August 22, 2019 00:29
Download all Twitter list members to CSV
require 'csv'
require 'twitter'
Twitter.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
end
@jpmckinney
jpmckinney / README.md
Created July 20, 2019 02:50
Test the performance of approaches to flattening JSON to CSV.

simple-one-table.py

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

dict:

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
jpmckinney / memcache_model.rb
Created November 1, 2010 19:25
ActiveModel class with Memcache backend
# blog post: http://blog.slashpoundbang.com/post/1455548868/memcachemodel-make-any-ruby-object-that-persists-in
# 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
jpmckinney / character-class.rb
Created February 14, 2017 02:01
Character class to match encoding errors
/[¡¢£¤¥¦§¨©ª¬­®¯°±²³´µ¶·¸¹º¼½¾¿ÂÃÅËŒœŠšŸŽžƒˆ˜‘‚„†‡•…‰‹›€™]/