John Kawakami's blog

Hacking Multisite WordPress' Domain Mapping

I had been using the old WordPress MU Domain Mapping plugin for multisite WordPress, and was pretty happy with it, but unknown to me (because I only started reading WP blogs and groups this past year) WordPress has rolled this feature into the core.

WordPress Customizer selective Refresh and Partials for Multiple Settings

There are several good references about how to set up the Customizer to avoid refreshing the entire page with each change. here, and there's some deeper explanation here. What's not described much is how to map several settings to a single area of the page (called a Partial).

This tutorial will go into updating Partials that use several settings. I assume you have already done the other tutorials.

Observing the WordPress Customizer (wp.customize) Events

I needed to learn a little about the events triggered in the Customizer, and came up with a little script that does that.

WP's Customizer's weird IFRAME Glitch

I'm not sure if this is a bug, but it's so odd that I'll leave a post here to remind myself about this. The Customizer has an odd behavior if you enter it via the big blue button on the Admin dashboard that reads "Customize Your Site".

Random Rabbitholes about IFRAMES and WP's Script Loader

My script was working, but it wasn't loading correctly the first time. I had to reload to make it run. Unacceptable.

I spent a full day going down a lot of interesting rabbitholes, but ended up finding a really simple, almost obvious, solution. That's a good thing, but the torturous journey is the reward.

Greasemonkey/ Tampermoney Ebay Seller Script to Filter Active Listings

I wrote another script at Greasyfork. Here's my profile.

This one adds a "filter" feature to the ebay selling list so you can quickly find specific items.

Greasyfork is a repository of scripts for Greasemoney and Tampermoney, web browser extensions that allow you to execute your own Javscript code on any web page.

This means you can create elements, insert them onto the page, and do automate some repetitive tasks.

I was wrong again

I was totally wrong 10 years ago, and also wrong 17 years ago.

So, what's changed in the interim?

Amazon's still around, but there are some competitors, like WalMart, NewEgg, etc. Affiliate stores are still big. If there's anything new, it's the fact that all retailers have "stores within a store", and also ads within the website, and marketplaces within their websites.

Ebay is a marketplace with stores within it. Ebay also has more refined categories than in the past. Tutorials, and wp.Backbone. Subviews

I'm still working on reading through the WP media code, but found several references that have helped.

WP Media UI: States, StateMachine, and Frame

(It seems like I got the AJAX server working, at least somewhat. So I needed to implement the editors. This is really difficult because it's all in the hierarchy, and with keywords like "wp" and "media", it's hard to find the documentation. I have been digging around in the code trying to understand it, and came up with notes, which I'll post occasionally. These are mainly for myself, to review when I need to restart the exploration, but they're posted because someone else might find this useful.)

These are incomplete, and probably incorrect notes.

Reversing the Cloud

I was just noticing that the eBay photo uploader does something pretty unusual -- it offloads a compute-intensive task to the browser.

When you edit your photo and rotate it, it rotates the photo on the client (the browser) and then uploads the result to the server.

This is a departure from the pattern in web-server dev for the past decade or more, where the more compute-intensive tasks were performed on the server. I get the feeling that we'll see more of this in the future.

Why were these compute-intensive tasks on the server?

Re: Destructured Objects as Parameters


Since the comments were closed, I'm noting here, that Python figured this out a while back.

Function parameters start with required positional parameters, followed by optional positional parameters, followed by named parameters.

def fun(a, b, c=10, **kwargs):

In JS this would be:

function fun(a, b, c, obj) {
    c = (c === undefined ?

Learning About Kindle Publishing

I'm learning a lot from this excursion into Kindle publishing.

Technical books are higher-value products, so that's good. They don't have a big audience, which is bad.

Giving away the CSS book got 100 takes. I'm giving away a short WordPress book, and it only got 65 takes on the first day, probably due to stiffer competition.

Cookbooks are lower-value products, but take little time to write, and have a much larger audience.

Boost Your Click Through Traffic with Just One Tip (Headlines)

On a lark, I got a marketing ebook and was told to write catchy headlines. Then I got another ebook about writing headlines. So, I'm going to be changing all the headlines on this site, save a few, just to see if it boosts the traffic coming into the site.

Faster Mobile Web Apps with Offline-First

Makes me want to re-revive sf-active-js, which had some caching features to let you flip through headlines quickly.

The trick was to decouple retrieving data from the network, from drawing data to the screen. The screen has to keep polling the local data-sync service rather than the network.

Syndicate content