Joined November 2012
·

Michael Fellinger

Digitally Imported
Digitally Imported
·
Germany
·
·
·

#empty? only works on String though, something more general but slightly more expensive is this:

a = [1, "foo", nil, :bar]
a.reject!{|e| e.nil? || e.to_s.empty? }
p a # => [1, "foo", :bar]
Posted to Read command output into vim over 1 year ago

That is :r! ls -l :)
Also as shebang, please use #!/usr/bin/env python, to make life easier for everybody.

Posted to Wishing you a multilingual Christmas over 1 year ago

Go:

package main

func main() {
  christmas := "beer "
  newYear := "more beer"
  if christmas+newYear == "beer more beer" {
    println("festive hangover")
  }
}

Tcl:

set christmas "beer "
set newYear "more beer"
if {"$christmas$newYear" == "beer more beer"} {
  puts "festive hangover"
}

(oh, also, please don't use === for equality in Ruby, it works in this case, but String === "beer more beer" would also be true. So can you change it to == instead? Pretty please :)

Posted to Hidden LOTR Calendar in Linux over 1 year ago

Thanks, looks like the equivalent package on Archlinux is https://aur.archlinux.org/packages.php?ID=48567

Ruby version: ruby -rjson -e 'puts JSON.pretty_generate(JSON.load($<))'

Posted to Hidden LOTR Calendar in Linux over 1 year ago

What distribution and package is that in? The only calendar i have is from plan9port and it doesn't have any such file.

Posted to Debugging BASH scripts over 1 year ago

I usually go with set -x. But this seems like a good addition to my toolbox, even works in zsh. Thanks :)

Use ruby -e to quickly resolve any Ruby argument, or read the souce :)

That should be :!git init etc.

Achievements
132 Karma
492 Total ProTip Views