Skip to content

Instantly share code, notes, and snippets.

Clay Whitley clay-whitley

Block or report user

Report or block clay-whitley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md

This is a helper function to customize KISSmetrics form tracking.

The original trackSubmit function automatically captures every single form field of a tracked form as a property in KISSmetrics. It also automatically identifies a user, if it detects that they filled out a form field with a name containing "email" or "username".

There are ways of forcing the function to ignore or include certain form fields, but for anything beyond that, you'd have to write custom JavaScript. The goal of this helper is to provide more configuration options when setting up form tracking in KISSmetrics, to prevent custom code from being required.

Usage

(Please see attached usage file for code sample)

View start
#!/bin/bash
# Invoke the Forever module (to START our Node.js server).
./node_modules/forever/bin/forever \
start \
-al forever.log \
-ao out.log \
-ae err.log \
app.js
@clay-whitley
clay-whitley / export_processor.md
Last active Apr 5, 2017
km-export-processor Documentation
View export_processor.md

km-export-processor gem

The purpose of this gem is to consume the JSON that KISSmetrics exports to an S3 bucket, and transform it in a variety of useful ways.

The core features are:

  • JSON compiler : Aggregates all KISSmetrics JSON files in a directory, into a single (nonstandard) file.
  • JSON to JSON converter : Converts a nonstandard JSON file into standard format.
  • JSON to CSV converter : Converts a nonstandard JSON file into a CSV file, where each row is an event/property/alias.
  • Reimporter : Takes a nonstandard JSON file, and an API key, and sends the data in the JSON file to the product using the KMTS gem.
View gist:7937223
<script type="text/javascript">
if (!affinova_user){
var _kmq = _kmq || [];
var _kmk = _kmk || '4283d6742d744fff4848dfddeb6e314a088398b0';
function _kms(u){
setTimeout(function(){
var d = document, f = d.getElementsByTagName('script')[0],
s = d.createElement('script');
s.type = 'text/javascript'; s.async = true; s.src = u;
f.parentNode.insertBefore(s, f);
View routes_guide.md

#Routing in Rails

##Resources

In Sinatra applications, you may have noticed a pattern in the routes/controller actions (they are the same in Sinatra) you were creating. In Rails, the common routes of index, show, new, edit, create, update, and destroy are all contained in a "resource". You typically will want a resource for each model in your application you want to perform these actions on. For example, this would constitute a users resource:

HTTP verbPathController ActionUsed for
View Gemfile
source :rubygems
# PostgreSQL driver
gem 'pg'
# Sinatra driver
gem 'sinatra'
gem 'shotgun'
# Use Thin for our web server
View application.js
$(document).ready(function() {
$('form').on('submit', function(e){
e.preventDefault();
var formData = $(this).serialize();
// get data from form field
$.post('/grandma', formData, function(response) {
$('#grandma_message').text(response.grandma_response);
});
// create a new ajax request with data
// take response ajax call gives us and perform logic (inserting data we receive back into dom)
View jquery_quiz.js
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
View jquery_quiz.js
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
@clay-whitley
clay-whitley / index.html
Last active Dec 20, 2015 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
View index.html
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
You can’t perform that action at this time.