I’ve ordered a BMW X3 M40i

Let me explain.

I’ve grown tired of the hot hatch market. I currently own (owned?) a Ford Focus ST-3. It was a fun car, and I specced it relatively well, but it had issues from the start. The 19″ wheels I specced left little in the way of comfort, and the infotainment system definitely shows its age. Trying to zoom and pan around the sat nav map was infuriatingly slow. It also made my wife queasy on long journeys, and after a long journey on my own, my ears felt hot and pained.

The qualities that led to those issues, where the same qualities that made it fun to drive on dry, country roads. The car, assuming you understood its purpose, fulfilled its role in life. I have no real complaints about the car itself, but I feel i’ve outgrown that market.

I’m 28 years old now. I’m beyond trying to show off with wheels, badges, and exhausts. But, I still want some fun.

Specification

So there’s my spec, with an explanation for all of it. I intend to keep this car for years after the 4-year PCP deal is up, so I wanted to make sure it has everything I want now, and what I may want in the future.

Delivery is expected mid April 2019. As I get some more interesting information, I’ll share it here.

The Draw of WordPress

So, the one or two people who read this site shouldn’t have noticed any difference, but tonight, I spend an hour migrating this site from Jekyll to WordPress. The main reason? Syncing the site between 2 machines (my iMac and MacBook Pro) became a chore.

The migration was really rather simple, thanks to my starter theme, Origin. There’s no magic there, or anything really of interest, so I’ll breeze past it.

What moving to WordPress lets me do, is really easily post from anywhere, all within the safety of a GUI. If I really want to post something from the toilet of a bar, in-between pints, I can. I’ll never tell you that though.

So my next task with this site, is to add 2 post types. The main post type will be for general stuff – like this – and the two others will be code and cars. I want to write more about cars because it’s something that’s in my head a lot. I don’t expect it to be read much, but I want to write it anyway.

Why separate post types? It basically creates totally separate ‘streams’, with different RSS feeds, templates, capabilities, etc, if needs be. It essentially divides this site into 3 parts, much like a larger news site, such as the BBC, with their ‘News’ and ‘Sport’, sections.

For now, the streams will be combined, and can be refine that down with some nav links in the header, which will replace the Categories there at the moment.

Customise TinyMCE Buttons

If you, like me, are mostly disabling Gutenberg for all the things, you’re probably also looking to simplify the UI where possible.

I remove a few buttons and type styles from TinyMCE, so the client can only chose from stuff that won’t ruin the design of the site they paid a lot of money for. The only way they can screw it up is by manually fiddling with HTML, and, with the best will in the world, I wouldn’t expect clients to know that, in the same way they wouldn’t expect me to do their job.

This first snippet removes stuff like text alignment, font family and size, colour, stuff like that.

/*****
  Remove some editor buttons so client
  can't have the ability to justify text!
*****/
function origin_tinymce_editor_buttons($buttons) {
  return array(
    'formatselect',
    'separator',
    'bold',
    'italic',
    'underline',
    'strikethrough',
    'bullist',
    'numlist',
    'link',
    'unlink',
    'image',
    'blockquote',
    'outdent',
    'indent',
    'undo',
    'redo',
    'removeformat',
    'code'
  );
}
 add_filter('mce_buttons', 'origin_tinymce_editor_buttons', 99);

This second snippet removes some text block formats, such as <h1>, because we code that in to pretty much every page, usually taking the <?php the_title(); ?> value.

/*****
  Remove some block formats
*****/
function origin_tinymce_block_formats($formats){
  $formats['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Pre=pre;Code=code';
  return $formats;
}
add_filter('tiny_mce_before_init', 'origin_tinymce_block_formats');

Selectively Disable Gutenberg

Like many developers, I have a starter theme. Mine’s called Origin. It has a lot of stuff specific to a particular type of project I do often, so it’s not open source. But, there’s a lot of gems there which may be useful to others.

I’m going to start sharing them here, and add some Category nav items to the header so they’re easier to find.


Let’s say you’re not totally against Gutenberg, and want it to be used in a few places. The way WP lets you do this, is to disable it by post type.

In the example below, it’s disabled on the page, career and casestudy post types I have in a current project.

Pro tip: Unlike a lot of WP filters, you can use post as a type to disable.

function origin_disable_gutenberg($use_block_editor, $post_type) {
  $disabled_types = array(
    'page',
    'career',
    'casestudy'
  );

  if (in_array($post_type, $disabled_types)) :
    return false;
  endif;

  return $use_block_editor;
}
add_filter('use_block_editor_for_post_type', 'origin_disable_gutenberg', 10, 2);

PixelPerc

Several years ago, in June 2012, I made a tool to help convert multiple pixel width values into relative percentages.

It’s had a few updates over the years, but I always felt it could be improved. So, I’ve done just that. It looks simpler, and that’s because it is. It no longer supports URL params, and doesn’t generate funky colours, or give a visual representation. That said, I will add a bar to show the percent widths in action, I just wont out the numbers in there, as I always found it a pain to copy from.

Anyway, the new tools now live at pad.gs/tools/pixelperc. Enjoy!


Update: I’ve added a visual reference, and a ‘total’, so you can check the pixel values you’ve entered are the same as the container they’ll sit in.

New Tools Page

There’s a new nav item for Tools. It’s going to be a growing list of tiny tools and calculators to more easily do things I’d otherwise do in my head. Software is supposed to make our lives easier, and this is where I’m going to stash the tools I build to make my life easier.

Twenty Nineteen

No, not the WordPress theme, just a slightly longer title than the numeric equivalent.

My goals in 2019 are as follows:

The blogging part is once I’ve written about umpteen times, but I think I’ve figured out why. I always loved the idea of doing long weekly columns, but I now realise that isn’t hw I think, so expecting myself to keep up with that was never going to happen.

I’m much more sporadic, sometimes random, and to the point. So having a blog engine that lets me be quick and experiment with different ways to share stuff is a must. I could just use WordPress, but I stare at WP code for a living. Instead, I’ve gone with Jekyll, as I can extend it as much as I like, and having all the posts in a plain text format gives me comfort.

My goal over the next few days is to change up the design of the standard theme to something s bit more me, and built in things like link posts and videos, so I can start using this for what it’s meant for.

Unitl next time!


Update: I’ve gone back to WordPress. I realised that over 10 years of experience means I can make WP do as I please, easily.

Rico’s cheatsheets

I’m @rstacruz and this is a modest collection of cheatsheets I’ve written.

A very immodest description there.

I love cheatsheets like this. I remember seeing youmightnotneedjquery.com years ago, and the quick skimable format was a joy to reference. I think that once you get to a certain point with coding and knowing a language, you don’t need explainers, just the code itself. That YMNNJQ site was a great example.

Today I find Devhints, and it’s pretty similar. It’s different in that it’s not showing you another way to do something, but just how to do it in general. Admittedly, some of it seems basic, but if you’re new to a language, or just need a refresher… ??

I was looking for Jekyll, but there’s dozens more, and plenty more on the horizon.