Skip to content

Instantly share code, notes, and snippets.

View coryhouse's full-sized avatar

Cory House coryhouse

View GitHub Profile
@coryhouse
coryhouse / gist:8ff24cf2680035e67eea
Last active August 29, 2015 14:14
Cache Busting via Regex and Gulp.js
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var replace = require('gulp-replace');
gulp.task('js', function () {
var filename = 'script' + getDate() + '.js';
gulp.src('src/**/*.js')
.pipe(concat(filename))
@coryhouse
coryhouse / gist:1f925fa4aec1d8978346
Created February 3, 2015 13:42
Cart.js AMD Module
//cart.js
define(['user'], function (user) {
var calculateSalesTax = function() {
var userPostalCode = user.postalCode;
//logic to calculate sales tax continues...
};
});
@coryhouse
coryhouse / gist:f93feadd6a0de6808f7c
Last active August 29, 2015 14:14
User.js AMD Module
//user.js
define(['cart'], function (cart) {
var numItemsInCart = cart.items.length;
//logic to initialize user's cart icon continues here...
});
//user.js
define([], function () {
var cart = require('cart'); //using this style to work around circular reference
var numItemsInCart = cart.items.length;
//logic to initialize user's cart icon continues here...
});
@coryhouse
coryhouse / gist:c69fe7c13a921e87c4b2
Last active August 29, 2015 14:22
Manifest.json example
{
"script.js": "script-098f6bcd.js"
}
function get(personId) {
//logic to get person here
}
Person Get(int personId)
{
//logic to get person here
}
@coryhouse
coryhouse / gist:34f727bc3d2466dfdef0
Last active August 29, 2015 14:24
Webpack prod config
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
@coryhouse
coryhouse / eslint.config.json
Created August 16, 2015 15:23
ESLint config for "Building Applications with React and Flux
{
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true,
"node": true,
"jquery": true
},
"rules": {
string googleAnalyticsScript = @"var _gaq = _gaq || [];
_gaq.push(['_setAccount', '" + googleAnalyticsKey + @"']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];