Trick of the day: CSS Scroll Snap Points

Trick of the day: CSS Scroll Snap Points

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

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

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

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: Sass, Mixin or Placeholder?

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.