What is an HMAC?
I recently was asked to explain some code that used an HMAC signature for authenticating/verifying a message. While I understood that HMACs are used for message authenticity, I did not fully grasp the implementation. Here is the information I have discovered through more research.
MAC stands for “message authentication code”. Essentially, it is a way to generate a code to be submitted with a message that verifies the sender of the message and also verifies the message has not been modified.
Jan. 17, 2020 • 4 mins
Let's Talk Windows vs macOS
When I started writing websites professionally, my work computer ran Windows so I had to learn to set up PHP and Laravel using IIS (an unpleasant experience). However, my personal computer was a 2015 MacBook Pro and I really liked the Bash terminal, Homebrew and Valet. When I moved to my current employer, I had the option to have an HP laptop or a MacBook so I naturally chose the MacBook.
Dec. 27, 2019 • 4 mins
Introduction to PHP 7.4 Preload
PHP 7.4 is the latest version of the PHP programming language that will launch later this year. PHP 7.4 recently went into beta, so I started exploring the new features. One feature showing a lot of promise is called Opcache Preload. Using preload you can set PHP to load certain PHP files into memory on startup. Doing so reduces the amount of files PHP has to compile when receiving an HTTP request which improves performance.
Aug. 10, 2019 • 3 mins
webdev
php
preload
opcache
How to Write a Magento 2 Console Command
In Magento 2, the platform introduced a new command line interface called bin/magento that is included in every installation. Most Magento developers are familiar with it because it makes it very easy to peform common tasks on the install like clear cache and install a database. What you might not know is that you can add custom commands to the Magento CLI to allow you to run your own code.
Jun. 9, 2019 • 3 mins
GraphQL Server Primer
GraphQL is one of the hottest topics in web development right now. I do a lot of work with Magento and they recently announced a whole new GraphQL API to be used for front end development. To learn GraphQL, I built an experimental Magento frontend using Next.js. After that project, I still did not understand how to build a GraphQL server. As a result, I decided to build an example GraphQL server using Node.
Mar. 24, 2019 • 8 mins
webdev
graphql
javascript
Rewriting My Personal Site with Hugo
A couple months ago I created my personal website called andrewdavis.me. I built it as a custom server side app in Go with MySQL holding the content. I wrote about the experience in Building My Personal Site with Go and TailwindCSS. I enjoyed the project, however, I recently wanted to make some SEO improvements and decided maintaining a custom app was more work than I wanted. I started looking at different static site generators and found Hugo.
Mar. 4, 2019 • 4 mins
Creating a Magento Theme With Next.js and GraphQL
At the end of 2018, Magento released the 2.3.0 version of their e-commerce framework with a new GraphQL API. Traditionally, Magento themes are created with PHP templates, similar to WordPress. However, with the new GraphQL API and PWA Studio, new themes can be created in JavaScript frontend frameworks like React and Vue. To experiment with the API, I have created an open source theme called Basil using React, Next.js and Apollo.
Feb. 12, 2019 • 4 mins 30 secs
webdev
javascript
react
magento
Announcing PHP Apprentice
I am excited to finally announce PHP Apprentice! It is an online, free and open-source book for learning the PHP programming language. The book is a side project I have been building for six months. My goal is to provide a contemporary resource for learning the basics of PHP with a focus on high quality code. PHP has been around for 25 years and has changed a lot since its inception.
Jan. 11, 2019 • 3m 18s
Building My Personal Site With Go and TailwindCSS
Recently, I found the domain andrewdavis.me available for purchase. I tried to buy it in the past, but it was already taken. I quickly purchased the domain, but then I had to decide what to put on it. I made up my mind to build a personal website that would showcase my work and writing. However, I wanted to use it as a learning opportunity and build the site in something unconventional.
Dec. 17, 2018 • 5m 18s
Showing Kindness While Programming
Software development and programming is a difficult profession. It is very new and requires a lot of practice, learning and mental focus. It can get frustrating when you are working with others and mistakes are made. Programmers are also very demanding of those who provide our programming languages and frameworks, especially with bugs or problems that hinder our daily work. When we encounter these problems, it is very tempting to get angry and make a snide comment on social media or give a dirty look in the office.
Nov. 20, 2018 • 6m 36s
productivity
career
webdev
Writing Beautiful Code
Because programming is a technical profession, we often approach it without thought to design. Code is for getting a computer to do what we need, why should design matter? The majority of the programming languages we use were built for the programmer and are transformed into something that is optimized for the computer. As a result, we need to write our code, not just for the compiler or interpreter, but for humans to read.
Sep. 24, 2018 • 7m 6s
Security Tips for a PHP Application
I know what many of you are thinking! PHP and security? Why bother? Just use another programming language!
Contrary to popular belief, PHP is still a viable language for building web applications. PHP is just another tool that you need to learn to use properly. Let’s discuss a few items specific to PHP that will make your site safer.
1. Limit Your Web Root to an index.php and Asset Files In modern PHP, you will point your web server to a directory with an index.
Aug. 7, 2018 • 5m 28s
Introduction to Go for PHP Developers
Recently, I started working on an internal CLI app for my team at work. My main programming language of choice is PHP, but I wanted to create this program in a language that could run on any platform without having to have an interpreter already installed. I also wanted the app to be self contained in a single binary for easy distribution and installation. I downloaded Go and was pleasantly surprised at how easy to learn the language is and how productive I got with it in a short amount of time.
Jul. 18, 2018 • 9m
My Sublime Text Setup for PHP
I have been using Sublime Text for coding in PHP for several months now and over that time have accumulated several useful plugins and editor settings. I have not seen many recent articles about setting up Sublime Text, especially for PHP, so I want to share how my setup works and what has been most helpful for me to write code productively.
Preferences Sublime Text has a preferences area where you can tweak the layout of the editor using JSON.
Jun. 3, 2018 • 6m
Choosing PHP in 2018
I bet you do not see those words very often.
We live in a time where there are a plethora of programming languages and frameworks. As web developers, we have so many options, it can be very difficult to know what to learn and use to build a modern website. If you check StackOverflow, Hacker News or Twitter, you will see thousands of different opinions about what language you should be using.
Apr. 29, 2018 • 3m 6s
Avoid Burnout and Get Back to the Basics
Ever feel overwhelmed by how much there is to learn? Is the pressure to learn Redux, CSS Grid, TypeScript, Go, Rust, Elixir, Kotlin or Elm getting you down? The software industry changes so quickly, it is very hard to keep up with all of the newest trends. Because software evolves rapidly, I think it can create an undercurrent of fear in programmers about getting left behind if they do not learn every new technology (I know it does to me).
Apr. 2, 2018 • 5m 42s
webdev
productivity
career
programming
Tips for Learning Linux Servers
As a web developer, I do backend programming as part of my daily work. Even though I do all of my development on a Mac, my code runs in production in a Linux environment. Even though I don’t plan to be a systems/devops engineer, I’ve always wanted to know more about Linux and how to manage it. I think it is good for any backend developer to gain some Linux knowledge, just to have more background on how code runs on a Linux server.
Mar. 11, 2018 • 4m 6s
Why You Should Be Unit Testing
Unit testing feels like running for exercise. It is something you know you should be doing, but it is really hard to get motivated to start. When I first began programming, I thought unit testing was redundant. I manually test everything, so why should I take the time to write more code? It took time for me to learn unit testing, but now I see the benefits. Here are a few reasons why unit testing is so important.
Feb. 19, 2018 • 5m 12s
Why I Switched From Visual Studio Code to Sublime Text
Recently, I switched to using Sublime Text as my main code editor. For over a year, I had been using Visual Studio Code for writing code. The two editors are very similar, but have enough differences that I wanted to share what lead me to using Sublime full time. Note: this post is not about bashing one piece of technology for another. I try to give an honest comparison from my personal experience, but choosing a code editor is a subjective process, so everyone will have a different opinion about their favorite.
Jan. 25, 2018 • 5m 6s
Four Tips for a More Secure Website
Security is a hot topic in web development with great reason. Every few months a major website is cracked and millions of user records are leaked. Many times the cause of a breach is from a simple vulnerability that has been overlooked. Here are a few tips to give you a quick overview of standard techniques for making your websites more secure. Note: I do not guarantee a secure website if you follow these suggestions, there are many facets to security that I don’t even touch in this article.
Jan. 8, 2018 • 3m 30s
Swift for Web Developers
Swift has become a standard language for iOS development and is becoming a popular language for server side programming as well. My previous programming experience is mostly with PHP and JavaScript, so Swift was a whole new world when I started. I’m writing this post to give web developers coming from PHP, Python or Ruby a head start on how to use Swift.
Installation MacOS Installing Swift on a Mac is super easy.
Dec. 16, 2017 • 10m 48s
Cherry Picking in Version Control
Lately, I have been trying to improve my knowledge of git. I think it’s a tool that is often overlooked in our day-to-day as developers because we focus so much on writing code. When something goes wrong with version control, it’s easy to want to blow away a branch and manually copy code to a new one or even remove the local repository and clone again. Instead of taking the hard road, let’s try to correct conflicts or inconsistencies with the features already provided by git.
Dec. 8, 2017 • 3m 54s
git
version control
productivity
Imposter Syndrome: PHP Edition
Have you seen this cartoon before? The Lisp panel is especially ((((((hilarious)))))). It is fun to mock each eccentricity of a programming language. Unless you are a PHP developer. Apparently, PHP isn’t uniquely flawed like all programming languages, it is just suicidal.
Programming is an amazingly cliquish community. Every developer has a preferred language with philosophical reasoning or performance rankings to back up the choice. I love the variety we have when picking a technology, it keeps the industry exciting and nimble.
Nov. 28, 2017 • 3m 30s
PHP
Imposter Syndrome
Web Dev
Career