When to use UTC and when not to

Photo by Sonja Langford on Unsplash

I’ve noticed that good developers can get confused about datetime logic. Their code relies on datetime libraries to do the heavy cognitive lifting and in return the code becomes buggy.

It’s understandable too because time is deceivingly complex. We stand on the shoulders of giants who have simplified time for our daily lives. Our current calendar and the 24-hour clock are examples. We take them for granted.

When applications rely on datetimes, developers should have a basic understanding of how the world models time. …


A guide to set up a programming project with Node, TypeScript, Mocha, and ESLint.

Photo by Stanley Dai on Unsplash

Programming projects should be set up to make development easy. To do this, projects should have the following abilities.

  1. Watch source files during development.
  2. Watch test files during development.
  3. Lint files on commit.
  4. Build files to a dist folder (and serve them).

Setting up a project is subjective but I hope this gives you a good starting point.

If you want to jump to the code, use the git template I created called node-typescript-mocha-eslint. Not a very original name but it gets the job done.

Note…


Can I build a fully automated aquaponics system? More questions than answers…

Photo by Lettuce Grow on Unsplash

There was a time when I was obsessing over aquaponics. This was back when I lived in an apartment with a close friend of mine.

My goal was to develop an aquaponic system that essentially paid for itself.

I read a book, listened to a podcast, and spent hours researching online. I got over the knowledge hump of, “this is going to be cake!” and got to, “Wow! there’s so much to think about…”.

Water is wonderful but finicky. It weighs about 8.3 pounds per gallon and can…


All developers writing JavaScript should understand automatic semicolon insertion as it relates to return statements.

Photo by Joshua Aragon on Unsplash

JS uses automatic semicolon insertion. This means JS engines will execute code and insert any semicolons where it sees fit.

One of those spots is after a return statement.

function createPerson(firstName, lastName) {
return // ; <-- semicolon inserted by the JS engine
{ firstName, lastName };
}
createPerson("Chris", "Jeffery") // returns undefined

To fix this, we must extend the return statement on the same line the statement starts on. This can be done in several different ways but most notably with different brackets. Of…


There are many different implementations of JavaScript. How does ECMAScript fit in?

Photo by James Jeffery on Instagram

ECMAScript is JavaScript, but the name ECMAScript points to the fact that the European Computer Manufacturers Association (ECMA) is the governing body controlling the specification. It’s more complicated than that and ultimately the specification is influenced by the community at large but that is where the name comes from.

However, the confusion around what name to use is a result of branding and trademark (non) issues. The recommendation is to use JS, not JavaScript, or ES20##. …


“A goal is not always meant to be reached. It often serves simply as something to be aimed at.” — Bruce Lee

Photo by Joshua Earle on Unsplash

The new year is here and the opportunity to make the most of it is slowly declining.

When I look back, I find that my success is directly correlated to my ability to plan and stick to it.

Life happens. Parties happen. Significant others happen. Late nights at work, school, clubs, etc. happen. These events are exciting but they tend to have a spontaneous and unbalanced grasp on our schedules.

This new year we should know our priorities…


The stress-free programming paradigm for filtering arrays and more

Photo by Rima Kruciene on Unsplash

Frankly, I’m shocked by how many programmers are oblivious to functional programming. It’s one of the most pragmatic ways to write safe, well-defined code without understanding its underlining programming principles.

Understanding the underlining principles is important, but this article is a basic introduction. It shows how functional programming can improve code readability, and then it concludes with links to additional resources.

Let’s start by filtering an array of homes with a for-loop.

class Home {
constructor(
public type: "Condo" | "House",
public price: number,
) { }
}
const homes =…


Start using git now so that someday you’ll become a git magician.

By Mimi Thian on Unsplash

Git is one of the most popular source control tools in the universe(?). It allows for large scale collaboration with some simple commands. The following article will share the most basic git commands: add, commit, push, and pull, to start the journey towards becoming a git expert.

I urge you to dive deeper once you’ve become comfortable with the following commands. Let’s begin!

Workspace, [Staging], Repository, and Remote


How to retrieve parameters from the URL and query string in Angular

It’s come to my attention that some people are confused about routing in Angular. Specifically, there’s some confusion around retrieving parameters from the URL and query string. It’s a fairly simple task but it might help to work through an example together. Luckily for you, I created a StackBlitz that helps to explain the differences between using the snapshot and subscription. Let’s take a look at it.

Routes

For our purposes, let’s focus on route parameters. We are going to create the route "animals/:animal". …


CSS Absolute Positioning, You Minx

CSS was never my focus and so building sites with divs spanning the whole page with a header and footer resulted in some pretty hacky code. What can I say, these were hobbyist applications that nobody would actually see. It felt dirty but it was kind of like eating McDonald’s those couple times in the year. Dirty but good.

Recently I had to build this for my work’s application. Build a page that has a header, footer, and side menu that should all be fixed in place. Only the body can scroll. So I started…

Christopher Jeffery

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store