Skip to content

Instantly share code, notes, and snippets.

def signed_url(url, filename = nil)
   passphrase_secret = 'passphrase_secret'
   delay = 120
   timeout = (Time.now.to_i + delay)
   file_path = URI::parse(url).path

   download_params = "filename=#{URI::encode(filename)}&disposition=attachment&" if filename
   params = "#{file_path}?#{download_params}ttl=#{timeout.to_s}"

signature = Digest::MD5.hexdigest("#{params}&passphrase=#{passphrase_secret}")

require 'mp3info'
# some test data, replace it with your own data
title = "After Dark #388: After Back to Work"
subtitle = "Merlin & Dan talk after Back to Work episode 104."
artist = "Dan Benjamin on 5by5.tv"
album = "After Dark"
genre = "Podcast"
track = 338
year = 2013

#Rails for designers

##Creating a Rails project With the command line, navigate to where you want the project folder to be generated (e.g. documents/my_rails_projects/) and type the following to create a project called project_name:

rails new project_name

Navigate to that folder and type the following to create a controller called posts:

rails g controller posts