Code posts

Learn to count with CSS

By Sara Vieira  |  May. 17, 2013  |  1 comment

Hidden away in the depths of the CSS specification you’ll find CSS counters. As the name suggests they allows you to count a thing on your page with CSS incrementing the value every time it appears on the document.

This is principally useful if you have a tutorial website — whether that be about cooking or web development — they all have steps to follow, and you’ll most likely have to write the step number before the actual content. CSS counters can help by doing that automatically, you can even use it to count the images on your file and add figure numbers...

How to use local storage for JavaScript

By Sara Vieira  |  Apr. 30, 2013  |  3 comments

Creating an to-do app is usually the first application you learn how to build in JavaScript but the problem with all those apps is that when you reload the page all those to-do’s are gone.

There is a simple solution though, and that’s to use local storage. The good thing about local storage is that you can save those bits of data to the user’s computer so that when they reload...

How to use the download attribute

By Sara Vieira  |  Apr. 22, 2013  |  19 comments

HTML5 came with all new APIs, new input types and attributes for forms. As is often the case, those major additions often obscure the minor upgrades and I think that this is particularly true of the download attribute.

As you know, there are some files that the browser doesn’t automatically download; images, other web pages and depending on the settings in your browser, sometimes even PDFs. The download attribute gives the browser a native...

How to write markdown

By Sara Vieira  |  Apr. 15, 2013  |  10 comments

Recently, there’s been a lot of talk about markdown as an alternate way to format text.

I decided to do a little research and see what all the talk was about and I was actually quite glad of what I found; markdown is simple markup language that makes it easier for writers to write good content for the web without having to worry about the HTML code in their articles.

The benefit of using markdown is that...

Optimize your JavaScript with RequireJS

By Sara Vieira  |  Feb. 11, 2013  |  3 comments

RequireJS is an effective way to improve the speed and quality of your JavaScript code additionally making it a lot more readable and easier to maintain.

In this article I’ll introduce you to RequireJS and how you can begin using it. We will go through requiring files and defining a module and even touch on optimization.

In simple terms...

How to harness Yahoo!'s weather API

By Darren Jamieson  |  Dec. 6, 2012  |  2 comments

In 2006, while working at a design agency in Cardiff, Wales, I conceived of an idea to feature on our website the current weather conditions outside our office. I wanted to make our website fully engaging and to show our visitors and clients what we were experiencing in real life each day, in real time.

After doing some extensive research, I discovered that the best starting point for this is Yahoo!’s Weather API, because it gives weather conditions in a consistent, usable format. At the time, however, the only...