Skip to content

Instantly share code, notes, and snippets.

View jesperronn's full-sized avatar

Jesper Rønn-Jensen jesperronn

View GitHub Profile
@jesperronn
jesperronn / osx_files_for_new_laptop
Created February 3, 2009 10:44
filelist for script to download and install essential sw on a new laptop
#list of the files I want to instal on my server
# requires previous install of XCode
# from http://developer.apple.com/technology/xcode.html
#recent ruby
ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
#recent git
http://kernel.org/pub/software/scm/git/git-1.6.1.2.tar.gz
#and manpages
@jesperronn
jesperronn / config.xml
Created July 10, 2009 07:49
.hudson/jobs/ExpensereportAllFeatures/config.xml
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<logRotator>
<daysToKeep>5</daysToKeep>
<numToKeep>-1</numToKeep>
</logRotator>
<keepDependencies>false</keepDependencies>
<properties>
# cat ~/.autotest
require 'autotest_notification'
require 'autotest/fsevent'
require 'autotest/growl'
Autotest.add_hook :initialize do |autotest|
%w{.git .svn .hg .DS_Store ._* vendor}.each {|exception| autotest.add_exception(exception) }
false
end
@jesperronn
jesperronn / expense_type.rb
Created September 1, 2009 12:34
grouped_select for Rails 2.3 to simplify using optgroups
class ExpenseType < ActiveRecord::Base
validates_uniqueness_of :name
#returns grouped options split in 'popular' and 'all'
def self.groups
all_types = self.all.map{|t| [t.name, t.id]}
[
['popular', all_types[0..2]],
['all', all_types]
]
### lib/form_options_helper.rb
require 'action_view/helpers/form_helper'
module ActionView
module Helpers
module FormOptionsHelper
##
def grouped_select(object, method, choices, options = {}, html_options = {})
InstanceTag.new(object, method, self, options.delete(:object)).to_grouped_select_tag(choices, options, html_options)
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da" lang="da">
<head>
<title>jquery find all a elements and append to URLs only</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery.ba-url.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
/* Merge an arbitrary query string into all page links.
@jesperronn
jesperronn / capinternal_systems_login_nordic_apps.user.js
Created September 23, 2009 10:27
Nordic capgemini applications: Bypass the annoying redirect not happening on Firefox because of HTML in HEAD element
// ==UserScript==
// @name cap nordic internal systems Firefox Login error
// @namespace http://userscripts.org/users/103819
// @description Bypass the annoying redirect not happening on Firefox because of HTML in HEAD element
// @include http://applications.capgemini.se/applications/employee/employee.cfm
// @include http://applications.capgemini.se/applications/skills/skills.cfm
// @include http://applications.capgemini.se/applications/Staffing/staffing.cfm
// @include http://applications.capgemini.se/applications/common/common.cfm
// @include http://applications.capgemini.se/Applications/ADManager/ADManager.cfm
// @include http://applications.capgemini.se/Applications/Approve/Approve.cfm
#!/usr/bin/env ruby
# THis script looks for orphan image files in a GIT project
# For now, it looks for usages in the current source files via git grep
#
# usage:
# unused [foldername]
# unused ../images
require 'fileutils'
#!/usr/bin/env ruby
# Script that wraps grabbing and selecting stuff from HTML page via CSS selectors
# Created 2009-10-01 by Jesper Rønn-Jensen, www.justaddwater.dk
#
# For usage, run parsepage.rb without arguments.
#
# Feel free to modify, fork and improve as long as you commit your changes back to me :)
def usage
<<-EOF #.gsub(' ', '')
=== USAGE ===