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

Programming

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

phpcs no matches found ignore

Last updated on March 13, 2023 by Sal Ferrarello

When running phpcs with the –ignore option (because I don’t want to scan the /vendor nor /node_modules directories), I kept getting the error “zsh: no matches found: –ignore=/vendor/*,/node_modules/*”.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: PHPCS, zsh

Don’t Do It Now, Open an Issue Instead

Last updated on February 26, 2023 by Sal Ferrarello

When working on an issue, it is easy to get sidetracked by other unrelated changes that need to be made. I’ve found that instead of addressing other issues as I spot them, taking a moment to open an issue and then ignoring them allows me to stay focused on the task at hand.

Filed Under: Dev Tips, Programming, Recommendations, Solution Tagged With: focus, lifehack, motivation

WordPress View Block Attributes

Last updated on February 8, 2023 by Sal Ferrarello

When developing a WordPress plugin that creates a Gutenberg block, it is invaluable to be able to view the attributes on the block. Here are some tricks I use to view this information.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: block, Gutenberg, WordPress, WordPress Plugin

Automatically Switch Node Version in Zsh from package.json

Last updated on January 12, 2023 by Sal Ferrarello

Add this code to $HOME/.zshrc to automatically set the node version to match the version in package.json.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: command line, jq, node, nvm, zsh

Getting Started with LuaSnip

Last updated on November 23, 2022 by Sal Ferrarello

This article assumes you are using Neovim (version 0.8.0 or higher) and packer.nvim to manage your plugins. Adding the following loads the LuaSnip plugin, creates a snippet for “func”, and maps “Ctrl + p” to expand the snippet and jump through the fields.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: lua, neovim, vim, vimplugin

vim.keymap.set() coc to confirm completion with lua

Last updated on November 13, 2022 by Sal Ferrarello

I’m currently rewriting my Neovim configuration using lua rather than using vimscript. I’m using the coc.nvim plugin and want to map return () to confirm completion. The coc.nvim wiki has an entry to Use to confirm completion however their solution is in Vimscript.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: lua, neovim, vim

trailingslashit() vs untrailingslashit()

Last updated on November 1, 2022 by Sal Ferrarello

WordPress has two functions that can be helpful when dealing with the final character of a URL, trailingslashit() and untrailingslashit(). I find it preferable to use untrailingslashit() for two reasons: 1. It does not break empty checks and 2. It makes my sprintf() statements more readable.

Filed Under: Computing, Dev Tips, Programming Tagged With: PHP, WordPress, WordPress Plugin

How to Disable beforeunload Event Listeners

Last updated on August 4, 2022 by Sal Ferrarello

I was doing some troubleshooting and wanted to disable the “beforeunload” event listeners on a page. This is how I accomplished it with the Chrome browser.

Filed Under: Computing, Dev Tips, Programming, Solution Tagged With: Chrome, JavaScript

Always Bring Your Pull Requests Up to Date

Last updated on April 26, 2022 by Sal Ferrarello

A Pull Request (PR) should always be up to date with the branch into which it is being merged. Another way of saying this is you should be able to merge your PR as a fast-forward merge (even if you decide not to do a fast-forward merge). In this post we’ll look at how a safe looking PR that is out of date can be catastrophic to merge.

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

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

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