Sat Oct 28
#
For example, if you wanted to link your README, you would write the following:
Tip Internal rdoc links with custom label
If you want to link to another part of your rdoc, you can use the following notation:
label[link:path/to/rdoc/file.html]
For example, if you wanted to link your README, you would write the following:
Find full details in the
README[link:files/README.html].
Fri Oct 27
#
“ Erlang is simpler than Ruby, and that’s why ErlyWeb is naturally simpler than Rails. ”
Yariv Sadan on ErlyWeb
Wed Oct 25
#
#caboose
12:43 < Defiler> Amazon just recommended "Paradigms of Artificial Intelligence Programming" and "Metallica - Kill `Em All'" to me.
Tue Oct 24
#
Tip Asian Flush Workaround
If you are one of the lucky asians who suffer from the asian glow (red face) after drinking sometimes as little as 1/5th of a glass of wine, try taking a pepcid ac shortly beforehand. It reduces the flush significantly and stops all out of control heart palpitations.
Mon Oct 23
#
“ A champ always fights themself. And you are a fighter. ”
Bill Callahan in Feather by Feather
Thu Oct 19
Tue Oct 17
#
37signals
Jason F. - wow. 5 minutes ago I'm like "wow, cool! it's foggy out" and now I'm like "fuck, there's a car on fire right down the street."
#
“ The Bears are who we thought they were. ”
Dennis Green
Mon Oct 16
#
“ Like its author, Nmap isn’t perfect. ”
BUGS section of the nmap man page
Sun Oct 15
#
Implicit writer invocation in block assignment
class Foo attr_writer :bar end f = Foo.new %w(one two three).each do |f.bar| p f end #<Foo:0x4369c @bar="one"> #<Foo:0x4369c @bar="two"> #<Foo:0x4369c @bar="three">
Fri Oct 13
#
37signals
Ryan S. - mangos are slippery when peeling
Ryan S. - peeling a mango makes me feel like i'm about to do slapstick comedy
#
Tip Peel over a paper towel
When peeling fruits or vegetables, lay out a paper towel to catch the shavings. When finished peeling you just ball up the paper towel and throw it away.
Mon Oct 9
#
Expireable memoization
class Object def memoize(reload = false, storage = nil) storage = "@#{storage || __method__(1)}" if reload instance_variable_set(storage, nil) else if cache = instance_variable_get(storage) return cache end end instance_variable_set(storage, yield) end end module Kernel def __method__(depth = 0) caller[depth][/`([^']+)'/, 1] end end if RUBY_VERSION < '1.9' class WebPage def source(reload = false) memoize(reload) do # Download page end end end
Sun Oct 8
#
Naive String#previous
class String def previous dup.previous! end def previous! self[-1] = self[-1] - 1 self end end
Fri Oct 6
#
37signals
Jamis B. - [OUT] found keys to world peace, cold fusion, curing cancer, and one killer recipe for kimchi, but forgot to put them under source code control and promptly lost them in a freak accident involving egg nog and corn chips. Sorry, guys.
Thu Oct 5
Wed Oct 4
#
A coercible string
class CoercibleString < String class << self def coerce(string) new(string).coerce end end def coerce attempt = nil while coercions.next? attempt = coercions.next break if !attempt.nil? end attempt.nil? ? self : attempt end private def coercions @coercions ||= Generator.new do |@generator| try { self == 'true' } try { [self == 'false', false] } try { Integer(self) } try { [Date.parse(self), Time.parse(self)] } end end def try attempt, desired = yield if attempt @generator.yield(desired.nil? ? attempt : desired) end rescue ArgumentError @generator.yield nil end end CoercibleString.coerce('25') # => 25 CoercibleString.coerce('9/1/81') # => Tue Sep 01 00:00:00 CDT 1981 CoercibleString.coerce('false') # => false CoercibleString.coerce('Hello!') # => "Hello!"
#
“ When your skillet is really really hot, drop the meat into it. Once it hits, it’s going to sizzle an awful lot. You’ll be scared. You’ll want to move the meat around. Don’t touch it. ”
Chris McAvoy on How to Cook a Steak
Tue Oct 3
#
Tab completion in vim
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
#
37signals
Ryan S. - some of the lightning last night was amazing
Ryan S. - some of the peals of thunder were _long_
Ryan S. - like ripping fabric