Skip to content

Instantly share code, notes, and snippets.

/* Original is in LESS and can be found here: https://gist.github.com/gefangenimnetz/3ef3e18364edf105c5af */
@mixin material-shadow($level:1){
@if $level == 1 {
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
@else if $level == 2 {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
@HZ-labs
HZ-labs / gist:22191294974064ecf54c
Last active January 10, 2017 18:48
test typehead html
$('#cwm-search').focus().typeahead('val', '').focus().typeahead('val', 'muse');
/// Stripe builder
/// @author Hugo Giraudel
/// @param {Direction} $direction - Gradient direction
/// @param {List} $colors - List of colors
/// @output `background-image` if several colors, `background-color` if only one
@mixin stripes($direction, $colors) {
$length: length($colors);
@if $length > 1 {
$stripes: ();
@HZ-labs
HZ-labs / cl.js
Last active August 29, 2015 14:11 — forked from azproduction/cl.js
console.log($LINE$);
// LINE = lineNumber()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
html {
background:#FFF;
}
@HZ-labs
HZ-labs / dabblet.css
Created September 11, 2014 18:04 — forked from LeaVerou/dabblet.css
Pounding heart animation
/* Pounding heart animation */
@keyframes pound {
to { transform: scale(1.4); }
}
.heart {
display: inline-block;
font-size: 150px;
color: #e00;
@HZ-labs
HZ-labs / dabblet.css
Created April 16, 2014 08:45
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.t1 {
width:100px;
height:100px;
background: #444;
color: #fff;
@HZ-labs
HZ-labs / dabblet.css
Created April 15, 2014 15:21
Pounding heart animation
/* Pounding heart animation */
@keyframes pound {
to { transform: rotateY(180deg); }
}
.heart {
display: inline-block;
font-size: 150px;
color: #e00;

The BBC has a server-side image service which provides developers with multiple sized versions of any image they request. It works in a similar fashion to http://placehold.it/ but it also handles the image ratios returned (where as placehold.it doesn't).

The original BBC News process (and my re-working of the script) follows roughly these steps...

  • Create new instance of ImageEnhancer
  • Change any divs within the page (which have a class of delayed-image-load) into a transparent GIF using a Base64 encoded string.
    • We set the width & height HTML attributes of the image to the required size
    • We know what size the image needs to be because each div has custom data-attr set server-side to the size of the image
    • We then set a class of image-replace onto each newly created transparent image
  • We use a 250ms setTimeout to unblock the UI thread and which calls a function resizeImages which enhances the image-replace images so their source is now set to a URL whe