This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby's inheritance mechanisms are a bit unique and have some subtelties | |
# There are two main ways to inherit: Direct Inheritance (with a "Base" class) and "Mixins" (including modules) | |
# "Direct inheritance" (B is the base class of A) | |
class B | |
X = 30 | |
def self.static_method | |
"Hello from static method" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('/', '_') |