Skip to content

Instantly share code, notes, and snippets.

@sti-fed
sti-fed / _compass_support_constants.sass
Created October 29, 2013 19:17
SASS: Compass Support Constants
// Compass support constants
$legacy-support-for-ie: if($platform == "mobile", false, true)
$experimental-support-for-mozilla: if($platform == "mobile", false, true)
$experimental-support-for-opera: if($platform == "mobile", false, true)
$experimental-support-for-microsoft: if($platform == "mobile", false, true)
@sti-fed
sti-fed / _sprites.sass
Created October 28, 2013 18:27
SASS: Sprites (Regular and HD)
// include your sprites as the following:
// for example
// $logos-1x: sprite-map("pickem/ui/l/logos/*.png")
// $logos-2x: sprite-map("pickem/ui/h/logos/*.png")
// function for sprite needed for the mixin below
@function hdpi-sprite-position($map, $file)
$unit: 0 0
@if $map
$unit: floor(nth(sprite-position($map, unquote($file)), 1) / 2) floor(nth(sprite-position($map, unquote($file)), 2) / 2)
@sti-fed
sti-fed / _truncate.sass
Created October 25, 2013 18:37
SASS: Truncate Mixin
// CSS text truncation
=truncate($width: 300px)
max-width: $width
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
display: block
@sti-fed
sti-fed / _mixin_icon_font.sass
Created October 23, 2013 14:40
SASS: Icons (fonts)
// requires unbust-font-url function
// leave @font-face here or move to _font.sass file
@font-face
font:
family: iconset
weight: normal
style: normal
src: unbust-font-url("iconset/iconset.eot")
src: unbust-font-url("iconset/iconset.eot", "iefix") format("embedded-opentype"), unbust-font-url("iconset/iconset.woff") format("woff"), unbust-font-url("iconset/iconset.ttf") format("truetype"), unbust-font-url("iconset/iconset.svg", "iconset/iconset") format("svg")
// ------------------------
@sti-fed
sti-fed / _respond.sass
Created October 22, 2013 13:32
SASS: Respond Media Queries
// ---------------------------------------------------------------------------------------------------------------------
//
// Author: Rafal Bromirski
// www: http://paranoida.com/
// twitter: http://twitter.com/paranoida
// dribbble: http://dribbble.com/paranoida
//
// Licensed under a MIT License
//
// ---------------------------------------------------------------------------------------------------------------------
@sti-fed
sti-fed / object_name_space.js
Created October 21, 2013 16:43
jQuery: Object Name Space
var app {
onReady: function () {
$( 'selector1' ).bind( click, app.method1 );
$( 'selector2' ).bind(click, app.method2 );
},
method1: function () { ... },
method2: function () { ... }
};
$( document ).ready( app.onReady );
@sti-fed
sti-fed / gist:7076516
Created October 20, 2013 23:14
Sass: STI Establish Baseline
=sti-establish-baseline($font-size: $base-font-size, $element: null)
// Borrowed from Compass Version: 0.12.2
// IE 6 refuses to resize fonts set in pixels and it weirdly resizes fonts
// whose root is set in ems. So we set the root font size in percentages of
// the default font size.
html
-webkit-font-smoothing: antialiased
* #{unquote($element)}
font-size: 100% * $font-size / $browser-default-font-size
@sti-fed
sti-fed / mobile-toggles.js
Last active December 26, 2015 02:09
JQuery: Toggle Show Classes
$(document).ready(function(){
var $this == $(this);
$("#header-region").on(click, "#menu-button", function(){
$this.next(".main-nav").toggleClass("show")
});
$(".call-out").on(click, ".tab", function(){
$this.closest(".call-out").find(".pick-instructions").toggleClass("show")
});
});
@sti-fed
sti-fed / _inline-icons.css.sass
Created October 20, 2013 16:27
Sass: Icons - Inline
=inline-icons
i.icon
display: inline-block
@each $icon in sprite_names($icons)
.#{$icon}
background: $icons
position: sprite-position($icons, $icon)
repeat: no-repeat
+sprite-dimensions($icons, $icon)
@sti-fed
sti-fed / _borders.css.sass
Created October 20, 2013 16:24
Sass: Borders
=single-border($position : "top", $size: "1px")
border-#{$position}: $size solid #a4a19f
=split-border
&:before
content: ""
height: 1px
width: 200%
background-color: $gray
position: absolute
top: 10px