Hey, welcome!
I'm Andreas Wik, a Swedish Front-End Web Developer, currently based in London, UK.

Use Your Own Custom Broken Image Icon For Your Website

December 4, 2018 by Andreas Wik

Are you sick of the standard broken image icons the web browsers out there use? Luckily, there’s a really simple way to replace it with your own custom image. Or, you can just hide it completely.

Read

Calculations In CSS With calc()

November 30, 2018 by Andreas Wik

calc() is a nifty little feature in CSS which lets you – oh yeah, you guessed it – calculate stuff. Great when working with values that need to be dynamic and that you otherwise would have to achieve with JavaScript.

Read

Using Local Storage With JavaScript – The Database Built Into Your Browser

November 17, 2018 by Andreas Wik

Local Storage is a storage in your browser where you can easily save data in key value pairs. It’s a really handy alternative to cookies as you have a lot more storage to work with (around 5MB compared to the few KB’s you can use for cookies, although it does depend on the browser at […]

Read

Variables In CSS Without Sass/SCSS

August 14, 2018 by Andreas Wik

You might think about SASS/SCSS when you hear “CSS variables”, but CSS does have variables available and the browser support is actually quite good.

Read

Determine If A Color Is Bright Or Dark Using JavaScript

August 7, 2018 by Andreas Wik

Finding out whether a color is light or dark can be really handy when working with dynamic content. Let’s say you have a profile page and the user can set their own page background color. You could then set the color of the text on top depending on the background color’s brightness.

Read

Full Screen Mode For Your Website

August 2, 2018 by Andreas Wik

Let’s say you’re building a game that will be played in the browser. You would want the players to have the ability to turn the website/game into full screen mode, right? Here’s a quick and easy way to do it.

Read

Run JavaScript Code Snippets On Remote Websites With Chrome Dev Tools

July 28, 2018 by Andreas Wik

Did you know that you can run JavaScript snippets on any website you’d like in Chrome, just like you can edit the CSS or HTML on the page? You can, here’s how.

Read

Measure Your JavaScript Code Execution Time

July 24, 2018 by Andreas Wik

There are times when you want and need an easy way to measure your JavaScript code’s performance. Let’s have a look at two different methods to get the execution time in milliseconds.

Read

Manipulate Images Dynamically With CSS Filters

July 21, 2018 by Andreas Wik

With CSS filters we can easily manipulate images, such as turning them black and white, make them blurry, adjust brightness, contrast and colors, and more.

Read

International Email Address Validation With JavaScript

July 17, 2018 by Andreas Wik

Email validation can be quite tricky. While there are a lot of regular expressions out there that you can easily find by quickly Googling, many of them lack something crucial: they don’t let through international email addresses with unicode characters.

Read

Extract GPS Location And Other EXIF Data From Photos Using JavaScript

July 15, 2018 by Andreas Wik

EXIF data contains info such as the device maker (e.g. Samsung), device model, date and time the photo was taken, GPS location data, and a lot of other stuff. Let’s take a look at how you can extract this data using JavaScript.

Read

Preload Images And Other Assets With JavaScript

July 5, 2018 by Andreas Wik

If you’re building, say, a game, or maybe a beautiful website with a lot of heavy graphics, you might want to make sure everything is loaded before you present it. With Preload JS we can do exactly this. Let’s dive right in.

Read

Make Your Form JavaScript Validation Errors Accessible For Screen Readers

June 30, 2018 by Andreas Wik

Accessibility is important, and here follows an easy way to make your JavaScript errors accessible for screen readers when, for example, validating forms.

Read

Generate Random Images From Unsplash Without Using The API

June 24, 2018 by Andreas Wik

Unsplash is the place to go when you need royalty free photos and while they do have a great API for developers, they also give you the option to simply access random images via URL’s. Let’s take a look!

Read

Collect Daily And Historical Stock Prices

June 21, 2018 by Andreas Wik

With the free AlphaVantage API you can easily collect daily and historical stock prices and other stock data.

Read

Capture Touch Events With JavaScript

June 19, 2018 by Andreas Wik

Whatever brilliant little project it is you’re working on, this method below should have you covered capturing swipes and taps.

Read

Grab the Dominant Color Of Image with jQuery

November 11, 2017 by Andreas Wik

For a profile page template I was designing recently I needed a way to pick a color that would work well together with the user’s profile photo. Now, this can obviously not be done manually as users will upload their profile photo themselves, so this color needs to be generated dynamically.

Read

Create CSS iPhone Wrapper For Your Screenshots

November 11, 2017 by Andreas Wik

Need a way to present mobile device size screenshots of your app or website? Why not use a little HTML and CSS to create a simple but elegant iPhone wrapper around them.

Read

Dynamic jQuery Click Events Not Working In Mobile Safari

November 11, 2017 by Andreas Wik

I just ran into a really weird problem, appearing only in the Mobile Safari browser. I was testing a website on my iPad, and my jQuery click events did not work. What I was doing was dynamically adding elements to the page.

Read

Social Meta Tags Checklist

November 11, 2017 by Andreas Wik

Do you have the necessary social meta tags included on your site? Do you know how your content looks on different social platforms when somebody shares a URL to your website?

Read

Turn Headline Into URL Friendly Slug With PHP

November 11, 2017 by Andreas Wik

This is a short one. This little code snippet will turn a text into a URL friendly slug, similar to what Wordpress does.

Read

Make Sure Your Element Has The Highest Z-index

November 11, 2017 by Andreas Wik

Here is a simple way to get the highest z-index used on the page and assign a higher one to the element you need to ensure is “on top” of everything else.

Read

Cut Off Text Nicely With text-overflow

November 11, 2017 by Andreas Wik

I was working on this page that had a list of company summaries, where each item should be a single line. Needless to say, some longer summaries won’t fit on one line.

Read

Calculate How Long Ago With Timestamp And PHP

November 7, 2017 by Andreas Wik

You know how YouTube shows the date the video was published as “X hours ago”, “Y days ago” and “Z years ago” etc, rather than 2017-01-22 for example. This handy function time_ago takes a Unix timestamp and turns it into a how-long-ago string.

Read

Are You Using the_date() In WordPress? Don’t!

November 5, 2017 by Andreas Wik

Are you using the function the_date() when listing your posts in Wordpress? Well, don’t! It’s about time to change that.

Read

Fill Div With Vertically And Horizontally Centered Image Using CSS

September 17, 2017 by Andreas Wik

As web developers we work a lot with dynamic content, and this can be quite tricky from time to time. We can’t (shouldn’t) force people to crop images to exact sizes before uploading them on our sites. It’s important that we put effort into making our solutions as flexible as possible while still lookin’ good.

Read