Skip to content

Instantly share code, notes, and snippets.

View mattstauffer's full-sized avatar

Matt Stauffer mattstauffer

View GitHub Profile
@mattstauffer
mattstauffer / breaks.scss
Created August 6, 2012 20:57
Complex Sass breakpoint declaration
@function column-width($cols) {
@return 90px * $cols;
}
@function column-under-width($cols) {
@return (90px * $cols) - 1;
}
@function over-mq($w) {
@return "screen and (min-width: #{$w})";
}
@function under-mq($w) {
@mattstauffer
mattstauffer / gist:3835881
Created October 4, 2012 19:35
Isotope Centered with Gutters
// Tweaked form of Isotope gutters hack ( https://gist.github.com/2574891 ) and
// centered masonry hack (http://isotope.metafizzy.co/custom-layout-modes/centered-masonry.html )
//
// No guarantees; there are even @todos and FIXMEs in here. This is just what I cobbled together
// for a particular project, and I only tweaked it enough to be sure it worked on that project.
$.Isotope.prototype._getMasonryGutterColumns = function() {
// Tweak: Renamed call of this.options.masonry to this.options (not sure why it was wrong in example)
var gutter = this.options.gutterWidth || 0;
@mattstauffer
mattstauffer / gist:4018160
Created November 5, 2012 16:36
Simple Javascript snippet performance test
// Simple Perf test on javascript snippets ( from http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/ )
var totalTime,
start = new Date,
iterations = 1000;
while (iterations--) {
// Code snippet goes here
}
// totalTime → the number of milliseconds taken
// to execute the code snippet 1000 times
new Vue({
el: '#assignment-creator',
data: {
trainee: {}
},
ready: function () {
this.trainee = TrainRemote.trainee;
}
});
// SASS
nav {
a {
color: green;
li.selected & {
color: red;
}
}
}
@mattstauffer
mattstauffer / gist:6976202
Created October 14, 2013 14:05
Clone framework git repo without history for starting a new app -- from @garethdaine in #laravel
git clone -b develop --depth=1 git://github.com/laravel/laravel.git myapp
@mattstauffer
mattstauffer / gist:8199295
Created December 31, 2013 16:40
Taylor Otwell's initial HHVM config for laravel ( https://twitter.com/taylorotwell/status/418057634378301440 )
Server {
Port = 8080
SourceRoot = /home/taylor/Test/public/
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
@mattstauffer
mattstauffer / .vimrc
Last active July 7, 2016 03:23
Vimscripts to easily create PHP class and easily add dependency to PHP class Tweaked versions of a script by Jeffrey Way
" Note: To add this to your .vimrc, you'll have to delete any character that is written with a caret (e.g. "^M") and enter the real value; to enter ^M, enter insert mode and type CTRL-V CTRL-M.
" Easily create class.
function! Class()
let name = input('Class Name? ')
let namespace = input('Any Namespace? ')
if strlen(namespace)
exec 'normal i<?php namespace ' . namespace . ';^M^M^['
else

Keybase proof

I hereby claim:

  • I am mattstauffer on github.
  • I am mattstauffer (https://keybase.io/mattstauffer) on keybase.
  • I have a public key whose fingerprint is AD6F 7CE7 553D A9C7 89A6 07C9 ED60 D8FD 9359 6537

To claim this, I am signing this object:

@mattstauffer
mattstauffer / makepost.sh
Created September 5, 2017 01:02
My build script for creating a new Jigsaw post
#!/bin/bash
function slugify {
echo "$1" | iconv -t ascii//TRANSLIT | sed -E s/[^a-zA-Z0-9]+/-/g | sed -E s/^-+\|-+$//g | tr A-Z a-z
}
# -------------------------------
echo
echo Creating a new blog post.