Skip to content

Instantly share code, notes, and snippets.

View msweeney's full-sized avatar
💭
I may be slow to respond.

Matt Sweeney msweeney

💭
I may be slow to respond.
View GitHub Profile
module.exports = function(str) {
return function(style) {
style.rules = style.rules.map(function(rule) {
if (rule.declarations) {
rule.declarations.forEach(function(decl, i) {
var token;
if (decl.comment) {
token = decl.comment.trim();
if (token.charAt(0) === '$') {
rule.declarations[i+1].value = token;
@msweeney
msweeney / selector-shorthand-less.less
Last active December 18, 2015 04:49
Selector shorthand in Less
@texty-inputs: ~'input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="date"], input[type="month"], input[type="time"], input[type="datetime"], input[type="datetime-local"], input[type="week"], input[type="number"], input[type="search"], input[type="tel"], input[type="color"]';
.pure-form {
@{texty-inputs} {
display: block;
}
}
// yields
@msweeney
msweeney / selector-shorthand-sass.scss
Last active December 18, 2015 04:49
Selector shorthand in SASS
$texty-inputs:
'input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="datetime"],
input[type="datetime-local"],
@msweeney
msweeney / unit-wrap
Created May 31, 2013 17:27
Test page attempting to reproduce: http://jsfiddle.net/N4KGC/
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.9.1/build/cssnormalize/cssnormalize-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.9.1/build/cssfonts/cssfonts-min.css">
<style type="text/css">
body {
@msweeney
msweeney / Y.Color usage
Created September 13, 2012 23:09
Y.Color usage
function MyColorThing() {};
MyColorThing.prototype = {
complement: function(color) {
return Y.Color.getComplementary(color);
}
};
@msweeney
msweeney / grids.js
Created July 24, 2012 23:06
Simple Grid class for building layouts
/*
Usage:
var grid = new Grid({
units: [
'1/2',
'1/4',
'1/4'
],
@msweeney
msweeney / gist:979206
Created May 18, 2011 18:35
flexible layout
#box1 {
float: left;
width: 100px;
}
#box2 {
overflow: hidden; /* auto-size to remaining width */
}
@msweeney
msweeney / webkit transition bug
Created October 21, 2010 07:49
the height doesn't transition unless set prior (chrome 6, safari 5)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style>
#demo {
overflow: hidden;
}
.fix {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Base Page</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.1.1/build/cssfonts/fonts-min.css&3.1.1/build/cssreset/reset-min.css&3.2.0pr1/build/cssgrids/grids-min.css">
<script type="text/javascript" charset="utf-8"
src="http://yui.yahooapis.com/3.1.1/build/yui/yui-min.js">
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Base Page</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
<style>
.yui-u {
height: 100%; /* snap to height of grid */