Sha256: b74c2f29dbbf020f6675b3e968a56cacf05dfb31ab0e0f8079a660a0b9cc2dac

Contents?: true

Size: 546 Bytes

Versions: 28

Compression:

Stored size: 546 Bytes

Contents

#!/usr/bin/env ruby

require 'open-uri'

require 'main'
require 'digest/sha2'

# you have access to a sequel/amalgalite/sqlite db for free
#

Main {
  name :i_can_haz_db

  db {
    create_table(:mp3s) do
      primary_key :id
      String :url
      String :sha
    end unless table_exists?(:mp3s)
  }

  def run
    url = 'http://s3.amazonaws.com/drawohara.com.mp3/ween-voodoo_lady.mp3'
    mp3 = open(url){|fd| fd.read}
    sha = Digest::SHA2.hexdigest(mp3)

    db[:mp3s].insert(:url => url, :sha => sha)
    p db[:mp3s].all
    p db
  end
}

Version data entries

28 entries across 27 versions & 2 rubygems

Version Path
main-6.3.0 samples/j.rb
main-6.2.3 samples/j.rb
main-6.2.2 samples/j.rb
main-6.2.1 samples/j.rb
main-6.2.0 samples/j.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/j.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/j.rb
main-6.1.0 samples/j.rb
main-6.0.0 samples/j.rb
main-5.3.2 samples/j.rb
main-5.3.1 samples/j.rb
main-5.2.0 samples/j.rb
main-5.1.1 samples/j.rb
main-5.1.0 samples/j.rb
main-5.0.1 samples/j.rb
main-5.0.0 samples/j.rb
main-4.8.1 samples/j.rb
main-4.8.0 samples/j.rb
main-4.7.7 samples/j.rb
main-4.7.6 samples/j.rb