Skip to content

Instantly share code, notes, and snippets.

View jens's full-sized avatar

Jens Norrgrann jens

View GitHub Profile
@jens
jens / brainwash
Last active August 29, 2015 14:07 — forked from halo/brainwash
#!/usr/bin/env ruby
require 'ipaddr'
module Brainwash
module Help
extend self
def examples
<<-END
@jens
jens / forego.rb
Created November 27, 2013 10:27 — forked from guitsaru/forego.rb
require 'formula'
class Forego < ScriptFileFormula
homepage 'https://github.com/ddollar/forego'
url 'https://godist.herokuapp.com/projects/ddollar/forego/releases/0.8.2/darwin-amd64/forego'
sha1 '62f4c0cb7e48647ca7c9ef4a801f49576b577d4a'
version '0.8.2'
test do
system "#{bin}/forego", "version"
@jens
jens / attached_file.rb
Created May 17, 2011 21:27 — forked from mrmemes-eth/attached_file.rb
Duplicate items when using update_attributes and decent_exposure
class AttachedFile < ActiveRecord::Base
belongs_to :parent, :polymorphic => true
end
current_path = File.expand_path(File.dirname(__FILE__))
require File.join(current_path.split("/").collect {|p| current_path.split("/" + p).first + "/" + p}.reverse.detect {|p| File.exist?(p + "/spec_helper.rb")}, 'spec_helper')
root = '/Users/henrik/Sites/auktion/spec/models/auction'
max = root.scan('/').length + 1
x = max.times { |i|
path = "#{root}/#{'../'*i}spec_helper.rb"
unless (found = Dir[path]).empty?
break(File.expand_path(found.first))
end
}
p x