Skip to content

Instantly share code, notes, and snippets.

View rosemarydotworld's full-sized avatar
🐌
buffering

Rosemary Campbell rosemarydotworld

🐌
buffering
View GitHub Profile
const focusVisible = (props, styles) => `
${props.theme.inputModality === 'KEYBOARD' && `
&:focus { ${styles} }
`}
&:focus-visible {
${styles}
}
`
@rosemarydotworld
rosemarydotworld / main.js
Created January 4, 2017 04:05
Namespacing Models in Choo
const choo = require('choo');
const app = choo();
app.model(require('./model-things'));
app.model(require('./model-stuff'));
const view = (state, prev, send) => html`
<main>
<button onclick=${e => send('things:notGood')}>things aren't good</button>
// Get the selector for a version of IE
@function getSelector($version) {
@if $version == 9 {
@return 'html.ie9 &';
} @else if $version > 9 {
@return 'html[data-browser="ie#{$version}"]';
}
}
// Write selectors for given space-separated IE versions
/*
Rem/Px Function
---
This is a fun one. If we support rems, calculate rems according to a pixel
value. If not, just spit out the pixel value. This means we can detect rem
support and spit out the stylesheet accordingly, all while writing only one
codebase.
*/
@rosemarydotworld
rosemarydotworld / eat it
Created December 12, 2014 19:05
Fuck ASP.NET
/\w+="ctl00(\$|_|-|[a-Z]|[0-9])+"/
@rosemarydotworld
rosemarydotworld / gist:7f87bb5b2c128e9783a7
Created November 24, 2014 22:20
Long shadow Sass function!
@function long-shadow($n, $color) {
$text-shadow: "1px 1px #{$color}";
@for $i from 2 through $n {
$new-shadow: "#{$i}px #{$i}px #{$color}";
$text-shadow: append((#{$text-shadow}), (#{$new-shadow}), comma);
}
@return $text-shadow;
}
@rosemarydotworld
rosemarydotworld / gist:996930a42065c407094b
Created November 20, 2014 00:36
Inline-block elements without spaces in pure HTML

Problem: Elements set to display: inline-block will render with spaces between them if there's whitespace in the source, which makes formatting difficult. You can fix this by putting font-size: 0 on the parent, but it feels pretty hacky.

@rosemarydotworld
rosemarydotworld / Starting Recipe
Last active October 20, 2016 05:55
How does Liam start projects? Let's find out!
* Reset (either normalize.css or Eric Meyer's reset.css)
* Bourbon
* Neat
* Variables
* Standard colors (go for $red instead of $error)
* Standard sizes
* Font stacks
* Standard media query parameters (named)
* Utilities/
@rosemarydotworld
rosemarydotworld / gist:b57ded45202a097023b5
Last active September 7, 2015 19:22
How to patch Hammer's Gems

Recently my team ran into an issue with Hammer stemming from its slightly-out-of-date Sass gem; we were trying to install the latest version of Bourbon Neat, and Hammer's 3.2 era version of Sass was balking at the !global flag introduced in 3.3. Rather than reverse engineer Neat's Sass or use an earlier (read: inferior) version, I went about patching the gem, which is not so hard a process, it turns out. I'll demonstrate the procedure with Sass as my example.

Disclaimer: I know just enough to realize that this is a fairly stupid hacky thing to do that will likely stop working when Hammer updates–assuming they don't update the Sass gem themselves.

Step 1: Procure and locate the gem we want

In your terminal, install your desired gem. in my case:

gem install sass -v 3.3.6
@rosemarydotworld
rosemarydotworld / babygoatme.coffee
Created June 12, 2014 21:38
Babygoat Me Lite, a Hubot script that grabs baby goat images from GIS, AKA the most important code I have ever cobbled together.
# Description:
# Baby goats, motherfucker
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands: