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

Programming

Building blocks representing two Git branches, one with a merge commit where the top commit has two parents.

Git Merge Commit with Blocks

Last updated on February 21, 2021 by Sal Ferrarello

We can’t do a fast-forward merge when the most recent commit on the receiving branch does not appear in the branch we are merging in. One of our options in this situation is to create a merge commit when we merge in our branch.

Filed Under: Dev Tips, Programming Tagged With: Git

What is a Git Branch?

Last updated on February 7, 2021 by Sal Ferrarello

While my mental model visualizes a Git branch as a stack of building blocks, in actuality a Git branch is a pointer to a single commit. Under the hood Git stores a text file for each branch and in the text file is a single line, which is the commit hash indicating the commit at the tip of that branch.

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

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

What is a Git Commit?

Last updated on February 7, 2021 by Sal Ferrarello

A Git commit, represented by a single building block in my Git mental model, is a frozen moment in time for your project (sometimes referred to as a snapshot). Along with this snapshot Git stores metadata about the commit (e.g. the author of the commit). Each commit has a unique identifier called the commit hash (a.k.a. SHA), a 40 character long alphanumeric string that is often abbreviated to just the first seven characters (e.g. “2b3a38b”).

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

Filed Under: Computing, Draft, Programming Tagged With: Git

Building blocks representing two Git branches with the commit on one branch removed as happens in a rebase.

Git Rebase with Blocks

Last updated on February 21, 2021 by Sal Ferrarello

We can’t do a fast-forward merge when the most recent commit on the receiving branch does not appear in the branch we are merging in. One of our options in this situation is to rebase the branch we want to merge in.

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

Promise and Async / Await

Last updated on August 7, 2020 by Sal Ferrarello

Making fetch calls with Promises vs async/await.

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

Filed Under: Draft, Programming Tagged With: JavaScript, JS async / await, JS Promise

Enable, Read, and Write Post Meta in WordPress Gutenberg

Last updated on January 13, 2021 by Sal Ferrarello

The WordPress block editor (a.k.a. Gutenberg) communicates with the database via the WordPress REST API. We can read and write post meta from within the Gutenberg editor after we enable the specific post meta field in the WordPress REST API.

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

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

Join Strings with Commas and “And” in JavaScript

Last updated on July 16, 2020 by Sal Ferrarello

In English the rules we use for joining a list of items involves more work than a standard join in JavaScript. Here is JavaScript code to join an array of elements with commas and an “and”.

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

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: JavaScript

Add WordPress Posts Column

Last updated on July 2, 2020 by Sal Ferrarello

Code to add a custom column to the WP Admin Posts listing page.

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

Filed Under: Draft, Programming, Solution Tagged With: WordPress, WordPress Filter

Why __() needs a hardcoded string in WordPress

Last updated on June 18, 2020 by Sal Ferrarello

When using a WordPress translation function, e.g. __(), you need to use a hardcoded string (not a variable).

Filed Under: Dev Tips, Programming, Recommendations Tagged With: Internationalization (I18n), WordPress

JavaScript get Date in YYYYMMDD Format

Last updated on June 15, 2020 by Sal Ferrarello

Recently, I was working in JavaScript and I need to transform a date into the format YYYYMMDD, this is how I did it.

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

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

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

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