Skip to content

Instantly share code, notes, and snippets.

@cprice404
Created October 3, 2012 23:18
Show Gist options
  • Save cprice404/3830511 to your computer and use it in GitHub Desktop.
Save cprice404/3830511 to your computer and use it in GitHub Desktop.
awesome set magic
1.8.7 :004 > def testfoo(ports)
1.8.7 :005?> val1 = Zlib.crc32(Set.new(ports).inspect)
1.8.7 :006?> val2 = Zlib.crc32(Set.new(Set.new(ports)).inspect)
1.8.7 :007?> puts "val1 '#{val1}'"
1.8.7 :008?> puts "val2 '#{val2}'"
1.8.7 :009?> end
=> nil
1.8.7 :010 > testfoo([22,8080])
val1 '3915886963'
val2 '3915886963'
=> nil
1.8.7 :011 > testfoo([22,8140])
val1 '2614511658'
val2 '2664507259'
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment