Skip to content

Instantly share code, notes, and snippets.

%html
%head
%body
.canvas-container
%svg.canvas{width: '100%', height: '86.5%', viewbox: '0 0 100 100', preserveAspectRatio: 'midxMidY slice', xmlns: "http://www.w3.org/2000/svg"}
@benjamin-hull
benjamin-hull / range_overlap.rb
Created August 1, 2019 12:51
Grouping overlapping ranges
# A dumb helper to check the overlap. You can use Rails' built-in 'overlaps?' if you like
def range_overlap?(r1, r2)
r1.cover?(r2.first) || r2.cover?(r1.first)
end
# Times are expressed here as a number of minutes since midnight, which is just
# a way of ignoring the date part of a dateTime
times = [(600..660), (630..690), (690..705), (840..900)]
# First, create an array of the outer edges of each group, expressed as ranges
@benjamin-hull
benjamin-hull / index.html
Last active March 28, 2018 04:44
Square cropping for instafeed.js
<h1>Square cropping images</h1>
<p> 2 techniques, useful with <a href="https://github.com/stevenschobert/instafeed.js">Instafeed.js</a>, amongst other things.</p>
<div class="image-boxes">
<div class="image-box">
<img src="https://instagram.fmel2-1.fna.fbcdn.net/vp/69d4df6c6e8d6bd852d44ca5e6363d57/5B3986B1/t51.2885-15/e35/25036465_1210383369106751_8835892581469519872_n.jpg"/>
<span class="caption">Standard Landscape image</span>
</div>
<div class="pdpLongDescriptionSeq">
<div class="pdpLongDescription" id="pdpLongDescription">
<div class="displayBox">
<h3>Details</h3>
<p>These black classic round toe court are right on the style scene with visible platform and counter stud detail.</p>
</div>
</div>
<div class="pdpLongDescription" id="pdpLongDescription_005170360" style="display:none">
<div class="displayBox">
<!-- Using raw static navigation -->
<ul id="eCommerceNavBarMenu">
<li class="topLevel navfirstitem">
<a class="topLevel" href="&#47;online&#47;shop&#47;new-in">
New In
</a>
<!-- Using static navigation -->
<ul id="eCommerceNavBarMenu">
<li class="topLevel navfirstitem"><a class="topLevel" href="/online/shop/new-in">New
In</a></li>
<li class="topLevel">
<a class="topLevel" href="/online/shop/shoes">Shoes</a>
<div class="ecommerceMegaMenu Shoes c4">
<!-- floated parents need a width (total of children) -->
Twin Twin XL Full Full XL Queen King Cal King
var SKUdata = {
savingsConfig: {
minSavingAmountToDisplay: 10,
minSavingPercentageToDisplay: 10
},
attributes: ['Size','Foundation'],
skus: {
68858: {
var SKUdata = {
savingsConfig: {
minSavingAmountToDisplay: 10,
minSavingPercentageToDisplay: 10
},
attributes: ['Size','Foundation'],
skus: {
70191: {
'Size': 'Twin',