Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View koenpunt's full-sized avatar
:octocat:
...

Koen Punt koenpunt

:octocat:
...
View GitHub Profile
@koenpunt
koenpunt / alias.sh
Created April 8, 2014 14:43 — forked from fcoury/alias.sh
#
# zsh function to start Foreman based on whether or not
# you have multiple Procfiles
#
# we are adopting this schema of having environment
# specific Procfiles:
#
# config/development.proc
# config/stage.proc
# config/production.proc

Put this code on the page where the form you want to track resides. Some other examples are currently passed around the web with varying quality. This is one that will work as long as your form tag has an id= or name attribute.

You don´t have to change this code to be able to track form abandonment in your shopping cart, order form or whatever form you want.

This sends events to Google Analytics when a user focuses somewhere not in a field after having focused on a input field. You won´t know for how long users focused on respective fields, or the actual conversion rate in the form using this, but it might be a start.

A tool that provides more insight both over time and per field, is Form Analytics wich helps you optimize your online forms. For instance, it measures dropout rate, average field input length, conversion rate and average time per field. All which provides great insights in the most overlooked, yet important part of you site.

Anyway, here´s the code:

@koenpunt
koenpunt / UIImageView+imageDimensions.swift
Created September 3, 2015 14:44
UIImageView extension for calculated UIImageSize
//
// UIImageView+imageFrame.swift
// Tindex
//
// Created by Koen Punt on 24-08-15.
// Copyright (c) 2015 Koen Punt. All rights reserved.
//
import UIKit
@koenpunt
koenpunt / default-ssl
Created October 4, 2012 16:44
Using Nginx as SSL Proxy for Name Based VirtualHosts in Apache
server {
listen 443 ssl;
server_name ~^(www\.)?(?<domain>.+)$;
# It's possible to configure Nginx to serve static files directly, and
# bypassing Apache but I won't describe that here.
root /var/apps/$domain/current/public;
ssl_certificate /etc/ssl/certs/cmpgns/STAR_cmpgns_nl.crt;
ssl_certificate_key /etc/ssl/private/STAR_cmpgns_nl.key;
@koenpunt
koenpunt / basename.conf
Created October 29, 2012 16:38
Quick Server Setup
# Gets the basename of the original request
map $request_uri $request_basename {
~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename;
}
# Gets the basename of the current uri
map $uri $basename {
~/(?<captured_basename>[^/]*)$ $captured_basename;
}
@koenpunt
koenpunt / gist:3994501
Created November 1, 2012 15:51
iOS Media Queries
<!-- IPAD 3 -->
<link rel="stylesheet" href="/stylesheets/ipad3.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-min-device-pixel-ratio:1.5)" />
<!-- IPAD 2 -->
<link rel="stylesheet" href="/stylesheets/ipad2.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-max-device-pixel-ratio:1.5)" />
<!-- IPAD -->
<link rel="stylesheet" href="/stylesheets/ipad.css" type="text/css"
media="only screen and (min-device-width:768px) and (max-device-width:1024px)" />
<!-- IPHONE 4 -->
@koenpunt
koenpunt / setup-mailcatcher-upstart.md
Last active November 3, 2015 13:41
Setup MailCatcher with rbenv and upstart

Setup MailCatcher with upstart

Clone the mailcatcher repo to a directory, here I use ~/.mailcatcher.

git clone https://github.com/sj26/mailcatcher.git ~/.mailcatcher

Navigate to the directory and setup the dependencies:

@koenpunt
koenpunt / sass-mixins-to-css.md
Last active December 2, 2015 22:54
Sass mixins to plain CSS

Some regular expressions to replace mixins for plain CSS

# search
@include (transition|transform|opacity|backface-visibility|box-sizing|box-shadow|user-select|background(?:-image)?)\((.*)\)
# replace
$1: $2

# search
@include (translate3d|rotate|translateX|translateY)\((.*)\)

replace

@koenpunt
koenpunt / deploy.rb
Last active December 11, 2015 16:48
Capistrano recipe for foreman in production
set :user, "deploy"
set :runner, "deploy"
set :application, "example.com"
set :deploy_to, "/var/apps/#{application}"
set :shared_children, %w(sockets)
set :scm, :git
set :repository, "git@github.com:example.git"
set :deploy_via, :remote_cache