Skip to content

Instantly share code, notes, and snippets.


Jonny MacEachern jonnymaceachern

View GitHub Profile
jonnymaceachern / _fonts.scss
Last active Jul 14, 2017
Mixin to declare font face for all file types (.eot, .woff, .ttf, .svg)
View _fonts.scss
@mixin declare-font-face($font-family, $font-filename, $font-weight : normal, $font-style :normal, $font-stretch : normal) {
@font-face {
font-family: '#{$font-family}';
src: url(font-path('#{$font-filename}.eot'));
src: url(font-path('#{$font-filename}.eot?#iefix')) format('embedded-opentype'),
url(font-path('#{$font-filename}.woff')) format('woff'),
url(font-path('#{$font-filename}.ttf')) format('truetype'),
url(font-path('#{$font-filename}.svg##{$font-family}')) format('svg');
font-weight: $font-weight;
font-style: $font-style;
jonnymaceachern /
Last active Jul 14, 2017
Basically a .gitignore file for your local environment. Allows you to ignore files without updating the .gitignore directives.
exclude = !sh -c 'echo "$1" >> .git/info/exclude' -
jonnymaceachern /
Last active Sep 3, 2015
Like .gitignore, but for a specific directory.
git update-index --assume-unchanged <file>
jonnymaceachern /
Last active Sep 3, 2015
Show a summarized table of total commits per user.
git shortlog -s | sort -nr
jonnymaceachern / html5shiv.html
Last active Sep 3, 2015
Conditional to add html5shiv to < IE9 (primarily used when compatibility with 8 is necessary). This will fix any IE8 browser issues with Bootstrap 3 columns not columnizing.
View html5shiv.html
<!--[if lt IE 9]>
<script src=""></script>
<script src=""></script>
jonnymaceachern / human_time_diff_enhanced.php
Last active Sep 3, 2015
Modified version of the WordPress human_time_diff() timestamp. Example: It is Sept 7th and the function is given a duration threshold of 7 days. If the post you are retrieving a timestamp from was made anytime after Sept 1st, it will return a time difference (e.g. 4 days, 3 hrs, 15 minutes, 24 seconds, etc). If you are retrieving a timestamp fro…
View human_time_diff_enhanced.php
* Modified human_time_diff timestamp
* @param integer $duration (days) A threshold. If exceeded, the timestamp will return a date rather than a human_time_diff
* @return string A human-friendly timestamp
* credit:
function human_time_diff_enhanced( $duration = 60 ) {
jonnymaceachern / offset-anchor.css
Last active Sep 3, 2015
Adds an offset when jumping to a pages anchor/id to account for a fixed header that may overlap the content.
View offset-anchor.css
/* When using a fixer header that takes up the top 100px
or so, you can offset the anchor jump using the following */
.offset-anchor:before {
display: block;
content: " ";
height: 100px; /* Give height of your fixed element */
margin-top: -100px; /* Give negative margin of your fixed element */
visibility: hidden;
jonnymaceachern / mobile-resize-check.js
Created Sep 4, 2015
A resize event is triggered when a mobile browsers address bar drops down (when changing directions in a scroll). This will let you check for only width resizes. From
View mobile-resize-check.js
var width = $(window).width();
if($(this).width() != width){
width = $(this).width();
// your code
View css-block-comment.sublime-snippet
<description>CSS block comment</description>