Skip to content

Instantly share code, notes, and snippets.

View morewry's full-sized avatar
💭
⛈ 🌩 ☁️ 🌧 ☁️ ⛈ 🌧 🌩 ☁️

Rhy Moore morewry

💭
⛈ 🌩 ☁️ 🌧 ☁️ ⛈ 🌧 🌩 ☁️
View GitHub Profile
@morewry
morewry / compass-config-with-png-compression.rb
Created November 26, 2012 20:14 — forked from kswedberg/snippet.rb
Compass config with pngquant, pngout, and optipng to compress sprite
compiletype = environment
project_path = File.dirname(__FILE__) + "/"
utils_dir = "utilities/"
utils_path = project_path + utils_dir
# callback - on_sprite_saved
# http://compass-style.org/help/tutorials/configuration-reference/
on_sprite_saved do |filename|
if File.exists?(filename)
if (compiletype == :production)
@morewry
morewry / PngOutBatch.cmd
Created November 26, 2012 20:25 — forked from nicjansma/PngOutBatch.cmd
Runs a PNG through PngOut multiple times at different block sizes. More details @ http://nicj.net/2012/05/15/pngoutbatch
@echo off
setlocal enabledelayedexpansion
REM
REM PngOutBatch
REM
REM Nic Jansma - nic@nicj.net
REM
REM Runs a PNG through PngOut multiple times at different block sizes. Shows the
REM file-size savings during and at the end.
@morewry
morewry / compass-config-with-styledocco.rb
Created November 26, 2012 20:33
Compass config with styledocco to generate styleguide on compile
# we have a separate build process that strips comments & minifies, so I use production mode here to generate the styleguide
project_path = File.dirname(__FILE__) + "/"
utils_dir = "utilities/"
utils_path = project_path + utils_dir
output_style = (compiletype == :production) ? :expanded : :nested
# callback - on_stylesheet_saved
on_stylesheet_saved do |filename|
if File.exists?(filename)
if (compiletype == :production)
@morewry
morewry / config.rb
Last active October 13, 2015 06:17
Customize compass sprite selectors as automatically as possible
# http://stackoverflow.com/questions/10314907/getting-a-list-of-files-in-sass-compass
require File.join(File.dirname(__FILE__), 'listfiles.rb')
@morewry
morewry / Search-Nested-Backbone-LayoutManager-Views.js
Last active December 19, 2015 03:59
Backbone & Backbone Layout Manager - search for a nested view, recursive getView
// Pass in a starting view and match comparison
function findView ( startView, searchFn ) {
var resultView,
viewSearch = function ( curView ) {
curView.getView( function ( nestedView ) {
if ( searchFn( nestedView ) ) {
resultView = nestedView;
}
else {
viewSearch( nestedView );
@morewry
morewry / _icons.scss
Created September 18, 2013 18:44
Compass sprites generate placeholders instead of classes (newer version doesn't require listfiles.rb)
$disable-magic-sprite-selectors: true;
$icons-inline: true;
$icons-sprite-base-class: "%icons-sprite";
$icons-layout: smart;
$icons: sprite-map("icons/*.png");
@import "icons/*.png";
@each $img in sprite-names($icons) {
%icon-#{$img} {
@extend %icons-sprite;
@morewry
morewry / _sprite.scss
Last active August 29, 2015 13:57
Compass sprites with placeholder (use compass icon sprites with placeholders) instead of class selectors (except the generated sprite map) and retina support
/*
# Sprite (Theme)
*/
// ---------------------------------------
// Config
$disable-magic-sprite-selectors: true;
$sprite-default-margin: 1px;
$sprite-debug: true;
@morewry
morewry / _debug-map.scss
Created March 13, 2014 06:21
Sass print-map function and mixin for quick debugging of maps
/*
# Print Map
Usage:
// option 1
.debug {
@include print-map($map);
}
@morewry
morewry / _include-or-extend-defaults.scss
Last active October 1, 2015 21:07
Sass @include or @extend with generated selectors & override-able rules
// ---------------------------------------
/*
http://codepen.io/morewry/pen/meBtj
Use case for defaults:
providing interface points to override framework defaults with more flexibility and granularity than variables can reasonably provide, ie customize normalizations without editing the stylesheet directly (@content in reverse)
Use case for swapping extend or include:
@morewry
morewry / config.rb
Last active October 1, 2015 21:07
"Ad Hoc" Compass plugins config.rb, potentially useful for dealing with compass plugins through bower instead of as gems. Set up a plugin similarly to https://github.com/Team-Sass/Compass-Extension-Template
# make ad hoc compass frameworks behave (show up in list, be import-able like normal)
# custom vars
thisplugin_dir = (yours)
# compass config
extensions_dir = (yours)
extensions_path = project_path + extensions_dir
additional_import_paths = [extensions_dir, extensions_dir + thisplugin_dir + 'stylesheets']