• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (deprecated)
You are here: Home / Archives for Programming

Programming

GitHub Tab Size Preference

Last updated on September 15, 2023 by Sal Ferrarello

As a WordPress developer, I deal with lots of code indented with tabs (rather than spaces). By default when viewing these files in GitHub, each tab is rendered as 8 spaces. On my personal machine, I render each tab as 4 spaces. This difference makes it less pleasant to view code in GitHub, however, I just learned I can set my preferred tab rendering in GitHub!

Filed Under: Dev Tips, Programming Tagged With: GitHub

Git Rebase and the Multiverse

Last updated on September 17, 2023 by Sal Ferrarello

In “Git Merge and the Multiverse” I looked at merging branches and how sometimes this results in a fast-forward merge and sometimes in the creation of a merge commit. Now let’s look at Git rebase (a.k.a. the power to rewrite history).

Filed Under: Computing, Dev Tips, Programming Tagged With: Git, rebase

Git Merge and the Multiverse

Last updated on September 17, 2023 by Sal Ferrarello

If you’re a fan of science (or science fiction), you may be familiar with the concept of the “Multiverse”, the idea that there are multiple universes. In some science fiction stories, one universe can split, branching into multiple universes and then later collapse into a single universe, this is a surprisingly good analogy for Git and branching.

Filed Under: Computing, Dev Tips, Programming Tagged With: Git

WordPress Multisite Skip Confirmation Email

Last updated on August 1, 2023 by Sal Ferrarello

When creating a new user on WordPress multisite there is a “Skip Confirmation Email” checkbox that is unchecked by default. This unchecked box results in a user being added to a temporary “signups list” when they are added to the site. The user is not fully added to the site until they complete the confirmation steps in the email they receive. For many sites, it is preferable to check this “Skip Confirmation Email” when adding a user. With some code you can set this checkbox to default to checked.

Filed Under: Programming, Solution Tagged With: WordPress, WordPress Multisite, WordPress Plugin

Why PHP require autoload.php should be wrapped in is_readable()

Last updated on June 30, 2023 by Sal Ferrarello

When using Composer for PHP class autoloading, it is a good practice to wrap your require statement with an is_readable() check. Here are some notes on why this is an important thing to do.

Filed Under: Dev Tips, Programming, Recommendations Tagged With: composer, PHP

How to Close and Re-Open WordPress Gutenberg Sidebar

Last updated on June 30, 2023 by Sal Ferrarello

The sidebar gets a lot of use in the WordPress Block Editor, a.k.a. Gutenberg, but I found myself in a situation where I needed to programmatically close the sidebar and then re-open it later. This is how I did it.

Filed Under: Dev Tips, Programming, Solution Tagged With: Gutenberg, JavaScript, WordPress

Get Last Modified Value of a WordPress Post

Last updated on June 19, 2023 by Sal Ferrarello

When reading an article online, I find it helpful to know when the article was last updated. Not all blogs display the last updated value however even when the last updated value is not displayed, the value is accessible via the WordPress REST API. This is how I retrieve the last modified value from the WordPress REST API.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: JSON, REST API, web browser, WordPress

Change Render Size of Featured Image in WordPress Gutenberg Block Editor

Last updated on May 7, 2023 by Sal Ferrarello

In the WordPress block editor (a.k.a. Gutenberg) the “Featured Image” is rendered at the WordPress ‘large’ image size by default. By adding a WordPress JavaScript filter to the ‘editor.PostFeaturedImage.imageSize’ hook, we can change this default rendering.

Filed Under: Dev Tips, Programming Tagged With: Gutenberg, JavaScript, WordPress, WordPress Filter

How to Run Code in the Browser Console

Last updated on May 6, 2023 by Sal Ferrarello

As a developer, a trick I often use is running some JavaScript directly in the browser to confirm the behavior.

Filed Under: Computing, Dev Tips, Programming Tagged With: JavaScript, troubleshoot, web browser

Prevent Dragging an HTML Element

Last updated on March 21, 2023 by Sal Ferrarello

Sometimes users accidentally drag an HTML element into an editable area. This can be prevented by adding draggable=”false” to the element.

Filed Under: Dev Tips, Programming, Solution Tagged With: HTML

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 19
  • Next Page»

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in