Skip to content

Instantly share code, notes, and snippets.

@bgreater
bgreater / content-gate.js
Last active January 11, 2021 22:41
Content Gate Example
import isMember from './is-member'
import isLoggedIn from './is-logged-in'
/**
* contentGate
*
* @export
* @class contentGate
/**
@bgreater
bgreater / .bash_profile
Last active January 4, 2021 17:10
Auto switching for NVM node version from .nvmrc file
## Add to your existing bash instance...
## BEGIN NODE VERSION: This helps set the desired version of node in a given project.
find-up () {
path=$(pwd)
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
done
echo "$path"
}
@bgreater
bgreater / scroll-depth.js
Last active August 10, 2022 23:01
Modern GA Scroll depth tracker
/**
* @file
* scroll depth js.
*
* Performance optimized scroll depth script based on
* findings from https://itnext.io/1v1-scroll-listener-vs-intersection-observers-469a26ab9eb6
*/
/**
* ScrollDepth
@bgreater
bgreater / bitbucket-pipelines.yml
Created October 3, 2019 01:08
bitbucket pipeline for a nuxt.js project with s3 deployment and cloudflare cache clear
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.3
pipelines:
branches:
master:
@bgreater
bgreater / deploy.sh
Created October 2, 2019 23:29
Deploy Script for Nuxt S3 publishing
#!/bin/bash
# This file is used with a nuxt + aws cli + s3 workflow so that your artifacts get gzipped.
# tested only on osx
# Create files.
nuxt generate
wait
# Compress dist files.
@bgreater
bgreater / gulpfile.js
Created October 8, 2018 23:53
Outsideonline gulpfile.js
// Include gulp
const gulp = require('gulp');
// Include Our Plugins
const sass = require('gulp-sass');
const browserSync = require('browser-sync');
const autoprefixer = require('gulp-autoprefixer');
const file = require('gulp-file');
const headerComment = require('gulp-header-comment');
const rollup = require('rollup');
@bgreater
bgreater / ga-auto-events.js
Created February 24, 2012 00:12
jQuery based automatic Google Analytics event tracking for downloads, off-site links & mailto's
// Dependacies: jQuery, ga.js (Async)
(function($){
$(window).load(function() {
if (this._gat) {
// Set trackers
tks = this._gat._getTrackers();