(1..10).each do |x|
...

Ruby Chained comparisons in Ruby

by Magnus Holm, May 03, 2010 18:23, 2 refactorings

Tried to port some Perl cod...

B397b498cc02503a2d86c86176f7fd3e Talk
def get_token
  self.class.precedence.each { |token| return send(token) || next }
  error('syntax error')
...

Ruby On lexer

by Magnus Holm, November 16, 2009 22:13 Star_fullStar_fullStar_full
B397b498cc02503a2d86c86176f7fd3e Talk
# Takes two arguments: filename and seconds to shift
# `ruby srt.rb quantum_of_solace.srt 10.67 > better_quantum_of_solace.srt`
require 'time'
...

Ruby On very simple .srt resyncroniser

by Magnus Holm, December 22, 2008 01:19 Star_fullStar_fullStar_fullStar_fullStar_full

Well, at least I got rid of...

B397b498cc02503a2d86c86176f7fd3e Talk
module                    Morse

 A,B,C=proc{M.tr(' ','').gsub(/#{$/}+/,$/).split($/).map{|x|
...

Ruby On Morse Code Encoder/Decoder

by Magnus Holm, October 19, 2008 18:28 Star_fullStar_fullStar_fullStar_full

lel: You're absolutely righ...

B397b498cc02503a2d86c86176f7fd3e Talk
module Morse;A=[19,189,192,63,6,165,66,162,18,175,64,171,22,21,67,174,199,57,
54,7,55,163,58,190,193,198];B=proc{|c|A[c-65].to_s(3)[1..-1].tr('10','-.')}
C=proc{|m|(A.index(("2"+m.tr('-.','10')).to_i(3))||return)+65}
...

Ruby On Morse Code Encoder/Decoder

by Magnus Holm, October 01, 2008 12:49 Star_fullStar_fullStar_fullStar_full
B397b498cc02503a2d86c86176f7fd3e Talk