Skip to content

Instantly share code, notes, and snippets.

e'rry day I'm hustlin'

Ændrew Rininsland aendrew

e'rry day I'm hustlin'
View GitHub Profile
aendrew / activate_plugin.php
Created Aug 13, 2014
Install Bower dependencies on WordPress plugin activation
View activate_plugin.php
register_activation_hook(__FILE__, 'activate_my_plugin');
function activate_my_plugin() {
// Some basic securifying
if ( ! current_user_can( 'activate_plugins' ) )
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : '';
check_admin_referer( "activate-plugin_{$plugin}" );

Keybase proof

I hereby claim:

  • I am aendrew on github.
  • I am aendrew ( on keybase.
  • I have a public key whose fingerprint is C6D2 2524 3C6A F7CF DC59 E6A0 3C07 CD72 0C81 3A79

To claim this, I am signing this object:

aendrew / dreamhost_api_postman.json
Last active Aug 29, 2015
Dreamhost API Postman collection
View dreamhost_api_postman.json
"id": "0d19ea7d-8803-9f84-32f0-096a055e1d3e",
"name": "Dreamhost API",
"timestamp": 1410102836319,
"requests": [{
"collectionId": "0d19ea7d-8803-9f84-32f0-096a055e1d3e",
"id": "00c11594-394a-410e-9847-760aaa3f1bc8",
"name": "MySQL — Add hostname",
"description": "<a href=\"\">Adds a MySQL hostname</a>.<br/>\n<b>hostname:</b> the full hostname you want to serve as a mysql hostname (unless the domain following the first . is hosted with Dreamhost, you will not be able to access phpMyAdmin from this hostname).",
aendrew /
Created Oct 8, 2014
Dump databases for RDS while excluding others in MySQL v5.definitely-not-most-recent
## 2014 Ændrew Rininsland (@aendrew)
# usage: ./ <root_user> <password> <path_to_mysql_socket> <dbs,to,exclude> <filename for dump>
aendrew / convert_google_to_d3.js
Last active Aug 29, 2015
Convert Google Sankey chart data to D3.js Sankey data (nodeJS)
View convert_google_to_d3.js
* Convert Google Sankey chart data to D3.js Sankey data (nodeJS)
* Usage: node convert_google_to_d3.js in-file.json out-file.json
* Requires: lodash — npm install lodash
'use strict';
var _ = require('lodash');

Deis Cheat Sheet

2015 Ændrew Rininsland

This assumes running Deis on AWS. Note this is a work-in-progress.

To check fleet status

  1. Get IP of a Deis instance.
  2. Connect: ssh -i ~/.ssh/deis core@$DEIS_IP
  3. fleetctl list-units
aendrew / british_mps.sparql
Last active Aug 29, 2015
All British MPs + Birthdays
View british_mps.sparql
STR(DAY(?date))) as ?displayDate)
?person dcterms:subject <>.
?person a foaf:Person.
?person dbpedia-owl:birthDate ?date.
?person rdfs:label ?name.
aendrew / replace_author_urls.php
Created Aug 21, 2015
Totally replace WordPress default author page URLs with that of custom taxonomy named "authors"
View replace_author_urls.php
function disable_WP_author_rewrites($rules) {
$rules['author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?authors=$matches[1]&feed=$matches[2]';
$rules['author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?authors=$matches[1]&feed=$matches[2]';
$rules['author/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?authors=$matches[1]&paged=$matches[2]';
$rules['author/([^/]+)/?$'] = 'index.php?authors=$matches[1]';
return $rules;
aendrew /
Created Sep 21, 2015
D3 Intermediate - Advanced Tutorial scratchpad

Somewhat Difficult Things To Do In D3

  • Clustered groups of elements (I.e., "group x circles into y groups")
  • Hexbin maps (E.g., hexbin election constituency maps)
aendrew / UNHCR.json.postman_collection
Created Oct 2, 2015
UNHCR API Postman collection
View UNHCR.json.postman_collection
"id": "21153401-a788-3abe-5fbb-54833ca0e400",
"name": "UNHCR",
"description": "Data from the UN Refugee Agency.\n\nDocs at [](",
"order": [],
"folders": [
"id": "c1514c2c-f817-f8d6-b434-eacd23a9c937",
"name": "Countries",
"description": "",
You can’t perform that action at this time.