Code posts
A taste of CoffeeScript (part 1)
Let’s face it, JavaScript hasn’t always had the best reputation among developers, and since the foundation of CoffeeScript back in 2009 this little language has taken the world of JavaScript developers by storm; mainly because it overcomes what some may say is the worst aspect of JavaScript: the syntax of its code.
Even though this is a new language you will pick it up really fast mainly because it’s reformulated JavaScript; it’s essentially prettier, simpler JavaScript .
When writing CoffeeScript don’t forget you are writing code that before being deployed is going to be compiled into JavaScript that follows best practices...
Learn to count with CSS
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
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
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
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
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
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...