Curtis Timson

Front End & .NET Developer

Page 2 of 3

What is cache busting?

A cache-buster is a unique string which is appended to a URL in the form of a query string. It is generally not read by the server-side and is used purely to form a unique URL. For example: /Scripts/foo.js?v=1 This… Continue Reading →

Quickly create HTML elements in jsFiddle

In case you haven’t already heard of it, jsFiddle is a web application which allows you to enter HTML, CSS and Javascript into different windows and render the output. It’s a great tool for testing various front-end concepts, and then… Continue Reading →

Abstract config settings from web.config

In ASP.NET, application settings can be specified in the web.config file such as: <appSettings> <add key=”PostsPerPage” value=”6″ /> <add key=”CookieName” value=”Foo” /> </appSettings> The beauty of this is that you don’t need to edit code to make changes to the… Continue Reading →

Copy table schema to new a table

In SQL Server, SELECT INTO is used to copy data from an existing table/s into a new one. However by adding a WHERE clause which will always return false, this will prevent any data from being copied, and therefore create… Continue Reading →

Create a flashing tab notification page title

Page title notifications switch between the default page title and a notification message continously in order to grab the user’s attention. This is commonly used with chat applications. I’ve written a small javascript object which can be used to switch… Continue Reading →

Namespacing jQuery event handlers

If we are to attach 2 or more event handlers to an element these will become stacked and run linear in the order they were attached. For example: $(“.foo”).on(“click”, function(e){ console.log(“bar”); }); $(“.foo”).on(“click”, function(e){ console.log(“baz”); }); If .foo is then… Continue Reading →

Default negative variables to zero in javascript

If you need to default a value to 0 if its negative, you could do: var i = -45; if (i<0){ i = 0; } console.log(i); //0 However, a shorter way of doing this would be to use Math.max() passing… Continue Reading →

Understanding jQuery data() storage

It is a common misunderstanding that .data(“key”) is simply a shortcut for .attr(“data-key”). .data() does read HTML5 data attributes, but this is only the first time it is called, as per the documentation: The data- attributes are pulled in the… Continue Reading →

console.log() vs alert() when debugging

Using console.log() is a great way of getting quick results about what variables are holding what values at which point, and which areas of code are being called, without having to debug. Before javascript debugging became so accessible, one of… Continue Reading →

Reading URL hashtag values

URL hashtags were primarily used in order to position the page scroll on load to a particular element. With javascript we can access what the value of the hashtag is on page load. if (window.location.hash){ var hash = window.location.hash.substring(1); alert(“hashtag… Continue Reading →

« Older posts Newer posts »

© 2017 Curtis Timson — Powered by WordPress

Theme by Anders NorenUp ↑