Skip to content

Instantly share code, notes, and snippets.

View TwP's full-sized avatar
🛰️
Spacing Out

Tim Pease TwP

🛰️
Spacing Out
View GitHub Profile
# LAME
if a > b
foo = a
else
foo = b
end
# SWEET
foo = if a > b
a
Config.new {
_'the description of the next variable'
foo 42
_'the description of bar'
bar {
_'the description of baz'
baz 3.14159
}
}
module WikiTrail
def wiki_trail( *args )
links = args.flatten.map do |name|
"> #{link_to_page_unless_current name} <"
end
links.join(" ")
end
end
class Webby::Resources::Page < Webby::Resources::Resource
alias :_initialize :initialize
def initialize( fn, meta_data = nil )
_initialize(fn, meta_data)
# put your initialization code here
end
end
class Logging::Appenders::TimestampRollingFile < Logging::Appenders::RollingFile
def initialize( name, opts = {} )
super
@date_fmt = '%Y%m%d'
@logname_fmt.sub!(%r/\.%d/, '.%s')
end
def roll_files
---
filter:
- textile
- outline
---
<toc />
h1. Foo
h2. Bar
class Module
# call-seq:
# logger_name #=> string
#
# Returns a predictable logger name for the current module or class. If
# used within an anonymous class, the first non-anonymous class name will
# be used as the logger name. If used within a meta-class, the name of the
# actual class will be used as the logger name. If used within an
# anonymous module, the string 'anonymous' will be returned.