Proudly introducing:

I’ve had my own company called WebGear since 2000. I’ve never bothered with getting my company “known” to the world, as I was full time employed with Web Power for over 10 years. Now that I am freelancer in web development, I did put some effort in the WebGear brand. I bought the domain […]

HTML5 Webapp too wide on iPad with iOS7?

I ran into a very nasty issue with iOS7 on an iPad today: My webapp would render way too wide, causing scrollbars, where it would fit perfectly on older iOS versions. Turns out that the culprit is in the meta-viewport tag. This is what I had: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"/> This is […]

Contrast and Brightness plugin for fabric.js

I’ve written a small plugin for the excellent fabric.js canvas library. Here’s the code you need, add it to your page after fabfic is loaded. fabric.Image.filters.BrightnessContrast = fabric.util.createClass(fabric.Image.filters.BaseFilter, { type: 'BrightnessContrast', initialize: function(options) { options || (options = { }); this.contrast = options.contrast || 0; this.brightness = options.brightness || 0; }, applyTo: function(canvasEl) { var […]

Apache “rewrite rule” for REST API

Here’s how you can configure your Apache webserver for a REST API, without using rewrite rules (thus: you don’t need the rewrite engine). Simply add the following line to your <VirtualHost>: AliasMatch ^/api/rest/v1/(.*)$ /var/www/[mywebsite]/htdocs/api/rest/v1/index.php In index.php, you can read the parameters like so: &lt;?php    $path = preg_replace('~^/rest/v1/~', '', $_SERVER['SCRIPT_NAME']);    $parts = explode('/', $path); […]

Javascript: Add URL parameter

Here’s a handy function for adding a new parameter to a URL: function addUrlParam(param, value) { var url = location.href; if ( != -1) return url; var hash = location.hash, sep = url.indexOf('?') == -1 ? '?' : '&amp;'; return url.replace(hash,'') + sep + encodeURIComponent(param) + (value ? '=' + encodeURIComponent(value) : '') + hash; […]