Skip to content

Instantly share code, notes, and snippets.

View jamesslock's full-sized avatar

James Seymour-Lock jamesslock

  • Ebates, Rakuten
  • New York City
View GitHub Profile
@jamesslock
jamesslock / gist:9125094
Last active August 29, 2015 13:56
Diamond mixin
// Fluid Squares
// -------------------------------------------------------
@mixin box($box-size: 80px, $fluid: false) {
display: block;
position: relative;
height: 0;
width: $box-size;
padding-bottom: $box-size;
@if($fluid) {
height: 0;
$(".menu").click(function() { //use a class, since your ID gets mangled
$(this).addClass("active"); //add the class to the clicked element
});
@jamesslock
jamesslock / gist:6271090
Created August 19, 2013 16:32
Smooth scroll - jQuery
$(document).ready(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
var scrollElem = scrollableElement('html', 'body');
@jamesslock
jamesslock / gist:6223554
Created August 13, 2013 17:30
Set site hero to match browser height.
$(function(){
$('.site-header') .css({'height': (($(window).height()))+'px'});
$(window).resize(function(){
$('.site-header') .css({'height': (($(window).height()))+'px'});
});
});
@mixin span($num, $gutter_pc, $gutter_px, $padding, $max_columns) {
$one_col: (100% - ($gutter_pc * ($max_columns - 1))) / $max_columns;
width:($one_col * $num) + ($gutter_pc * ($num - 1));
border-left-width:$gutter_px;
padding:$padding;
margin-left:$gutter_pc;
}
@mixin offset($num, $gutter_pc, $gutter_px, $padding, $max_columns) {
$one_col: (100% - ($gutter_pc * ($max_columns - 1))) / $max_columns;
%container {
width: 100%;
max-width: 1280px;
padding: 20px;
margin: 20px auto;
position: relative;
}
%clearfix:before,
%clearfix:after {
content: " "; /* 1 */
@jamesslock
jamesslock / gist:4218223
Created December 5, 2012 18:31
hide text better
@mixin hide-text { font: 0/0 a!important; color: transparent!important; text-shadow: none!important; background-color: transparent!important; border: 0!important;}
.hide-text {
@include hide-text;
}
<VirtualHost *:80>
ServerName pow
ServerAlias *.dev
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
</VirtualHost>
<VirtualHost *:80>
ServerName james.dev
ServerAlias *.james.dev
DocumentRoot "/Users/james/code/james"
<Directory "/Users/james/code/james">
Order allow,deny
Allow from all
Options +MultiViews
@jamesslock
jamesslock / grid.scss
Last active October 12, 2015 13:18
Simple sexy Sass grid
/* 18 Column Grid
-----------------------------------------------------------------------------
Span 1: 3.66666666667%
Span 2: 9.33333333333%
Span 3: 15.0%
Span 4: 20.6666666667%
Span 5: 26.3333333333%
Span 6: 32.0%
Span 7: 37.6666666667%