Skip to content

Instantly share code, notes, and snippets.

writing status

Jonas Arnklint arnklint

writing status
View GitHub Profile
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 /
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 / madeofcode.vim
Created Jan 29, 2012 — forked from joshmvandercom/madeofcode.vim
Port of Made of Code Theme to VIM
View madeofcode.vim
" Port of my favorite theme Made of Code by Mark Dodwell
" For Textmate Theme visit -
" Vim color file
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
arnklint / deploy.rb
Created Dec 30, 2011 — forked from mrrooijen/deploy.rb
Capistrano with Foreman Capfile
View deploy.rb
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, ""
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"
arnklint / person_test.rb
Created Sep 13, 2011 — forked from tenderlove/person_test.rb
Use minitest/spec with Rails 3
View person_test.rb
require 'test_helper'
require 'minitest/autorun'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
arnklint / exception_mailer.rb
Created Aug 4, 2011 — forked from TomV/exception_mailer.rb
Simple Sinatra extension to catch exceptions and do some notifiyin (not working yet.)
View exception_mailer.rb
require 'sinatra/base'
module Sinatra
# module to catch Sinatra errors and send a email
module ExceptionMailer
def initialize(app)
@app = app
# set parameters here..
yield self if block_given?
arnklint / gist:1122573
Created Aug 3, 2011 — forked from ches/gist:718234
Very simple taggable behavior for Mongoid
View gist:1122573
# Basic tagging system for mongoid documents.
# jpemberthy 2010
# class User
# include Mongoid::Document
# include Mongoid::Document::Taggable
# end
# @user = => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
arnklint / authentication.rb
Created May 24, 2011 — forked from jnunemaker/authentication.rb
a starting point for authentication with mongomapper and rails
View authentication.rb
# include this in application controller
module Authentication
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
# Returns true or false if the user is signed in.
arnklint / watchr.rb
Created May 23, 2011 — forked from ccollins/watchr.rb
watchr - cucumber, rspec
View watchr.rb
require 'growl'
require 'open3'
ENV["WATCHR"] = "1"
$spec_cmd = "env RSPEC_COLOR=true spec --drb --colour --format nested"
$cuke_cmd = "cucumber --color --drb --require features/step_definitions --require features/support"
$pass = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pass.png')
$fail = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'fail.png')
$pending = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pending.png')