Curtis Timson

Front End & .NET Developer


Curtis Timson

Default parameters with ES6

With ES5 if you wish to set default parameters on a javascript function you would be required to check the value and supply a default if one hadn’t been set. var myFunction = function(arg1, arg2){ arg1 = arg1 || 25;… Continue Reading →

8 Tips to increase front end website performance

Recently I’ve been working on front-end performance improvements for a large web application and would like to share with you my findings. The following, in no particular order, are simple tips for achieving greater website performance: 1. Use a Content… Continue Reading →

Filtering arrays in AngularJS

Previously I wrote an article on how to display data from a simple javascript array using AngularJS. Following on from that this next article will show you how to filter that same array by particular properties. In the previous article… Continue Reading →

Setting up a simple AngularJS app to display an array

AngularJS is a powerful Single-Page-Application javascript framework created by Google. The following is a simple tutorial on how to set up an AngularJS application to display a javascript array of user information. First of all we’ll start by creating our… Continue Reading →

How to store razor helpers globally

ASP.NET MVC Razor helpers are a great way of reducing duplicated code by containing code snippets in a View which can then be called multiple times. <div> @DisplayGreeting(“Curtis”) </div> @helper DisplayGreeting(string name) { <span>Hello @name</span> } However what if you… Continue Reading →

Managing @font-face definitions with LESS

A typical @font-face definition looks something like this: @font-face { font-family: ‘CustomWebFont’; src: url(‘customwebfont.eot’); src: url(‘customwebfont.eot?#iefix’) format(’embedded-opentype’), url(‘customwebfont.woff2’) format(‘woff2’), url(‘customwebfont.woff’) format(‘woff’), url(‘customwebfont.ttf’) format(‘truetype’), url(‘customwebfont.svg#svgFontName’) format(‘svg’); font-weight:normal; font-style:normal; } Here we are defining the font’s name, weight, style, and providing various… Continue Reading →

Using @font-face and preventing faux-styles

@font-face is used in CSS to define a custom font style for a web page. Some custom fonts come with multiple type-faces for different weights and italic styles. These are often defined with seperate font-family names for each type-face. For… Continue Reading →

Preventing console.log issues in IE

In some older browsers, including versions of Internet Explorer, window.console doesn’t exist and therefore calling console.log() will result in an error. One way of fixing this is to create a function which checks whether console exists and use this function… Continue Reading →

Round to the nearest decimal

If we need round to the nearest whole number, we can use the Math.round() function to return this: Math.round(1.34234); //returns 1 However what if we need to round to a decimal place? For example 0.5. The following function can be… Continue Reading →

Mixing Revealing Module and Singleton Javascript Patterns

Until recently I’ve been using the Singleton pattern for my javascript objects. This works well as my functions are namespaced and therefore the risk of clashing object names across Javascript files is reduced. For this example I’ve created a singleton… Continue Reading →

© 2017 Curtis Timson — Powered by WordPress

Theme by Anders NorenUp ↑