Skip to content

Instantly share code, notes, and snippets.

View zaneclaes's full-sized avatar

Zane Claes zaneclaes

View GitHub Profile
<?php
class GAN {
function __construct($id) {
$this->id = $id;
}
protected function gaParseCookie() {
if (isset($_COOKIE['_ga'])) {
list($version,$domainDepth, $cid1, $cid2) = preg_split('[\.]', $_COOKIE["_ga"],4);
$contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2);
<?php
// SET UP THESE VARIABLES;
$GOOGLE_ANALYTICS_ID = '';
$IOS_STORE_URL = '';
$PATH_TO_GOOGLE_ANALYTICS_FILE = '';// This is where the Google Analytics Helper Script is located
function loadGAN($id = null) {
global $gan, $PATH_TO_GOOGLE_ANALYTICS_FILE;
if($gan) {
return $gan;
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
@zaneclaes
zaneclaes / coordinate.swift
Last active November 18, 2016 13:20
Coordinate System in Swift
//
// Coordinate.swift
// ForeverMaze
//
// Created by Zane Claes on 1/18/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import Foundation
import SpriteKit
@zaneclaes
zaneclaes / DynamicObject.swift
Last active February 22, 2016 20:49
Automatically detect changes to an object in Swift
//
// GameStatic.swift
// ForeverMaze
//
// Created by Zane Claes on 11/20/15.
// Copyright © 2015 inZania LLC. All rights reserved.
//
import SpriteKit
import Firebase
@zaneclaes
zaneclaes / Analytics.swift
Created February 23, 2016 17:19
A basic Swift analytics class
//
// Analytics.swift
// ForeverMaze
//
// Created by Zane Claes on 2/7/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import Foundation
//
// Animation.swift
// ForeverMaze
//
// Created by Zane Claes on 1/18/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import SpriteKit
import PromiseKit
//
// Direction.swift
// ForeverMaze
//
// Created by Zane Claes on 1/18/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import Foundation
@zaneclaes
zaneclaes / MapSpawner.cs
Created March 20, 2016 19:26
Tiled Map Spawner
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using IsoTools.Tiled;
using IsoTools.Internal;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
WorldObjectNetworkObject wno = NetworkManager.Instance.WorldObjectNetworkObject.GetComponent<WorldObjectBehavior> ().networkObject;
// None of these fire:
wno.pendingInitialized += delegate(INetworkBehavior behavior, NetworkObject networkObject) {
Debug.Log ("[GLOBAL] PENDING initialized " + behavior);
};
wno.onReady += delegate {
Debug.Log ("[GLOBAL] onReady");
};
wno.readBinary += delegate(BeardedManStudios.BMSByte data) {