Skip to content

Instantly share code, notes, and snippets.

View andyford's full-sized avatar

Andy Ford andyford

View GitHub Profile
@andyford
andyford / gist:704137
Created November 17, 2010 21:35
CSS Triangle goofs
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>undocumented title</title>
<style>
nav {display:block;}
html {
background: #eee;
}
@andyford
andyford / jquery.equalheights.js
Created April 12, 2011 07:14
equalHeights jQuery Plugin
/*!
* equalHeights jQuery Plugin
*/
(function($){
$.fn.equalHeights = function() {
var tallest = 0,
current = 0;
this.each(function(){
current = $(this).height();
if(current > tallest) {
@andyford
andyford / sir-mixalot-reset.css
Last active September 25, 2015 16:17
Sir Mix-a-Lot CSS Reset
* {
padding-bottom: 200% !important;
}
@andyford
andyford / _columns.scss
Created February 16, 2012 21:40
Sass/Compass columns
$total-cols: 24;
$gr: 1.61803399; // golden ratio... because why not?
$col-gutter: ($gr * 1);
.col-group {
position: relative;
@include pie-clearfix; // a Compass mixin. If not using Compass (that's just insane), insert other clearfix
> .col {
float: left;
@andyford
andyford / opacity-insanity.scss
Created August 23, 2012 04:26
Sass/Compass non-semantic opacity class insanity
@for $num from 0 through 100 {
.opacity-#{$num} {
@include opacity($num * .01);
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="EmChart is a lookup table for converting pixel values to EM values and calculating line-height" />
<meta name="author" content="Andy Ford, Ford Interactive" />
<title>EmChart</title>
<!--
@andyford
andyford / .rvmrc
Created November 18, 2013 23:26
.rvmrc file to switch gemsets upon cd'ing into a directory. Wish I could remember where I got this to give proper attribution...
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.3-p385@GEMSET_NAME_GOES_HERE"
#
# First we attempt to load the desired environment directly from the environment
@andyford
andyford / uri.js
Last active August 29, 2015 14:03 — forked from jlong/uri.js
/*
* original from: https://gist.github.com/jlong/2428561
*
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
@andyford
andyford / NavMainCtrl.js
Created August 15, 2014 21:43
Current/Active nav in AngularJS
/*
* NavMainCtrl
* inspired by: http://stackoverflow.com/a/18894679/17252
*/
.controller('NavMainCtrl', ['$scope', '$location', function ($scope, $location) {
$scope.isCurrentPath = function (paths) {
// if we get a string instead of an array, turn into array with single string element
if (_.isString(paths)) { paths = [paths]; }
var i, len = paths.length;
@andyford
andyford / basic-grid.scss
Created January 25, 2016 11:29
super basic Sass grid
$total-cols: 12;
.col-group {
position: relative;
// @include clearfix; // bourbon
// @include pie-clearfix; // compass
}
.col {