Skip to content

Instantly share code, notes, and snippets.

View carlwood's full-sized avatar

Carl Wood carlwood

View GitHub Profile
background: #f00 url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cG9seWxpbmUgcG9pbnRzPSIyMCA2IDkgMTcgNCAxMiI+PC9wb2x5bGluZT48L3N2Zz4=);
@carlwood
carlwood / mytheme.libraries.yml
Last active January 16, 2019 15:03
Drupal 8 webpack
global-styling:
js:
build/js/vendor.js: {}
build/js/main.js: {}
dependencies:
- core/drupal
css:
theme:
build/css/main.css: {}
@carlwood
carlwood / touch.js
Created August 3, 2016 11:09
Use navigator user agent to add class if user is on mobile device
if (navigator.userAgent.match(/mobile/i)) {
$('body').addClass('touch');
}
// Sets rems, or px for IE
.font-size(@sizeValue) {
@remValue: @sizeValue;
@pxValue: (@sizeValue * 10);
font-size: ~"@{pxValue}px";
}
// Usage
.font-size(1.6); // 16px/1.6rem
@carlwood
carlwood / float-width.md
Last active August 29, 2015 13:56
Floating without widths

I was having a problem with floating two element - both left - hoping that the second element's width would expand to the end.

Original code:

.left { float: left; {
.right { float: left; } // right does not expand to fit the width of the row

Fix:

@carlwood
carlwood / firefox-fuzzy.md
Last active December 17, 2015 21:48
Problem with fuzzy firefox :after arrow rendering?
@carlwood
carlwood / linkcoloursmixin.md
Last active August 25, 2016 17:08
Link colours compass mixin

#SASS Link Colours shorthand

link-colors($normal, $hover, $active, $visited, $focus)

usage: