frontcoded.com
A dumping ground for web development stuff
Use NGINX as HTTP proxy to test pages on your VM
This guide is for OSX machines Install Homebrew http://brew.sh/ Install NGINX with homebrew: brew install nginx Open /usr/local/etc/nginx/nginx.conf with your favourite editor and add the server configuration: server { listen 80; # don´t use *.local on mac - its reserved server_name www.mywebsite.mobile; location / { proxy_pass http://www.mywebsite.dev/; } } Start...
Track Events in Google Analytics using the Measurement REST API
Google provides a nifty method to track events in your web application. They are referring to this API as the Measurement Protocol. The big advantage with this low-level protocol compared to the traditional web tracking with analytics.js is, that you have to power of full control what is going to...
Angular: Cancel a running $http request
In a perfect world without any network latencies and processing time an ajax-request would be instant. Unfortunately we don´t live in such a world... but I´m sure you knew that already :) Every time we have to make requests to our backend, we have to think about how long this...
JavaScript: Split an array into chunks of a given size
Here is a super simple snippet to create a grouped version of an array. I use this sometimes to prepare data for my views that needs a grouped representation. var createGroupedArray = function(arr, chunkSize) { var groups = [], i; for (i = 0; i < arr.length; i += chunkSize)...
Git: Export new and changed files from commits into a tar archive
I still have projects, where i need to push my changed local files manually to an FTP-Server. Often these changes on different files are big enough and so widely spread, that I lose track which files I have changed since the last update. In order to avoid updating ALL remote...