Skip to content

Instantly share code, notes, and snippets.

= Ruby Packaging Standard
The aim of this document is two-fold. First, to specify a common
structure of how a Ruby package distributed as source (that is, but
not limited to, development directories, version-controlled
repositories, .tar.gz, Gems, ...) should conform to.
Second, to document common and proven ways to structure Ruby packages,
and to point out certain anti-patterns that sneaked into common use.
It is by intent not to innovate.
require 'nokogiri'
src = <<-XML
<office:text
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
<text:p>one <text:span>span</text:span></text:p>
<text:p>two</text:p>
</office:text>
XML
@DanielHeath
DanielHeath / Gemfile
Created September 30, 2011 06:44
Gemfile
source 'http://gems.devint.lpo' # internal gem server
source "http://rubygems.org/"
gem 'rails', '~> 2.3.14'
gem 'rake'
gem 'rdoc'
gem 'pg'
gem "rest-client", :require => 'restclient'
gem "mime-types", :require => "mime/types"
gem "dim-ruby-net-ldap", "~> 0.1.1", :require => "net/ldap"
@DanielHeath
DanielHeath / babushka.log
Created December 5, 2011 00:12
Failure to recognise git on fresh lion install
babushka {
 (defining babushka against Babushka::Dep::BaseTemplate)
$ uname -s
Darwin
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.7.2
BuildVersion: 11C74
setup not defined.
@DanielHeath
DanielHeath / when.rb
Created December 5, 2011 22:57 — forked from avdi/when.rb
Experimenting with Object#when in Ruby
def maybe_a_sandwich
nil
end
# Methods that might return nil are annoying. We want to write a nice
# confident chain:
result = nil
result = maybe_a_sandwich.add_horseradish.get_into_my_belly! rescue $!
result # => #<NoMethodError: undefined method `add_horseradish' for nil:NilClass>
@DanielHeath
DanielHeath / Gemfile
Created March 19, 2012 06:16
Chromedriver / webdriver
source "http://rubygems.org/"
gem 'selenium-webdriver'
@DanielHeath
DanielHeath / gist:3704325
Created September 12, 2012 04:41
Standing desk parts
Lack side table ($10)
Antonius shelf ($12)
Ekby bracket ($2.50 * 2)
@DanielHeath
DanielHeath / Gemfile
Last active December 18, 2015 08:19
Getting rspec always returning 0 exit code with this gemfile.lock
source 'https://rubygems.org'
gem 'rake'
gem 'pry'
gem 'rspec'
gem 'capybara'
gem 'selenium-webdriver'
gem 'json'
gem 'sauce', :git => "git://github.com/sauce-labs/sauce_ruby.git"
gem 'active_support'
@DanielHeath
DanielHeath / st3 config.json
Created November 29, 2013 00:02
ST3 config
{
"ensure_newline_at_eof_on_save": true,
"font_size": 22,
"ignored_packages":
[
"CoffeeCompile",
"Vintage"
],
"remember_open_files": false,
"tab_size": 2,
package memoize
import (
"fmt"
"reflect"
)
// fptr is a pointer to a function variable which will receive a
// memoized wrapper around function impl. Impl must have 1 or more
// arguments, all of which must be usable as map keys; and it must