Skip to content

Instantly share code, notes, and snippets.

View scottkellum's full-sized avatar
🕴️
Working on Typetura

Scott Kellum scottkellum

🕴️
Working on Typetura
View GitHub Profile
@scottkellum
scottkellum / sass-3d
Created November 20, 2010 17:09
Sass to make text 3D
$left: rgba(255,0,0,.5)
$right: rgba(0,255,255,.5)
=transition($transition: all 1s)
-webkit-transition: $transition
-moz-transition: $transition
-o-transition: $transition
transition: $transition
body
@scottkellum
scottkellum / gloss
Created April 11, 2011 15:13
Sass mixin
=gloss($color)
background-color: $color
filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorstr='")#{lighten($color, 5%)}unquote("', endColorstr='")#{darken($color, 5%)}unquote("')")
-ms-filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorstr='#{lighten($color, 5%)}', endColorstr='#{darken($color, 5%)}')")
background-image: -webkit-gradient( linear, left bottom, left top, color-stop(1, lighten($color, 15%)), color-stop(0.5, $color), color-stop(0.49, darken($color, 5%)))
background-image: -webkit-linear-gradient(top, lighten($color, 15%) 0%, $color 50%, darken($color, 5%) 51%, darken($color, 5%) 100%)
background-image: -moz-linear-gradient(top, lighten($color, 15%) 0%, $color 50%, darken($color, 5%) 51%, darken($color, 5%) 100%)
background-image: linear-gradient(top, lighten($color, 15%) 0%, $color 50%, darken($color, 5%) 51%, darken($color, 5%) 100%)
@scottkellum
scottkellum / prefixer.sass
Created August 6, 2011 13:29
Vendor Prefixer
=prefix($attribute, $value)
-webkit-#{$attribute}: $value
-moz-#{$attribute}: $value
-ms-#{$attribute}: $value
-o-#{$attribute}: $value
#{$attribute}: $value
+prefix(box-shadow, 2px 0 5px #000)
@scottkellum
scottkellum / modular-scale.sass
Created August 6, 2011 13:30
Modular scale in Sass.
$golden: 1.618
$thirds: 3 / 2
$fourths: 4 / 3
=modular-scale($attribute, $value, $ratio, $multiple)
$modular-scale: $value
@for $i from 1 through $multiple
$modular-scale: $modular-scale * $ratio
#{$attribute}: $modular-scale
@scottkellum
scottkellum / Sass-exponents.sass
Created August 21, 2011 16:29
Sassy exponents
// Sass exponent support
@function exponent($base, $exponent)
// reset value
$value: $base
// positive intergers get multiplied
@if $exponent > 1
@for $i from 2 through $exponent
$value: $value * $base
// negitive intergers get divided. A number divided by itself is 1
@if $exponent < 1
@scottkellum
scottkellum / Sass-gradient.sass
Created October 4, 2011 11:21
Create gradients with ease using Sass
=gradient($startcolor, $endcolor, $startpos: top)
background-color: $startcolor / 2 + $endcolor / 2
@if $startpos == "top"
filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorstr='")#{$startcolor}unquote("', endColorstr='")#{$endcolor}unquote("')")
-ms-filter: unquote("progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startcolor}', endColorstr='#{$endcolor}')")
background-image: -webkit-gradient(linear, top left, bottom left, from($startcolor), to($endcolor))
@if $startpos == "left"
filter: unquote("progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='")#{$startcolor}unquote("', endColorstr='")#{$endcolor}unquote("')")
-ms-filter: unquote("progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#{$startcolor}', endColorstr='#{$endcolor}')")
background-image: -webkit-gradient(linear, top left, top right, from($startcolor), to($endcolor))
// Original gist https://gist.github.com/280797
$prefixes: -webkit- -moz- -ms- -o- !default
=prefix($property, $value, $prefixes)
@each $prefix in $prefixes
#{$prefix}#{$property}: $value
#{$property}: $value
=prefix-value($property, $value, $prefixes)
@scottkellum
scottkellum / _grid.sass
Created October 27, 2011 16:56
universal layout
// MEASUREMENTS
$base-size: 16px !default
$line-height: 1.3em !default
$margin: 5% !default
$gutter-width: 10% !default
$gutter-height: $line-height
$module-width: respond !default
$module-height: $line-height * 3 !default
$columns: 12 !default
$wrapper-align: center !default
@scottkellum
scottkellum / _color-schemer.sass
Created November 7, 2011 17:58
color-schemer
// Define color schemes quickly
// Color schemes to choose from
// complement
// triad
// tetrad
// analogic
// accented-analogic
$color-location: primary !default
@scottkellum
scottkellum / 7-inch-tablets.sass
Created November 23, 2011 01:55
7-inch-tablets
// Normalize 7" tablets.
// Default is halfway between both resolutions. I find the default 3/2 on the tab to be too much.
$tab7-virtual-resolution: (6/5) !default
@if unit($module-w) != "em"
@warn "Your grid MUST be based on ems to scale to 7 inch tablets."
@else
// Standard 7" 1024x600 tablet
@media screen and (-webkit-device-pixel-ratio: 1) and (device-width: 1024px) and (max-device-height: 600px) and (orientation: landscape), all and (-webkit-device-pixel-ratio: 1) and (device-width: 600px) and (max-device-height: 1024px) and (orientation: portrait)