A Small Library to Change WordPress Options (useful for E2E WP Testing with Selenium)

I was messing with E2E testing of WordPress, and it was going okay, but I hit a wall when I needed to mess with one of the options, to turn of a CAPTCHA. You don't want to use deal with CAPTCHAs during a test, at least not every test. There may be some where you want to see the CAPTCHA.

The right way to do this is to flip options on and off.

Configuring Git to use Your SSH Keys

Github has instructions on how to do this.

Okay, you've done it, but it's still not working.

The problem I keep having is that I clone repos via HTTPS rather than git, so my settings need tweaking.

.git/config usually has a line like this:

[remote "origin"]
    url = https://github.com/johnkawakami/SitesForBernie.git
    fetch = +refs/heads/*:refs/remotes/origin/*

So, I need to change the URL, replacing the first part with "git@github.com:" I also like to add a setting for [push] to get rid of the long mes

Angular $q Promise Gotchas

This is here so you can laugh at the first mistake.

Gotcha: resolve(), not return:

Spot the bug:

$q(function(resolve, reject) {
    if (someVarInScope) {
        return someFunctionThatReturnsAPromise();
    } else {
        reject("some error message");

It's probably easy, given the headline. Line 3 is in error. It should be:


"return" exits the function.

Problems Injecting DOM Elements from Angular Views into D3 Objects

I was having a hell of a lot of gotchas related to redrawing a D3 chart within an Angular view. It was looking like something on the Angular side was causing my DOM references to break. Maybe ng-route redrawing views?

That was bad, because my charts were being appended to a DOM element that had been passed from Angular over into D3 via a config object. It worked before changing routes, but when you toggled through routes and returned to the chart, it couldn't be redrawn.

Javascript Method Chaining, aka Fluent Interface

There are several ways to implement the Fluent Interface in JS, and this is one I was using in a project, and halfway forgot.

Docker on VirtualBox installation commands

This is a short howto about setting up VirtualBox with a Docker environment in it.

Set up a clean Debian VM with the regular install, a 10G disk, and nothing but the SSH server packages. (I have started to just use the Vagrant setup, which uses the username vagrant and password vagrant, in case I want to convert it to a Vagrant image.) Download the VirtualBox Guest Additions CD and, as root, do these things to prep the virtual box to install the drivers.

Run the following.

March for Bernie

I have been working on March for Bernie on the side, for free of course. It's a WordPress site with a theme from Bernie volunteers.

Testing Angular Promises and the $http XHR Service with Jasmine

This is a rough note, because I finally figured this out after several hours of trying. If I'm wrong, please email me, and I'll fix it.

I had a problem because I wanted to centralize my $http requests in services rather than having XHR calls in controllers. My first attempts used callbacks, but I wanted to convert them to promises, which are a lot nicer. Thus, I had to test promises that used $http.

The TDD/BDD Religion, Getting The

I must admit that I'm fully drunk on the Kool-Ade.

The tl;dr : testing isn't just writing tests, but also using mock objects and services to simplify testing, and using package managers to port code to new versions of modules. It takes days to learn how, but it's worth it.

End the Chaos, Get with the Program: Python Logging to Syslog, and Filtering with RSyslog

This article describes how to use Python's logging library to send logs to syslog. Then, using rsyslog, a fancier syslog, we produce a log of pre-filtered output.

I have a process that runs a few times an hour, and it spits out results to STDOUT, which cron dutifully emails to me.

Search this Site from the Search Box

If you go to the home page you can add a site-limited google search to your search bar. Google isn't too nice about it, but it'll work.

Script to set up Python virtualenv

This script sets up both python 2.* and python 3 virtual environments in a directory.

#! /bin/bash

# sets up the packages/python directory's virtualenvs 
# make sure these envs are in .gitignore
virtualenv env
virtualenv -p python3 env3

. env3/bin/activate
for i in pip grip requests setuptools six wheel mysqlclient coverage; do
    pip install $i


. env/bin/activate
for i in pip setuptools; do
    pip install $i


Why bother? Because this is a way to redeploy the environment on an empty computer.

Movies about the Great Recession / Real Estate Bubble / Economic Crisis

2010 is upon us, and unlike the Arthur C. Clarke sequel to 2001, wherein the world is exploring space, in the real 2010, the world is trying to find a goddamn job and avoid a huge, double-dip recession and rapid price deflation.

Visual Basics: VB, VBA, MS Office

This is a collection of related notes. I will not be updating them as I'm not using the platform at this time.

They're out of order, but there's a lot of potentially useful information in here. Maybe I'll compile it into a short ebook at some point.

Online Ads - oh s- they really work on me

I've been putting ads on here for years, and they have basically failed. On other sites, it's actually OK, making a little trickle of money, which is so weird. Lately, I've been looking at the ads on this site, and sometimes I click them. It's not click fraud because I'm actually interested. So they are working. Then I put up this hideous ad with a big stack of text ads, and I wanted to click more than one of them.


These ads work on me now.

Syndicate content