I’m slowly copying the markdown versions of my posts after my recent move of this blog. It really is tedious, and I don’t think I’ll finish anytime soon, so in the meantime I created a plugin to output the [ code]
shortcode that wordpress.com put in my post export in the same way that markdown does. This is the first plugin and shortcode I’ve created in a long while, but it was relatively quick to do working off of my posts on plugins and shortcodes. The biggest time consumer was figuring out how to deal with whitespace issues. Apparently, WordPress sometimes will add <p>
and <br />
to shortcode content. Also, there were leading and trailing line breaks adding unnecessary space. My quick solution:
Toby's Log page 85
Unofficial tagline for the movie “Groundhog Day”
“From asshole to awesome in one day flat”
Blogs moved and merged
This weekend, I moved my wordpress.com “professional” (web development) blog and my “personal” blog both to my main website and merged them together. I had been planning on moving my blog from wordpress.com for a while, but recent problems with writing posts with code blocks pushed me to finally take the plunge. I’ve also been feeling like maintaining a separate personal and professional site might be more trouble than it’s worth. I do worry that the different sort of audiences that would go to the one wouldn’t want to see the content from the other and vice versa. I might be less inclined to write some personal stuff on my professional blog. But I think I will be able to find ways to mitigate those issues and make it work well.
Both sites are now redirecting to my main site. I had to pay wordpress.com ($13 a year) for the privilege, but I think it is worth it considering the “link juice” I have with that blog. I will probably continue paying for at least several years. With the use I’ve gotten out of WordPress so far, they’ve probably earned it.
There are still some things to fix:
- The content imported from my professional blog didn’t bring over the markdown formatting, and thus all of the code blocks are messed up. I am going to have to manually copy them over one by one from the wordpress.com admin as far as I can tell. A pain.
- I accidentally deleted all of the media files imported from the wordpress.com due to the way I deploy my site. I’m going to have to reimport on a local install and upload, then make sure my deploy ignores that directory. Hopefully the redirect I set up doesn’t cause problems for this.
- There is plenty of non-blog content on my personal site that I will need to move to my main site. I don’t have any real “link juice” with that site, so I can move things wherever I see fit or not copy it at all if it doesn’t seem worth keeping.
- The theme is just a slightly modified ‘twenty fifteen’. I’m going to have to decide what I want to do with it to better integrate it into the rest of my site.
My eventual plans are to move my blog out of WordPress and into the same system I’m using for the rest of my site. I may lose some things in the process, including possibly my connection to the WordPress project, but I will gain control.
I had a number of problems during my move, but am way too tired to write about them currently. Hopefully they’ll make for a few posts this upcoming week.
Command-line weather with wttr.in
Cool, lightweight, and simple ASCII weather forecast site that can be curl
ed: wttr.in. It does user-agent sniffing to show plain, colored text for curl
, wget
, and the like so that it looks nice on the command line, while browsers get HTML with a similar appearance. The “home page” does IP lookup to guess your location. Results of curl wttr.in/cleveland
:
Just one day after writing that I would try to post once a day, I missed posting. Certainly contributing to my difficulties in posting is the amount of time I spend thinking about and composing posts. Sometimes when I have a topic that I could easily write a short post about, I have a desire to hold off until I can write a more in-depth version. But really, I’d prefer to write more and get my ideas and experiences out sooner, even if the results are imperfect and more open to criticism. I can always revisit later. If I don’t write when it’s on my mind, there’s a chance it just will never get written. I have tons of blog post ideas or partial drafts written down that are old enough now that I don’t remember enough about them anymore to easily write about them.
Also contributing to my difficulties is the never-ending stream of new blog posts and other information other people are creating for me to read. I tend to get sucked into reading them, ignoring getting my own things done. A while back, I wrote on my whiteboard “Less reading, more writing”. I haven’t been following that advice, but that’s part of my goal with this post-per-day idea. We’ll see how I do.
I am going to try to post something once a day for a while, either on this blog or my personal blog, even if it is just a short, tweet-sized post. I think posting helps me document what I’m working on, techniques, things I find, etc. for my future self to more easily find. It’s surprisingly easy to forget things when I figure them out for one project, then don’t use that same thing again for a little while. My site will eventually have something more advanced for these purposes, but for now simple blog postings will work.
Also, I’ve noticed a strange SEO / traffic benefit to my site wherein my traffic is much more likely to be on the higher side on the day or day after I post, even though those posts are almost never the ones being visited. Perhaps the search-engine algorithms see the site as more “fresh”, even though the articles that get the bump aren’t fresh at all.
The biggest problem with this is that even a post I intend to be quick often takes an inordinately long time as I look up things and add more to it. Like this post. We’ll see how well I do with my goal.
Web app manifest, first go
I’ve added a basic web app manifest to my site. I have not experimented with the results, but I did run it through a web manifest validator mostly to success. I used the MDN guide and the HTML5 doctor article for help. I also read some of the in-progress spec, though it seemed more implementer-friendly. The content of my manifest is currently (prettified):
{
"background_color": "#4e784e"
,"display": "browser"
,"icons": [
{
"sizes": "64x64"
,"src": "favicon.gif"
,"type": "image\/gif"
}
]
,"lang": "en-US"
,"name": "Toby Mackenzie\u0027s site"
,"scope": "\/"
,"short_name": "\u003Ctoby\u003E"
,"start_url": "\/"
,"theme_color": "#4e784e"
}
I’m just using Symfony’s JsonResponse object to render a PHP array.
This is one more thing that I really shouldn’t’ve put time into until my site is more fleshed out, but it seemed cool and simple to add.
I think it’s time to move my blog from wordpress.com to my own site. This disappearing content in code blocks is getting old. Can’t post a post I wrote. Project for the week.
Working with SVG Icons
At Cogneato, we’ve been using icon fonts for at least a couple years now. We recently started using SVG icons for a new part of our CMS that allows clients to pick icons from large collections for use in their content. Working with SVG’s is a bit different than with icon fonts, so I created some helper code to make it easy to get them in place, have proper accessibility, and
I like icon fonts fairly well, but there are some advantages to using SVG icons. For us, we were wanting to allow clients to pick from a large selection of icons from within our CMS. Requiring downloads of giant icon sets so they could have a large selection but only show a few on a page would be very bandwidth inefficient, and managing loading the set(s) a particular client wanted to use would be complicated. Unless they use a lot on a single site, cherry-picking each icon should use less bandwidth. This is easy to do with SVG’s.
There are many ways to use SVG’s, but when you need to be able to change colors based on context as we do, inlining SVG elements is the only (practical1) way. With them, you can use fill: currentColor;
to use the text color of the container, which we need. Many SVG tutorials use SVG sprite-sheets and then inline spartan SVG elements that contain little other than the <use>
element to reference icons from the sheet, saving size for repeated icons and potentially allowing the sprite-sheet to be cached. However, sheets have the same bandwidth management issues as the icon fonts. So I went with direct DOM insertion.
I Ohio voting in democrat primary
Today, “I Ohio voting”. I got in just about at the last minute. This time, for the first time ever, I took a party ballot for voting in a primary. I dislike the two-party system and how limited our choices are with effectively two not-so-dissimilar options. I think regardless of who is elected, more things that I dislike will come to pass politically than things I like. I don’t really want my name associated with either of the large, powerful parties that control this country. However, I kinda like what Bernie Sanders brings to the table, as compared to the other options. He was an independent for a long time, and still has that feel, at least as much so as a candidate can in this political environment. He’s down, but not out, so I figured I’d give him a tiny bit of help with a vote.