Skip to content

Instantly share code, notes, and snippets.

View soma's full-sized avatar

Albert Ramstedt soma

View GitHub Profile
# Usage: (this omits ajax requests, and only applies to non-get forms)
# $("form:not([data-remote]:not([method=get])").preventDoubleSubmit()
# http://thepugautomatic.com/2008/07/jquery-double-submission/
$ = jQuery
$.fn.preventDoubleSubmit = ->
ESC_KEYCODE = 27
$forms = $(this)
require 'tempfile'
require 'java' if defined?(JRUBY_VERSION)
require 'test/unit'
require 'fileutils'
class FileOpener
def initialize(tmp)
@soma
soma / vi-away.rb
Created January 13, 2009 00:10 — forked from qtrfeast/vi-away.rb
require 'set'
all = Set.new
`which -a vi`.each_line {|line| all << line.strip }
`which -a vim`.each_line {|line| all << line.strip }
emacs = `which emacs`.strip
all.each do |vi|
puts "Please enter your password when prompted; we are fixing things"
`sudo rm #{vi}`
`sudo ln -s #{emacs} #{vi}`
end