Skip to content

Instantly share code, notes, and snippets.

View kohiomobz's full-sized avatar

Kavodel kohiomobz

View GitHub Profile
@kohiomobz
kohiomobz / robot.js
Created December 7, 2012 18:30
KevinScript
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@kohiomobz
kohiomobz / gist:7598c0df81582f5ff4cc
Last active August 9, 2016 06:42
Keeping Production Data Clear
var productionHost = 'Your production Domain'; /* www.mixpanel.com */
var devToken = 'Development Token';
var prodToken = 'Production Token';
/* If the hostname is anything other than your production domain, initialize the Mixpanel library with your Development Token */
if (window.location.hostname.toLowerCase().search(productionHost) < 0) {
@kohiomobz
kohiomobz / gist:e3a9324f91caba60719a
Last active October 7, 2015 19:03
Mixpanel: Track Links Workaround
<div id=“example-link”></div>
$(“#example-link”).click(function(event){
var redirectFunction = callback($(this));
event.preventDefault();
mixpanel.track(“Link Clicked”);
setTimeout(redirectFunction, 300);
});
function callback(val) {
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/css/reset.css">
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.css">
<script src="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<style>
.node circle {
@kohiomobz
kohiomobz / flows.js
Created April 10, 2015 23:50
Example Flows Chart
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/css/reset.css">
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.css">
<script src="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<style>
@kohiomobz
kohiomobz / Dashboard
Created April 10, 2015 23:53
Dashboard
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/css/reset.css">
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.css">
<script src="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.js"></script>
</head>
<body class="mixpanel-platform-body">
<div class="mixpanel-platform-section">
<div id="eventSelect" style="float: left;"></div>
1. Signup for Github Account
2. Create a Gist
3. Specify Language as JavaScript
4. Paste Code in.
5. Create public Gist
6. Send over link
@kohiomobz
kohiomobz / gist:b920ff837c889fee9bff
Created May 27, 2015 00:12
Getting URL Parameters
function campaignParams() {
var campaign_keywords = 'utm_source utm_medium utm_campaign utm_content utm_term'.split(' ')
, kw = ''
, params = {}
, first_params = {} ;
var index;
for (index = 0; index < campaign_keywords.length; ++index) {
kw = getQueryParam(document.URL, campaign_keywords[index]);
if (kw.length) {
@kohiomobz
kohiomobz / first-time.objc
Created July 30, 2015 19:43
First App Launch
// Let’s check if we have a firstLaunch property inside NS Standard Defaults - if not, let’s set first app launch to YES
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]){
NSDictionary *appLaunchProperties = @{@"first app launch" : @YES};
[[Mixpanel sharedInstance] track:@"App Launched" properties:appLaunchProperties];
[[Mixpanel sharedInstance] registerSuperProperties:appLaunchProperties];
[[Mixpanel sharedInstance].people set:@{@"First App Launch": [NSDate date]}];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLaunch"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/css/reset.css">
<link rel="stylesheet" type="text/css" href="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.css">
<script src="https://cdn.mxpnl.com/libs/mixpanel-platform/build/mixpanel-platform.v0.latest.min.js"></script>
</head>
<body class="mixpanel-platform-body">
<div id="table"></div>