Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
writing status

Jonas Arnklint arnklint

😀
writing status
View GitHub Profile
@arnklint
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 - 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 / 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, "git@codeplane.com:meskyanichi/myapp.git"
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"
@arnklint
arnklint / nginx
Created Dec 29, 2011
NGinX startup script
View nginx
#! /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
View fortnox
# /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 / 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')
end
@arnklint
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?
end
@arnklint
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 = User.new(:name => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
@arnklint
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
protected
# 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
end
# Returns true or false if the user is signed in.
@arnklint
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')
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')
end