Skip to content

Instantly share code, notes, and snippets.

View tomfuertes's full-sized avatar

Tom Fuertes tomfuertes

View GitHub Profile
@tomfuertes
tomfuertes / gas.core.js
Created October 18, 2013 16:15
GAS w/ dc.js
/**
* @preserve Copyright 2011, Cardinal Path and DigitalInc.
*
* GAS - Google Analytics on Steroids
* https://github.com/CardinalPath/gas
*
* @author Eduardo Cereto <eduardocereto@gmail.com>
* Licensed under the GPLv3 license.
*/
(function(window, undefined) {
@tomfuertes
tomfuertes / make-website.sh
Last active August 26, 2022 21:54
create an s3 bucket, config website serving, create cloudfront distribution, sync local dir
#!/usr/bin/env bash
# To run:
# $ brew uninstall s3cmd && brew install s3cmd --HEAD
# $ s3cmd --configure # fill in w/ amazon account vars
# $ cd path/to/local/static/site
# $ wget https://gist.githubusercontent.com/tomfuertes/9175005/raw/make-website.sh
# $ bash make-website.sh
#
# NOTE: cfcreate takes ~15 minutes to run on AWS.

window.dfc

window.dfc is a function that allows you to pass a string and returns an int. This string is persisted via localStorage and available to send to reporting solutions like google optimize server side.

Installation

  1. Paste the inline js function into template.liquid as close to the <head> as possible
  2. Paste the ga additional code into shopify admin -> online store -> prefs -> Google Analytics for tracking experiments
@tomfuertes
tomfuertes / base.js
Created August 2, 2012 14:06
Base Tag Restructuring Pending Bootstrapper.bindDomParsed
(function () {
var cdn = document.createElement('script');
cdn.type = 'text/javascript';
cdn.async = true;
cdn.src = '//sub.domain.com/shared/bootstrap/0.8.0.2/js/libs/gas-utils.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(cdn, s);
})();
(function () {
webPropertyId = [];
@tomfuertes
tomfuertes / config.diff
Created February 9, 2014 17:47
uncss on a rails landing page in < 15 min (initial config steps in comments)
diff --git a/Gruntfile.js b/Gruntfile.js
index 53fe849..80ce14a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -56,6 +56,16 @@ module.exports = function (grunt) {
max_jshint_notifications: 5
}
},
+ uncss: {
+ gettingStarted: {
<!DOCTYPE html>
<html>
<head>
<script>
window.start = new Date();
function log(str){
return ()=>{
console.log(str, document.readyState, new Date() - start);
if (document.readyState === 'interactive') {
console.log(document.getElementById('foo').style);
@tomfuertes
tomfuertes / http2-server-push.rb
Last active February 2, 2019 19:32
Rails HTTP2 Server Push via Header Link (on Cloudflare)
class ApplicationController < ActionController::Base
after_action :server_push_headers # https://twitter.com/connorjshea/status/728472354385317888
def server_push_headers
# CLoudflare HTTP2 Server Push: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/
if request.format.html? # only on html pages
layout = self.send(:_layout) # with the right layout
if layout == "main" || layout == "speaker" || layout == "admin"
assets = [
@tomfuertes
tomfuertes / CROmetrics.md
Last active July 18, 2017 16:03 — forked from twalk4821/CROmetrics.apply
Application for CROmetrics remote work

CROmetrics Engineering Application

Thanks for your interest in working with us! To apply:

  • Create a "new gist" (link in github header once you're logged in) with the Raw Text of this .md file (do not fork this gist)
  • Answer the following questions in the spaces provided
  • Send an email to tom@crometrics.com and chris@crometrics.com that includes:
    • A paragraph that tells us a little about yourself and why you are interested in this job
    • A link to your Gist
    • Your desired hourly rate and general availability
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Custom click handler -->
<script>
window.myHandler = function() {
console.log('Click!');
};
</script>
<!-- jQuery -->

Keybase proof

I hereby claim:

  • I am tomfuertes on github.
  • I am tomfuertes (https://keybase.io/tomfuertes) on keybase.
  • I have a public key ASAIVt9k4luLPkhhBtcvs3pVzbyvJgyXtEoni54DFZ96owo

To claim this, I am signing this object: