Skip to content

Instantly share code, notes, and snippets.

//
// Covet.pics Widget - Javascript Events
//
//
// Events
//
//
// galleryReady - when gallery loads
@thatdom
thatdom / covet-events.js
Last active October 23, 2019 11:45
Covet.pics JS Events
//
// Covet.pics JS Events
//
//
// Demo: https://annabelle-demo2.myshopify.com/pages/covetboots (open browser console and browse through the gallery, you should see events loging in console)
//
//
//
//
// Assuming your Gallery Embed code is:
require 'net/https'
uri = URI.parse("https://www.somesite.com")
http = Net::HTTP.new(uri.host,uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |h|
@cert = h.peer_cert
end
puts <<EOD
Subject: #{@cert.subject}
function asset_url(src, size) {
var index_start = src.search(/[^/]*(?=\.[^.]+($|\?))/);
if (index_start > -1) {
var file_name = src.match(/[^/]*(?=\.[^.]+($|\?))/)[0];
var index = index_start + file_name.length;
return src.substring(0, index) + "_" + size + src.substring(index, src.length);
} else {
return "";
}
}
@thatdom
thatdom / README.md
Created October 8, 2013 18:20
Rails multiple databases support

Commands examples

If the namespace is not used then the commands will perform on top of the default database. bundle exec rake db:create bundle exec rake db:migrate

By using the namespace we are going to use all the configuration for our alternate DB. bundle exec rake store:db:create bundle exec rake store:db:migrate