Skip to content

Instantly share code, notes, and snippets.

View rosemarydotworld's full-sized avatar
🐌
buffering

Rosemary Campbell rosemarydotworld

🐌
buffering
View GitHub Profile
<?php
//give blocks semantic html ids and theme hook suggestions
function wmux_preprocess_block(&$vars) {
$semantic_block_id = wmux_id_safe($vars['block']->subject);
$vars['semantic_block_id'] = $semantic_block_id;
$vars['theme_hook_suggestions'][] = 'block__' . $semantic_block_id;
}
function wmux_id_safe($string) {
@rosemarydotworld
rosemarydotworld / gist:5352054
Created April 10, 2013 05:30
Output of `npm list`
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
@rosemarydotworld
rosemarydotworld / gist:8653462
Created January 27, 2014 17:39
Clean Code Contest Rules

Clean Code Contest

Here's the rules:

  1. Submit code by gist to the Hipchat room.
  2. If the code is a rewrite of previous code, include previous code as well as rewrite.
  3. Any amount of code can be submitted. A really well written function can win.
  4. Only submit code you wrote on the day of the contest. Honor system, people.
  5. I accept Tritium, Sass, and Javascript.
  6. Contest is closed at 4:30 PM, the winner will be announced shortly thereafter.
@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:
@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 / 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: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 / 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 / eat it
Created December 12, 2014 19:05
Fuck ASP.NET
/\w+="ctl00(\$|_|-|[a-Z]|[0-9])+"/
/*
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.
*/