Posts from July 2015

Medium Trials

Published 8 years, 7 months past

Originally published at Medium on July 30th, 2015.

Yesterday, I decided to try importing a story to Medium. I’d hunted around for a way to auto-post to Medium from WordPress, which runs the blog portion of meyerweb (the rest is mostly HTML, with a little PHP here and there), and hadn’t found one. Then I found the “Import story” feature on Medium and thought, Sure, why not?

So I tried it out on my most recent post, which also happened to have some code in it, as my posts sometimes do. The process was, as anyone who’s used it can tell you, very simple. Paste in a URL and the content gets sucked in.

Well, except for code blocks.

Everything was imported without incident except the Javascript. That seems like a metaphor for something.

I’d structured the block with a pre element, as I always do, and yet the line-breaking was stripped away. It looks like my indentation tabs were preserved, but without the linefeeds, they didn’t have nearly the same utility.

The real problem is that the importation of the code block stopped cold at the first <, dropping the rest of the code on the floor. Now, I admit, I didn’t escape or entity-ize the character in my source, and maybe that was the problem. Still, I feel like an import tool should be a little smarter about things like less-than symbols on import. Otherwise, how many less-than-threes will end up as just plain threes?

Fortunately, the fix was simple: I went back to the original post, drag-selected the whole code block, copied, went back to Medium, drag-selected the mangled code, and hit ⌘V. Done. It was properly formatted and no less-than terminations occurred.

Today, I’m experimenting with writing my post on Medium first, after which I’ll repost it at meyerweb. This is likely the only time I’ll do it in that order, given my experience over here. Captions are deucedly hard to edit (at least in my browser of choice, Firefox Nightly), the apparent inability to add simple decorations like border to images, and the apparently intentional, active enforcement of single-space-after-sentence even when editing annoy me deeply. (Yes, that’s how I roll. Let’s not have the spacing argument here, please.)

I can see why Medium appeals to so many. It’s pretty frictionless, a lot more so than almost any other tool of its kind I’ve used. I mean, my WordPress install is pretty frictionless to me, but that’s because I invested a lot of time customizing it to be that way. Much like my browser, mail client, and other essential tools.

So anyway, that’s what I found during import and authoring on Medium. Here’s hoping this posts properly, and without the stray “in” that’s somehow shown up in my post, and which I can’t select, mouse to delete or otherwise remove through non-Inspector means. If only I could prepend an “f”!

It didn’t show up when I posted, fortunately.

P.S. I discovered this was the title just before publishing. It was supposed to be just “Medium”. ¯\_(ツ)_/¯


Undoing oncut/oncopy/onpaste Falsities

Published 8 years, 8 months past

Inspired by Ryan Joy’s excellent and deservedly popular tweet, I wrote a small, not-terribly-smart Javascript function to undo cut/copy/paste blocking in HTML.

function fixCCP() {
   var elems = document.getElementsByTagName('*');
   var attrs = ['onpaste','oncopy','oncut'];
   for (i = 0; i < elems.length; i++) {
      for (j = 0; j < attrs.length; j++) {
         if (elems[i].getAttribute(attrs[j])) {
            elems[i].setAttribute(attrs[j],elems[i]
            .getAttribute(attrs[j])
            .replace("return false","return true"));
         }
      }
   }
}

Here it is as a bookmarklet, if you still roll that way (as I do): fixCCP.  Thanks to the Bookmarklet Maker at bookmarklets.org for helping me out with that!

If there are obvious improvements to be made to its functionality, let me know and I’ll throw it up on Github.


Everything Looks Like a Nail

Published 8 years, 8 months past

I have recently, perhaps inevitably, taken up woodworking as a hobby.  It’s just clichéd enough to be credible, isn’t it?  Web, wood, maybe it’s in the leading “w”.

A programmer friend and I get together Wednesday evenings to try our hand at what is currently best described as rough carpentry.  The usual reason to take up a “physical-world” hobby like woodworking is to “get away from the computer for a while, man!”  But of course we pull out our iPhones to use as calculators, look up techniques, or find online tools that can help us.  The laptops stay indoors, but computers and the internet still smooth our way.

In web terms, we’re past “hello world” and at about the point where we understand the basics of HTML and have set a few colors and faces with beginner CSS.  We could put up a single-column fan site if that were the goal, but not much more than that.  We’re still at the stage of making a lot of mistakes and not knowing if our problems spring entirely from not knowing how to use our tools, or also from not knowing enough to realize the tools themselves are deficient.  We’re figuring things out as we go, hitting up YouTube for how-to guides on just about everything.  Wikipedia may aspire to be the site of record for Things of Import, but YouTube holds the sum total of humanity’s practical knowledge, hidden amongst all the pop-star and cat videos.

A lot of the best practices map back and forth, too.  Planning ahead is a core competency, and the more you practice, the better you get at it.  Measurement is vital, and cleverness is as useful as it is dangerous.  The importance of quality tools can’t be overstated.  There are a lot of (very) specialized tools available, but you can get really far with the core set of flexible, time-honored basics.  As long as you have a boatload of clamps, that is.

The one major difference is that there is no versioning in woodworking.  It’s like building a project with only the “Save” command — no milestones, no repositories, no undo.  When you do something, you’re committing to altering the project with no take-backs.  If you get it wrong, you have to find a way to patch over the problem.  If you get it really wrong, you have to scrap what you just did and replace the botched part.  And if you get it really, really wrong, all you can do is scrap the whole thing and start over.

So far we haven’t had to scrap anything.  Our first couple of projects were the classic starters: a simple bookshelf, a firewood box, a more complex bookshelf.  For each, we’ve intentionally stepped up the complexity, a bit at a time.  The first bookshelf was just screwed together, but the pieces were all pretty much the right size and properly aligned.  The firewood box was also screwed together, but it involved angled cuts and hinges and sealant.  The second bookshelf involved a wood router in a variety of ways, both structural and decorative.

As in networking, we swore a lot at the router, but it got us where we needed to be.  Eventually, that is, once we figured out how to properly configure it and deal with its quirks.

I can’t deny that there’s a visceral satisfaction in picking up a hammer and whacking on a thing until it’s properly assembled, or disassembled, as the case may be.  There’s definitely a triumph in finding out you did all the measuring and cutting and aligning just right, much like the rush you get when your first major coding project does what you meant it to do, except more so because you’ve wrestled atoms into doing your bidding.  That’s literal orders of magnitude beyond wrangling electrons.

Our next steps are what I assume is the usual second phase: building a wood shop in order to learn how to use a wood shop.  We’re moving up to building fold-down work surfaces with tool storage, custom-fitted wood storage, and braced shelves.  That experience will enable us to move into other, more complicated projects.  Some we already have in mind.  Others will suggest themselves to us.  At every step, we’ll look for new skills to try and practice.

And that, I think, is the real ultimate goal here: to teach ourselves new things, to enrich our skill sets and create useful objects thereby.

So it’s pretty much like working on the web.

Well, except for all the staining.

This article was originally published at The Pastry Box Project on 2 July 2015.


Browse the Archive