Skip to content

Instantly share code, notes, and snippets.


Brewster brewster1134

View GitHub Profile
brewster1134 / modifier mixin
Last active February 13, 2016 04:15
modify parents from within nested selectors
View modifier mixin
.vegetables .carrot {
color: orange;
.vegetables.out-of-season .carrot {
color: brown;
.fruits .apple {
color: red;
brewster1134 / input.sass
Last active September 9, 2019 15:34
bem mixins
View input.sass
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$bem-block: $bem-block !global
=el($element, $before: "", $after: "", $mod: "")
brewster1134 / example.sass
Last active August 29, 2015 14:00
Compass Spriting w/ Retina & Media Query Support
View example.sass
// call the all-sprites mixin to generate the base styles
// with MARKUP
// the following markup with generate retina assets for retina display, or regular images if a regular display
// <div class="global-image1"/>
// with SASS
// if you need to share a sprite with another element, just extend it
View 2520.rb
# What's the smallest number divisible be all of 1, 2, 3, 4, 5, 6, 7, 8, and 9?
require 'colorize'
def check_num num
(num % 9 == 0) && (num % 8 == 0) && (num % 7 == 0) && (num % 6 == 0)
multiple = 10
current_num = multiple
brewster1134 /
Last active September 9, 2019 16:27



Load Natural Text Editing Preset


Key Bindings

Select by line
change  shift + command + left   to: Move Start of Selection Back/Left    by Line
change shift + command + right to: Move End of Selection Forward/Right by Line
brewster1134 / keymap
Last active December 14, 2015 03:48
Sublime Text setup
View keymap
{ "keys": ["super+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} },
{ "keys": ["super+alt+down"], "command": "duplicate_line" },
{ "keys": ["super+shift+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" }
brewster1134 / sprockets-urlrewriter
Last active October 4, 2015 22:07
sprockets-urlrewriter gem
View sprockets-urlrewriter

After spending much time looking into the various solutions for serving vendored CSS containing relative urls (with much help from Bibliographic Wilderness, I decided on using the sprockets-urlrewriter preprocessor.

After some adjustments to the regex used to identify and rewrite the CSS urls, there was one other issue.

Although the sprockets-urlrewriter claims to rewrite relative urls to absolute ones, what it really does is rewrites urls relative to itself, to urls relative to the root asset directory.

This means that if the CSS all being compiled into application.css, everything works great. However if in development you are debugging your assets (a default in Rails), each CSS is linked individually. This means that the newly re-written urls are relative to application.css, but referenced in a different css file.

This is still ok if the location of the