universal.css

The only .css file you’ll ever need, following the most recent CSS methodologies where you define just about everything in separate classes. Usage is really easy: Take any CSS rule you want to apply, replace : by -, and dots by -dot-, and you get the name of the corresponding universal css classname. For instance, …

JavaScript Unary + Operator

Today I learned: In JavaScript it is possible to use the + operator alone before a single element. This indicates a math operation and tries to convert the element to a number. If the conversion fails, it will evaluate to NaN. This is especially useful when one wants to convert a string to a number …

Setting up React for ES6 ES2015 with Webpack and Babel

This resource came in quite handy when setting up React in combination with ES6 ES2015, Webpack and Babel. Installing all the required dependencies: # Install Webpack npm install –save-dev webpack # Install the Babel Loader, for use with Webpack npm install –save-dev babel-loader # Install the es2015 and react presets, for use with Babel npm …

ReactiveElements: Convert React.js components into Web Components

Create your component as you normally would, and then register it on the document using document.registerReact(…) /* @jsx React.DOM */ MyComponent = React.createClass({ render: function() { console.log(this.props.items); // passed as HTML tag`s argument console.log(this.props.children); // original tag children return <ul><li>React content</li></ul>; } }); document.registerReact('my-react-component', MyComponent); You can then use it as follows: <body> <my-react-component items="{window.someArray}"></my-react-component> …

A Complete Guide to CSS Grid Layout

Great cheat sheet / guide by Chris House, on Grid Layout — a CSS spec that has gotten me really excited ever since it has been announced (over two years ago): My intention with this guide is to present the Grid concepts as they exist in the very latest version of the specification. So I …

ES6 ES2015 in Depth

There’s a good set of articles on ES6 ES2015 over at Pony Foo: Promises, Arrow Functions, Template Literals, Classes, Modules, Array Extensions, Destructuring, Iterators, Maps, Proxies, … it’s all covered. The post ES6 ES2015 Overview in 350 Bullet Points is a nice summary of ‘m all. Pony Foo: Articles tagged es6-in-depth →

CSS: Selecting a range of elements

Say you want to select the 7th up and to the 14th element of a set of elements. It’s possible, using this selector: ol li:nth-child(n+7):nth-child(-n+14) { background: lightpink; } See the Pen Selecting Ranges of Elements with CSS on CodePen. (from 12 Little-Known CSS Facts (The Sequel)) Related: Quantity Queries for CSS →

Designing More Efficient Forms: Structure, Inputs, Labels and Actions

I see it happening a lot: forms without any structure, with wrong types of inputs, with no proper labels, with … – And that’s a bad thing. All the required HTML elements (<fieldset>, <input> types, <label>, etc.) are there, so why not use them? This article has a nice writeup on how to properly create …

Why JavaScript Development is Crazy

The state of Javascript development is overwhelming and confusing because everyone is over-engineering their apps by default without even realizing it. How should you start a Javascript application? Should you ever use something like React or Angular? Should you use a package manager? What do you do if you don’t? Are tests even necessary? Should …