• 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 Dev Tips

Dev Tips

JavaScript Unix Timestamp from String in Time Zone

Last updated on February 27, 2022 by Sal Ferrarello

Given a string like “2022-01-01 13:00:00”, which represents a time in the “Europe/Paris” timezone, how can we get the corresponding Unix Timestamp in JavaScript? This problem is sufficiently complex that in my opinion leveraging a third-party library is the best solution.

Filed Under: Dev Tips, Programming, Solution Tagged With: DateTime, JavaScript, time zone

Local by Flywheel from Sub-Directory

Last updated on February 27, 2022 by Sal Ferrarello

I was recently working on a project that loaded WordPress from a sub-directory. The result of which is if I cloned the project into the “public” directory, the WordPress files and directories were one level deeper (in “public/wordpress”).

Filed Under: Dev Tips, Solution, Uncategorized Tagged With: Local by Flywheel, nginx

WordPress Gutenberg Notice in JavaScript

Last updated on February 20, 2022 by Sal Ferrarello

You can display four types of notices in the WordPress Block Editor (a.k.a. Gutenberg) using JavaScript: error, warning, info, and success. This blog post contains an example of each.

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

Disable Core WordPress Update Notice

Last updated on February 7, 2022 by Sal Ferrarello

When working on projects, I often want to strictly control the version of WordPress that is running. However sometimes one of the other administrators on the site sees the “WordPress 5.9 is available! Please update now.” message and clicks it, thereby prematurely updating to a newer version of WordPress core. This notice can be disabled.

Filed Under: Dev Tips, Programming, Solution Tagged With: WordPress, WordPress Core

git reset –hard vs git checkout -f

Last updated on February 8, 2022 by Sal Ferrarello

I recently had a conversation about “git reset –hard” vs “git checkout -f”, and it turns out they do the same thing. This is one of the tricky things about Git, there are often multiple ways to do the same thing.

Filed Under: Computing, Dev Tips Tagged With: Git

git alias tab completion for functions

Last updated on February 6, 2022 by Sal Ferrarello

When creating a Git alias that points to a function, sometimes Git provides the wrong tab completion by default (e.g. filename completion instead of branch name completion). This is how we can tell Git, which type of completion to use.

Filed Under: Dev Tips, Programming, Solution Tagged With: Git, git alias

git reset vs revert

Last updated on November 15, 2021 by Sal Ferrarello

Conceptually, “git reset” is erasing your last change while “git revert” is adding a new change that undoes your previous change.

Warning! This is a draft, not a finalized post. See full draft disclosure.

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

Check CORS Value from Command Line

Last updated on November 11, 2021 by Sal Ferrarello

I was checking a number of URL endpoints for CORS restrictions today and I wondered if I could check from the command line. Here are some example curl statement that get me the information I’m looking for. I think there is an opportunity for a custom function here but for now, these notes will do.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming Tagged With: CORS, curl

Display Keyboard Shortcut in WordPress Gutenberg

Last updated on October 15, 2021 by Sal Ferrarello

In Gutenberg (a.k.a. the WordPress Block Editor), keyboard shortcuts are displayed differently on Apple devices and other devices, e.g. ^H on an Apple device and Ctrl+H on other devices. This is accomplished with wp.keycodes.displayShortcut.

Warning! This is a draft, not a finalized post. See full draft disclosure.

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

Using jq and nvm to set Node version

Last updated on March 3, 2022 by Sal Ferrarello

The nvm command allows you to switch between versions of node. Often a project will include a .nvmrc file to specify the version of node to use. Even if a project does not contain an .nvmrc file, you may be able to read the preferred node version from package.json and use that value with nvm.

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

  • «Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to page 5
  • Interim pages omitted …
  • Go to page 20
  • Next Page»

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