Skip to content

Instantly share code, notes, and snippets.


Ben benjamin-hull

View GitHub Profile
View index.haml
%svg.canvas{width: '100%', height: '86.5%', viewbox: '0 0 100 100', preserveAspectRatio: 'midxMidY slice', xmlns: ""}
benjamin-hull / range_overlap.rb
Created Aug 1, 2019
Grouping overlapping ranges
View range_overlap.rb
# 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)
# 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 / index.html
Last active Mar 28, 2018
Square cropping for instafeed.js
View index.html
<h1>Square cropping images</h1>
<p> 2 techniques, useful with <a href="">Instafeed.js</a>, amongst other things.</p>
<div class="image-boxes">
<div class="image-box">
<img src=""/>
<span class="caption">Standard Landscape image</span>
View gist:3991085
<div class="pdpLongDescriptionSeq">
<div class="pdpLongDescription" id="pdpLongDescription">
<div class="displayBox">
<p>These black classic round toe court are right on the style scene with visible platform and counter stud detail.</p>
<div class="pdpLongDescription" id="pdpLongDescription_005170360" style="display:none">
<div class="displayBox">
View gist:3983383
<!-- Using raw static navigation -->
<ul id="eCommerceNavBarMenu">
<li class="topLevel navfirstitem">
<a class="topLevel" href="&#47;online&#47;shop&#47;new-in">
New In
View gist:3983268
<!-- Using static navigation -->
<ul id="eCommerceNavBarMenu">
<li class="topLevel navfirstitem"><a class="topLevel" href="/online/shop/new-in">New
<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) -->
View gist:3838528
Twin Twin XL Full Full XL Queen King Cal King
var SKUdata = {
savingsConfig: {
minSavingAmountToDisplay: 10,
minSavingPercentageToDisplay: 10
attributes: ['Size','Foundation'],
skus: {
68858: {
View gist:3838268
var SKUdata = {
savingsConfig: {
minSavingAmountToDisplay: 10,
minSavingPercentageToDisplay: 10
attributes: ['Size','Foundation'],
skus: {
70191: {
'Size': 'Twin',