JSFiddle - React, Tailwind, and code Playground

by Luis Fraguada

JavaScript

//Parse function string and convert it to real javascript function...
if (typeof String.prototype.parseFunction != 'function') {
    String.prototype.parseFunction = function () {
		var funcReg = /function *\(([^()]*)\)[ \n\t]*{(.*)}/gmi;
		var match = funcReg.exec(this.replace(/\n/g, ' '));
		if(match) {
            return new Function(match[1].split(','), match[2]);
		}

    	return null;
    };
}

$(document).ready(function() {
    var func = "function report(l){(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');ga('create','UA-67064346-1','auto');ga('set','appName','IrisWebApp');ga('set','appId','com.mcneel.app');ga('set','appVersion','0.3.4.2');ga('send','pageview');ga('send','screenview',{'appName':'IrisWebApp','screenName':window.location.href});ga('send','event','loaded','running', 'objects', l);}".parseFunction();
    
func(100);

});