Skip to content

Instantly share code, notes, and snippets.

@brianmcallister
brianmcallister / tcom.css
Created December 19, 2012 23:16
Title comment TextMate snippet.
/** ----------------------------------
${1:Title}
${1/(.)|(?m:\n.*)/(?1:-)/g}
$2
---------------------------------- */
$3
@brianmcallister
brianmcallister / settings.js
Created December 19, 2012 23:15
JSLint settings
/*jslint browser: true, indent: 2, maxlen: 80, nomen: true, plusplus: true */
@brianmcallister
brianmcallister / include.rb
Created November 16, 2012 15:50
Custom Sass function for Array#include?
module Sass::Script::Functions
# Wrapper around Ruby's Array#include? method.
# https://gist.github.com/4088394
#
# value - Value to check for in the list.
# list - List to look through.
#
# Examples
#
# $list: a b c;
@brianmcallister
brianmcallister / _mixins.scss
Created November 8, 2012 16:43
Debugging mode in Sass
/*
Debugging.
*/
@mixin o($color: red) {
@include if-debug {
outline: 1px solid $color;
}
}
@mixin b($color: blue) {
@brianmcallister
brianmcallister / _extendables.scss
Created October 18, 2012 17:31
Compass sprites for retina assets.
/*
I like to set up some extendable classes to keep the bulk of my sprite setup outside of my generated CSS.
*/
/*
Button sprite extendable.
*/
%button-sprite {
background-image: $button-sprite;
@include retina {
@brianmcallister
brianmcallister / retina.scss
Created October 15, 2012 21:53
Retina background image.
/*
Set a background image at 1x and 2x.
https://gist.github.com/3895807
@param {String} $name Image name.
@param {String} $ext File extension, e.g.: '.png'.
*/
@mixin retina-bg($name, $ext) {
@include squish-text;
$image: '#{$name}#{$ext}';
@brianmcallister
brianmcallister / size.scss
Last active February 3, 2016 14:07
Sass mixin for setting an element's size.
// Size mixin.
// https://gist.github.com/brianmcallister/3659524
//
// $width - Element width, with units.
// $height - Optional height of the element. Expects units, ex: 5px.
// Defaults to null.
@mixin size($width, $height: null) {
width: $width;
@if $height {
@brianmcallister
brianmcallister / position.scss
Last active February 3, 2016 14:07
Sass position mixin, with mixins for setting and resetting coordinates.
// Print position coords only.
// https://gist.github.com/brianmcallister/3641867
//
// $values - Position values. Null values get skipped over.
@mixin pos-coords($values: null null null null) {
$position-list: top right bottom left;
$count: 1;
@if length($values) == 1 and $values == 'reset' {
$values: auto auto auto auto;
@brianmcallister
brianmcallister / _retina-sprite-background.scss
Created July 19, 2012 22:28
Retina sprite background image mixin.
/*
This pretty much doesn't work at all right now.
*/
@mixin retina-general-sprite($name, $set-dimensions: true) {
$sprite-width: image-width('general.png');
$sprite-height: image-height('general.png');
$sprite-file-url: sprite-file($general-sprite, $name);
$sprite-file-width: image-width($sprite-file-url) / 2;
$sprite-file-height: image-height($sprite-file-url) / 2;
@brianmcallister
brianmcallister / retina-image.scss
Created July 5, 2012 14:51
Set a background image sized for retina screens, with an option to use the image url or an inline image.
/*
Set a background image sized for retina screens, with an option to use the image url or an inline image.
@param {String} $image Image to use.
@param {String} [$type] Type of image url to use. Default to an inline image.
*/
@mixin retina-image($image, $type: 'inline') {
@include hide-text;
@if $type != 'inline' and $type != 'url' {
@warn 'Unknown usage type. Falling back to "url"';