Skip to content

Instantly share code, notes, and snippets.

View gist:33cc97dafc4ef42c7199249ef67b5a98
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"
View gist:1b1c42ca33b199d08a4e44563010c51c
def leaseweb_secure_url
cname = 'your.cdn.name'
path = path_to_file
secret = 'YourSecret'
expire = (Time.now.to_i + 86400).to_s
ip = ''
secure_url = secret + ip + path + expire
secure_url_md5 = Digest::MD5.digest(secure_url)
secure_url_base64 = Base64.strict_encode64(secure_url_md5)
secure_url_base64 = secure_url_base64.gsub('+', '-').gsub('/', '_')
You can’t perform that action at this time.