This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mozilla.javascript.Context; | |
import org.mozilla.javascript.Scriptable; | |
import org.mozilla.javascript.tools.shell.Global; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStreamReader; | |
class RequireJSOptimizer { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("/path/to/vendor/mixpanel/mixpanel-php/lib/Mixpanel.php"); // import the Mixpanel class | |
// get the Mixpanel singelton (will be created if it doesn't exist) | |
$mp = Mixpanel::getInstance("MIXPANEL_PROJECT_TOKEN"); | |
// this would likely come from a database or session variable | |
$user_id = 12345; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Mixpanel AMD Example - Sync</title> | |
<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.8/minified/require.js"></script> | |
<script type="text/javascript"> | |
requirejs.config({ | |
paths : { 'mixpanel': "//cdn.mxpnl.com/libs/mixpanel-2.2.min" }, | |
shim: { | |
'mixpanel': { | |
deps: ['mixpanel-preinit'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Mixpanel AMD Example - Async</title> | |
<script type="text/javascript" src="http://requirejs.org/docs/release/2.1.8/minified/require.js"></script> | |
<script type="text/javascript"> | |
requirejs.config({ | |
paths : { 'mixpanel-lib': "//cdn.mxpnl.com/libs/mixpanel-2.2.min" } | |
}); | |
define("mixpanel", function(require) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConcurrentUpdateException(Exception): | |
""" | |
Raised when a model can not be saved due to a concurrent update. | |
""" | |
class VersionedModel(models.Model): | |
_version = models.PositiveIntegerField(db_column='version', default=1) | |
def save(self, force_insert=False, force_update=False, using=None, update_fields=None): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<pthread.h> | |
pthread_key_t key; | |
struct args { | |
char *msg; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// mixpanel stub and initialization | |
(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" "); | |
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.myapp.app; | |
import android.content.Context; | |
import android.os.Handler; | |
import android.os.HandlerThread; | |
import android.os.Looper; | |
import android.os.Message; | |
import android.util.Log; | |
import org.json.JSONArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ActivityInfo[] getActivityList() throws PackageManager.NameNotFoundException { | |
return getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES).activities; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assuming you have already imported the Mixpanel PHP library | |
$mp = Mixpanel::getInstance("MIXPANEL_PROJECT_TOKEN"); | |
// register every utm parameter as a super property | |
foreach($_GET as $param => $param_val) { | |
if (strstr($param, 'utm_') === 0) { | |
$mp->register($param, $param_val); | |
} | |
} |
OlderNewer