ugprade



How to create a Composer package from scratch

Available to Premium members only
  • avatar
  • 1.8K Views
  • 1 Like
  • 16 mins read
How to create a Composer package from scratch

A helper class, a small client wrapper or a set of validation rules often starts in one project and ends up copied into the next one. From that point the copies drift apart, a bug fixed in one of them stays open in the rest, and there is no version number to refer to when something changes.

Turning that code into a Composer package removes the copies. The requirements are modest, since a package is a directory containing a valid composer.json file, a Git repository hosting it, and a listing on Packagist that tells Composer where to find it.

Serial communication between two Arduino boards

Available to registered members only
  • avatar
  • 1.8K Views
  • 9 mins read
Serial communication between two Arduino boards

Getting two Arduino boards to talk to each other opens up projects that a single board can't handle on its own. You might have one board reading sensors in one corner of a room and another driving a display somewhere else, and the two need to share what they know. Serial communication is one of the simplest ways to make that happen, and it works with almost any Arduino model you have lying around. This article walks through connecting two Arduino Nano boards and passing data back and forth over their serial ports.

Image optimization for the web

Available to registered members only
  • avatar
  • 1.4K Views
  • 18 mins read
Image optimization for the web

Images are almost always the heaviest thing on a web page. A single hero photo can weigh more than all the HTML, CSS and JavaScript of a site put together, and every extra kilobyte delays the moment a visitor finally sees something useful. Search engines notice it, and users on mobile data notice it faster. The encouraging part is that image delivery is one of the few areas where the fixes are well documented, mostly automatable, and visible in the metrics almost immediately.

 Join Our Monthly Newsletter

Get the latest news and popular articles to your inbox every month

We never send SPAM nor unsolicited emails

How to track online users with Redis

  • avatar
  • 1.3K Views
  • 11 mins read
How to track online users with Redis

The number of people using a website right now is a common metric. It shows how active the site is at a given moment, and it makes traffic visible while it happens instead of after the fact. Analytics services can report it, but with a delay and outside the application. Redis can keep it inside your own code: each page view records the visitor, and the count is read for the last X minutes, where X is a value from the configuration file that can be changed at any time.

How common Git commands work and what they affect

  • avatar
  • 1.0K Views
  • 14 mins read
How common Git commands work and what they affect

Git is a widely used version control system, and its commands cover everything from saving a single change to rewriting the history of an entire repository. Each command acts on a specific part of the repository, and choosing one without knowing what it changes can rewrite shared history or discard work that was never saved anywhere else.