Skip to content

Instantly share code, notes, and snippets.

Avatar
🇮🇪

T.J. Fogarty tjFogarty

🇮🇪
View GitHub Profile
@tjFogarty
tjFogarty / ajax-partial.js
Created Feb 27, 2014
Load in sections of a site via AJAX - recommended on non-essential items like a megamenu that might not be used on mobile
View ajax-partial.js
/**
* Template
* This allows fetching of non-essential assets via AJAX
* e.g. megamenu
* @param object, configuration parameters
*/
function Template(config) {
this.fetchFile = config.fetchFile;
this.partialsDir = config.partialsDir || '/partials/';
this.fetchURL = this.partialsDir + this.fetchFile;
@tjFogarty
tjFogarty / image-performance.js
Last active Aug 29, 2015
This doesn't include checks to see if this is supported on certain browsers.
View image-performance.js
/**
* Detects using window.performance
* We can serve small images first, then upgrade on faster connections
* See: http://mattandrews.info/talks/port80-2013/#/
*/
(function () {
var perf = window.performance,
start = perf.timing.requestStart, // just before page is requested
end = perf.timing.responseStart, // first byte received
View gist:b2eda028d5ea8864de47
### Keybase proof
I hereby claim:
* I am tjFogarty on github.
* I am fogarty (https://keybase.io/fogarty) on keybase.
* I have a public key whose fingerprint is F16E EE8B 30A4 6EA4 8B9B 3293 9C3D FA76 F916 7210
To claim this, I am signing this object:
View wiredep.js
// inject bower components
gulp.task('wiredep', function () {
gulp.src('./partials/*.php')
.pipe(wiredep({
directory: './bower_components/'
}))
.pipe(gulp.dest('./partials'));
});
@tjFogarty
tjFogarty / foundation-mq.js
Last active Aug 29, 2015
Check Foundation Media Queries
View foundation-mq.js
/* globals $, jQuery, Foundation */
/* jshint node:true */
'use strict';
window.MQ = (function(MQ, $, queries) {
/**
* $cache elements
* @type {Object}
View gulpfile.js
/* jshint node:true */
'use strict';
var gulp = require('gulp');
var traceur = require('gulp-traceur');
gulp.task('scripts', function () {
return gulp.src('js/main.js')
.pipe(traceur())
@tjFogarty
tjFogarty / main.js
Created Oct 17, 2014
Browserify main entry point example
View main.js
$(document).ready(function () {
require('./modules/foundation');
require('./modules/foundation-media-queries');
require('./modules/slider');
});
@tjFogarty
tjFogarty / standard.html
Created Oct 17, 2014
ExpressionEngine dev check
View standard.html
{if global:env == "dev"}
<link rel="stylesheet" href="{site_url}assets/styles/css/main.css">
{if:else}
{embed="critical/index"}
{/if}
@tjFogarty
tjFogarty / standard.html
Created Oct 17, 2014
ExpressionEngine dev check for scripts
View standard.html
{if global:env != "dev"}
{exp:minimee:js minify="yes" combine="yes"}
{/if}
<script src="/assets/scripts/vendor/jquery-1.11.1.min.js"></script>
<!-- bower:js -->
<script src="/assets/lib/modernizr/modernizr.js"></script>
<script src="/assets/lib/fastclick/lib/fastclick.js"></script>
<script src="/assets/lib/jquery.cookie/jquery.cookie.js"></script>
<script src="/assets/lib/jquery-placeholder/jquery.placeholder.js"></script>
@tjFogarty
tjFogarty / pi.responsive_images.php
Last active Aug 29, 2015
Responsive images with CE Image
View pi.responsive_images.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Responsive Images Class
*
* @package ExpressionEngine
* @category Plugin
* @author TJ Fogarty
* @copyright Copyright (c) 2014, TJ Fogarty
* @link http://www.emagine.ie
You can’t perform that action at this time.