Skip to content

Instantly share code, notes, and snippets.

View imjakechapman's full-sized avatar
⛓️
@6079.ai

Jake Chapman imjakechapman

⛓️
@6079.ai
View GitHub Profile
@imjakechapman
imjakechapman / Gruntfile.js
Created January 13, 2014 03:09
Super basic Grunt.js setup for js and css files
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
uglify: {
dist: {
src: ['assets/js/vendor/jquery.js', 'assets/js/vendor/**/*.js'],
dest: "assets/js/vendor.min.js"
}
@imjakechapman
imjakechapman / gist:8406060
Last active January 3, 2016 03:59
Vertically Align
@mixin vertical-align {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
@imjakechapman
imjakechapman / gulpfile.js
Last active August 29, 2015 13:56
My personal base Gulpfile
// Gulp Requires
var gulp = require('gulp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
notify = require('gulp-notify'),
sass = require('gulp-sass'),
livereload = require('gulp-livereload'),
rjs = require('gulp-requirejs');
// Node requires for exec and sys
@imjakechapman
imjakechapman / app.js
Last active August 29, 2015 13:56
Conditional script loading based on declarative markup
require.config({
baseUrl: '/assets/js',
paths: {
jquery: [
'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min',
'vendor/jquery'
],
slider: 'vendor/slider',
player: 'vendor/player'
}
@imjakechapman
imjakechapman / gist:9945290
Created April 2, 2014 23:22
iOS 7 fix for not triggering select's onChange event
$.fn.quickChange = function(handler) {
return this.each(function() {
var self = this;
self.qcindex = self.selectedIndex;
var interval;
function handleChange() {
if (self.selectedIndex != self.qcindex) {
self.qcindex = self.selectedIndex;
handler.apply(self);
}
# Enable Gzip
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# Don’t compress
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
#Dealing with proxy servers
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
@imjakechapman
imjakechapman / gist:6a9aa2ee1af0d9fcba24
Created May 1, 2014 20:52
Match Element heights within a container element
// Function to make heights of elements
$.fn.equalHeights = function(px) {
$(this).each(function(){
var currentTallest = 0;
$(this).children().each(function(i){
var el = $(this).find('.element-you-want-to-check-height-on'),
h = el.outerHeight();
if (h > currentTallest) { currentTallest = h; }
});
@imjakechapman
imjakechapman / gist:c5b7c81174cfe7e9ff16
Created May 13, 2014 23:15
Disable overscroll while mobile navigation is open
// Disable overscroll / viewport moving when a menu is open
$body.on('touchmove', function (e) {
if ( $body.hasClass('is-active') ) e.preventDefault();
});
@imjakechapman
imjakechapman / gulpfile.js
Created May 23, 2014 00:08
Base Gulpfile
// Ah, Big Gulp's eh? Welp, see ya later.
var gulp = require('gulp'),
gutil = require('gulp-util'),
c = require('chalk'),
clean = require('gulp-clean'),
imagemin = require('gulp-imagemin'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
map = require('map-stream'),
<!-- Google Open Schema -->
<span itemscope itemtype="http://schema.org/LocalBusiness" style="display:none">
<span itemprop="name"></span>
<meta itemprop="image" content="image.jpg">
<meta itemprop="telephone" content="">
<meta itemprop="email" content="">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<meta itemprop="streetAddress" content="">
<meta itemprop="addressLocality" content="">
<meta itemprop="addressRegion" content="">