Skip to content

Instantly share code, notes, and snippets.

View jasonkmccoy's full-sized avatar

Jason McCoy jasonkmccoy

View GitHub Profile
$image-path: '../img' !default;
$fallback-extension: 'png' !default;
$retina-suffix: '@2x';
@mixin background-image($name, $size:false){
background-image: url(#{$image-path}/#{$name}.svg);
@if($size){
background-size: $size;
}
.no-svg &{
background-image: url(#{$image-path}/#{$name}.#{$fallback-extension});
@jasonkmccoy
jasonkmccoy / sass-calculateRem-output.css
Created March 12, 2015 23:55
Set a rem font size with pixel fallback (using a function and a mixin) http://zerosixthree.se/8-sass-mixins-you-must-have-in-your-toolbox/
p {
font-size: 14px; //Will be overridden if browser supports rem
font-size: 0.8rem;
}
.btn {
display: block;
color: white;
background-color: green;
padding-top: 12px;
padding-bottom: 12px;
}
.btn--tiny {
padding-right: 6px;
padding-left: 6px;
/* table layout if there are less than 6 items */
nav ul {
display: table;
table-layout: fixed;
width: 100%;
text-align: center;
background: #333;
}
@jasonkmccoy
jasonkmccoy / sass-filpside.html
Last active August 29, 2015 14:16
A cool button effect where the button transitions from action to confirmation in a 3D rotation. Made by Hakim El Hattab. http://lab.hakim.se/flipside/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flipside</title>
<meta name="description" content="">

You can use SassScript variables in selectors and property names using #{} interpolation syntax.

It’s also possible to use #{} to put SassScript into property values. In most cases this isn’t any better than using a variable, but using #{} does mean that any operations near it will be treated as plain CSS.

mixins_w_expressions_in_selectors_property_names_interpolation.scss

Lists are how Sass represents the values of CSS declarations like margin: 10px 15px 0 0 or font-face: Helvetica, Arial, sans-serif. Lists are just a series of other values, separated by either spaces or commas. In fact, individual values count as lists, too: they’re just lists with one item.

On their own, lists don’t do much, but the [Sass list functions][list-function] make them useful. The [nth function][nth-function] can access items in a list, the [join function][join-function] can join multiple lists together, and the [append function][append-function] can add items to lists. The [@each rule][each-rule] can also add styles for each item in a list.

[Read more on lists][read-more] [list-function]: http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#list-functions [nth-function]: http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#nth-instance_method [join-function]: http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#join-instance_method [append-function]: http://sass-lang.com

@jasonkmccoy
jasonkmccoy / sass-list-functions.css
Last active August 29, 2015 14:16
Sass List Functions
@charset "UTF-8";
.rss-tag:before, .call-us:before, .listen-now:before {
margin-right: 0.25em;
}
.rss-tag:before {
content: "";
}
.call-us:before {

Git basics - a general workflow

There are many Git workflows out there, I heavily suggest also reading the atlassian.com Git Workflow article as there is more detail then presented here.

The two prevailing workflows are Gitflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited.

When using Bash in the command line, it leaves a bit to be desired when it comes to awareness of state. I would suggest following these instructions on setting up GIT Bash autocompletion.

Basic branching

@jasonkmccoy
jasonkmccoy / sass-simple-4096-selectors-test.html
Last active August 29, 2015 14:16 — forked from blackfalcon/README.md
sass-simple-4096-selectors-test: The point of this test is to easily see how the famed 4096 selector limit really effects your web apps.
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="app.css">
</head>
<body>
<p class="text-color">Hello world! Simple IE selector limit test scenario</p>
</body>