When you create a gallery, you usually want to implement a feature where every time the user clicks (or press the ENTER key) on an arrow, you move straight to the next (or previous) image. This effect can also be used to create a website that has several sections, each of which takes the full window’s height, where at each scroll you move the user to a new section. To achieve this goal, developers have always used JavaScript but the W3C has proposed a new standard called CSS Scroll Snap Points.
Trick of the day: The time element
HTML5 introduced several new elements to address many common use cases that developers have faced over the years. As an example you can think to the new audio
and video
elements that allow you to avoid the use of third-party software like Flash and Silverlight to play audios and videos. While media streams play an important role on the web, the W3C and the WHATWG have also tried to enhance the semantic of web pages. One of these new elements is the time
element.
Trick of the day: Undoing mistakes in Git
Everyone can make a mistake and Git is probably one of the easiest technologies ever where mistakes happen. Sometimes you or other developers commit things that weren’t supposed to be committed or even push them on the remote repository. Usually, once something is pushed you don’t want to mess up with the commit history, but under some circumstances this is totally acceptable. When this happens, you might need a guide to know exactly what to do.
Trick of the day: Memoization in JavaScript
Functions in JavaScript are really different from many other languages as they are first-class citizens. What this means is that they are treated like any other data type, including objects (actually they are objects), and as such functions can possess properties and even functions, can be assigned to variables, and can be passed to other as an argument. In addition, they can be executed which is really what make functions different from other objects.
Trick of the day: User research
As developers we’re usually only concerned about code, but the truth is, as I assert in one of my talks, that all we do is useless if we don’t have users or our users are unhappy. So, it’s important for us to understand how design and UX work and how to make products and services that work for people as well, even if we aren’t going to go into too much details.
Trick of the day: CSS counters
Have you ever heard of CSS counters? It’s a feature of CSS for numbering non-consecutive items, wherever they might be in the DOM. It doesn’t have a lot of uses cases but it’s important to understand this kind of new features to understand how powerful is CSS today.
Trick of the day: Immutability in JavaScript
In computer science there is a concept called Immutability. If you create an immutable object, once it’s created you aren’t allowed to change it anymore. This includes adding, modifying, or deleting a properties. For very simple situations, this concept isn’t used a lot. However, if you start writing complex applications or even games, it comes in handy.
Trick of the day: Sass, Mixin or Placeholder?
Without any doubt, two of the best and most useful features of Sass are mixins and placeholders. A mixin is a directive similar to a function in programming languages in that you can pass arguments. However, a mixin outputs CSS code instead of returning a value as the result of its execution. A placeholder is similar to an abstract class of an object oriented language. When your Sass code is compiled, the body of a placeholder isn’t included in the CSS code unless there’s a CSS class extending the placeholder.