Skip to content

Instantly share code, notes, and snippets.

View coryhouse's full-sized avatar

Cory House coryhouse

View GitHub Profile
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];
@coryhouse
coryhouse / authorApi.js
Created August 6, 2015 13:04
Mock Author API for "Building Applications with React and Flux" on Pluralsight
"use strict";
//This file is mocking a web API by hitting hard coded data.
var authors = require('./authorData').authors;
var _ = require('lodash');
//This would be performed on the server in a real app. Just stubbing in.
var _generateId = function(author) {
return author.firstName.toLowerCase() + '-' + author.lastName.toLowerCase();
};
@coryhouse
coryhouse / gist:9e09fa659cf89e4eddef
Created August 6, 2015 13:09
Author data for "Building Applciations with React and Flux" on Pluralsight
module.exports = {
authors:
[
{
id: 'cory-house',
firstName: 'Cory',
lastName: 'House'
},
{
id: 'scott-allen',
@coryhouse
coryhouse / courseApi.js
Created August 6, 2015 20:50
Mock CourseAPI for "Building Applications with React and Flux" on Pluralsight
"use strict";
//This file is mocking a web API by hitting hard coded data.
var courses = require('./courseData').courses;
var _ = require('lodash');
//This would be performed on the server in a real app. Just stubbing in.
var _generateId = function(course) {
return course.title.replace(' ', '-');
};
@coryhouse
coryhouse / courseData.js
Created August 6, 2015 20:53
Course data for "Building Applications with React and Flux" on Pluralsight
module.exports = {
courses: [
{
id: "clean-code",
title: "Clean Code: Writing Code for Humans",
watchHref: "http://www.pluralsight.com/courses/writing-clean-code-humans",
author: {
id: "cory-house",
name: "Cory House"
},
@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": {
@coryhouse
coryhouse / package.json
Last active November 9, 2023 06:04
Example of pre and post scripts in package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"prebuild": "echo I run before the build script",
"build": "cross-env NODE_ENV=production webpack",
"postbuild": "echo I run after the build script"
}
}
@coryhouse
coryhouse / package.json
Last active September 4, 2024 07:38
Example of calling one script from another
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack"
}
}
@coryhouse
coryhouse / package.json
Last active December 20, 2015 02:30
Example of hacky comment in package.json
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean-comment": "Clean the dist folder before the build by removing it and recreating it.",
"clean": "rm -rf ./dist && mkdir dist"
}
}
@coryhouse
coryhouse / package.json
Last active January 17, 2016 03:29
Example of using && to call multiple scripts, serially
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"remove-dist": "rimraf ./dist",
"create-dist": "mkdir dist && cd dist && mkdir js && mkdir styles",
"prebuild": "npm run remove-dist && npm run create-dist",
"build": "webpack"
}