Skip to content

Instantly share code, notes, and snippets.

View rnagle's full-sized avatar

Ryan Nagle rnagle

View GitHub Profile
@rnagle
rnagle / omniture.js
Last active June 17, 2023 11:46
omniture.js
// Omniture.js is a clean up of Tribune's boilerplate Omniture
// code with some added convenience methods for setting vars,
// recording page views, etc.
//
// It sets up a singleton `omniture` object to use for all your
// Omniture needs.
//
// Example use:
//
// window.omniture.init('saccountgoeshere', {
@rnagle
rnagle / APDate.js
Last active August 29, 2015 13:58
AP date formatter
/**
* Author: Ryan Nagle
* https://gist.github.com/rnagle/10181125
*
* APDate takes an object with keys describing a date/time. The method `ap` returns
* a string using AP style for the specified day, month, year.
*
* Usage:
*
* var d = new APDate({ month: 8, day: 8, year: 1989 });
@rnagle
rnagle / dnsmasqutil
Created August 20, 2014 16:04
Utility script for stopping, starting and restarting dnsmasq
#!/bin/bash
#
# Install:
#
# Copy this file to a location included in your PATH.
#
# Usage:
#
# $ dnsmasqutil stop|start|restart
@rnagle
rnagle / ipinfo
Created August 29, 2014 16:47
A command line interface for the services provided by http://ipinfo.io
#!/bin/bash
function print_help() {
echo "A command line interface for the services provided by http://ipinfo.io
Example usage:
ipinfo [ADDRESS] [ip | hostname | loc | org | city | region | country | phone | geo]
ipinfo 8.8.8.8 geo
{ "ip": "8.8.8.8", "city": null, "region": null, "country": "US", "loc": "38.0000,-97.0000" }
@rnagle
rnagle / phpmailer_debug_settings.php
Created March 12, 2015 15:16
WordPress: set up phpmailer for debugging
<?php
function phpmailer_debug_settings($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->Host = 'localhost';
$phpmailer->Port = 1025;
}
add_action('phpmailer_init', 'phpmailer_debug_settings');
@rnagle
rnagle / delete_blog_users.sql
Last active August 29, 2015 14:18
Prepare a standalone WP blog for migration to multisite install
-- This SQL file will remove all users for a specific blog from the network tables (`wp_users` and `wp_usermeta`)
-- Set the value of `@newBlogID` to the ID of the blog for which you want to remove all users.
-- Useful for reimporting content and users/rerunning a migration.
@newBlogID = TKTK;
DROP TEMPORARY TABLE IF EXISTS temp_user_ids;
CREATE TEMPORARY TABLE IF NOT EXISTS temp_user_ids SELECT user_id as ID FROM wp_usermeta WHERE meta_key = CONCAT('wp_', @newBlogID, '_capabilities');
DELETE FROM wp_users WHERE ID in (SELECT ID from temp_user_ids);
DELETE FROM wp_usermeta WHERE user_id in (SELECT ID from temp_user_ids);
@rnagle
rnagle / wpdb_default_tables.sql
Last active March 28, 2024 22:37
Default WordPress Database Table Create Statements
DROP TABLE IF EXISTS wp_users;
CREATE TABLE wp_users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(64) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(60) NOT NULL default '',
@rnagle
rnagle / rainbows.js
Created June 25, 2015 15:20
Rainbows for your body copy
var rainbows = rainbows || {};
(function() {
var $ = jQuery;
rainbows.last_offset = 0;
rainbows.colors = [
'red', 'green', 'yellow', 'blue', 'orange',
'purple', 'pink', 'brown', 'black', 'gray', 'white'

Keybase proof

I hereby claim:

  • I am rnagle on github.
  • I am ryannagle (https://keybase.io/ryannagle) on keybase.
  • I have a public key whose fingerprint is 5C70 4795 68A0 FD2C 2260 DCB9 CEB0 34CE 7186 AB08

To claim this, I am signing this object:

@rnagle
rnagle / import_newslynx_users.py
Last active November 10, 2015 14:13
Import Newslynx users from CSV
import csv
import re
from unicodedata import normalize
from newslynx.client import API
_punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
def main():