Stefan Kecskes

Never stop learning, because life never stops teaching

Laravel validator for CSS selectors

Laravel 5.1 Validators

Last week I was building a backend tool in Laravel, where you could create layout in bootstrap 3 and add CSS selectors like id or class to any container. You wanted to be able to enter more than one class name into input field. Let’s say that you want to add 2 classes: col-xs-6 infoBox_4. Laravel hasn’t validator for this type of string, so I decided to make one. I needed to have validator which accepts alphabetic characters, numbers, underscore symbols, hyphens and spaces. I didn’t want to make it over complex, but still wanted to validate that users enters valid css selectors.


Image sprites using CSS only

What are image sprites and why should I use them?

Image Sprite

Web pages these days have many images. They are also called multimedia rich web pages. It may take a long time to load all of them. Each image means a server request from browser. Did you know that browsers these days download concurrently only 6 resources? That means that browser will start to download next resource only when one of the resources is fully downloaded and the slot is empty for next resource. Browser will do the following, each time when the browser looks into the list of resources needed to display the web page: