Rob's Code Lab

Active PostsCategory: All

Generators, Part 2

The Python range function is a generator, and in this post we look at how range works under the hood. This is accomplished by creating our own range class and incorporating an iterator protocol into it. We then create an instance of our custom class and use a custom for statement to iterate over it.


HTML5 Table of Contents

An often overlooked aspect of good web design is ensuring that each page has a proper HTML structure. In this post, we take a look at a simple Table of Contents tool that can be used to check your page hierarchy from the point of view of a screen reader. In addition, a few “best-practice” rules are reviewed for ensuring a good page layout, in terms of both structure and semantics.


A Grid Based Image Gallery

Here are notes and code behind my project Wings Photo Gallery. This project features an image gallery that was built using a CSS grid layout and a little bit of JavaScript. Additionally, media queries were incorporated into the mark-up language to make the project page responsive.



In this post we take a look at how destructuring can be used to conveniently unpack values from arrays, or properties from objects, into distinct variables.


The Spread and Rest Operators

While working with a modern JavaScript application, you will often come across both the spread and the rest operators. Both of these operators use the three-dot notation (...), and the code in this post shows how each is used.


Older Posts

Older Posts >>