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
@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 / 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 / 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
# /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 September 13, 2011 23:32 — forked from tenderlove/person_test.rb
Use minitest/spec with Rails 3
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 August 4, 2011 09:06 — forked from TomV/exception_mailer.rb
Simple Sinatra extension to catch exceptions and do some notifiyin (not working yet.)
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 August 3, 2011 13:01 — forked from ches/gist:718234
Very simple taggable behavior for Mongoid
# 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 08:43 — forked from jnunemaker/authentication.rb
a starting point for authentication with mongomapper and rails
# 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 09:25 — forked from ccollins/watchr.rb
watchr - cucumber, rspec
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')
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