Skip to content

Instantly share code, notes, and snippets.

View lstoldt's full-sized avatar

Lelon lstoldt

  • Google
  • Los Angeles, CA
View GitHub Profile
@lstoldt
lstoldt / output
Created October 11, 2011 20:33
JRuby Error
$ jruby -S test.rb
one
sentence
two
a very l
ong sentence three
@lstoldt
lstoldt / test.rb
Created October 11, 2011 17:46
JRuby Error
message = "something%sh: gimme: not found\r\n"
message = message.split('%')[1]
message.lines do |line|
puts line
# puts line.strip # also fails
end
see: https://jira.codehaus.org/browse/JRUBY-6116
RubyString.java:5688:in `singleByteStrip19': java.lang.ArrayIndexOutOfBoundsExce
ption: 51
from RubyString.java:5660:in `strip_bang19'
from RubyString.java:5649:in `strip19'
from RubyString$i$0$0$strip19.gen:65535:in `call'
from CachingCallSite.java:133:in `call'
from CallNoArgNode.java:63:in `interpret'
from NewlineNode.java:104:in `interpret'
def log(level, message, line_prefix=nil)
if level <= self.level
indent = "%*s" % [MAX_LEVEL, "*" * (MAX_LEVEL - level)]
(RUBY_VERSION >= "1.9" ? message.lines : message).each do |line|
if line_prefix
device.puts "#{indent} [#{line_prefix}] #{line.strip}\n"
else
device.puts "#{indent} #{line.strip}\n"
end
end
@lstoldt
lstoldt / gist:1245825
Created September 27, 2011 18:21
Glassfish Log
--- RubyGems
Gem.dir: /usr/local/rvm/gems/jruby-1.6.4
Gem.path:
/home/glfish/glassfishv3/glassfish/domains/domain1/applications/my-app/WEB-INF/gems
/usr/local/rvm/gems/jruby-1.6.4
/usr/local/rvm/gems/jruby-1.6.4@global
Activated gems:
bundler-1.0.18
--- Bundler
@lstoldt
lstoldt / macro.vbs
Created September 10, 2011 01:03
Excel Macro
'To get this to work you need to add the regexp reference.
'From Visual Basic: Tools -> References... make sure "Microsoft VBScript Regular Expressions 5.5" is checked
Sub breakUpMultiYearRows()
'doesn't work on mac
Dim r As New VBScript_RegExp_55.RegExp
r.Pattern = "(\d{4})\s*-\s*(\d{4})"
Dim Matches, Match
Dim originalSelection As Range
@lstoldt
lstoldt / gist:675758
Created November 13, 2010 23:54
Getting Autotest colors to work on Windows