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 Tracking Proxy Demo</title> | |
<script type="text/javascript"> | |
/** | |
* Configuration Variables - CHANGE THESE! | |
*/ | |
const MIXPANEL_PROJECT_TOKEN = YOUR_MIXPANEL_PROJECT_TOKEN; // e.g. "67e8bfdec29d84ab2d36ae18c57b8535" | |
const MIXPANEL_PROXY_DOMAIN = YOUR_PROXY_DOMAIN; // e.g. "https://proxy-eoca2pin3q-uc.a.run.app" | |
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
inverse = { | |
'+': '-', | |
'-': '+', | |
'*': '/', | |
'/': '*', | |
} | |
d = {} | |
with open('21.txt', 'r') as 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
from datetime import date | |
from io import TextIOWrapper | |
import gzip | |
import json | |
import random | |
import time | |
import urllib.parse | |
import os | |
import boto3 |
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
from collections import OrderedDict, namedtuple | |
Node = namedtuple('Node', ['value', 'children']) | |
def top_sort(root): | |
visited = OrderedDict() | |
def helper(node): | |
if node.value not in visited: | |
map(helper, node.children) | |
visited[node.value] = 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
DatePicker = Backbone.View.extend({ | |
// ... | |
events: { | |
'click .date': function(e) { | |
// calculate new daterange | |
// ... | |
this.trigger('daterange-selected', daterange); | |
} |
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
Orchestrator = Backbone.View.extend({ | |
// ... | |
render: function() { | |
// render subviews datePicker, graphSelector, etc. | |
// ... | |
this.listenTo(this.model, 'data-updated', function(data) { | |
this.tableWidget.update(data); | |
}); |
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
%parse_param {references} | |
expr: literal { return $1 } | |
| expr "[" expr "]" { return Index($1, $3) } | |
| expr "and" expr { return And($1, $3) } | |
| expr "==" expr { return Equals($1, $3) } | |
| expr ">" expr { return GreaterThan($1, $3) } | |
| "properties" { return Property() } | |
| "any" "(" expr "," expr ")" { return Any($3, $5) } | |
| "item" { return Item() } |
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 Index(object): | |
def resolve(self, item_ref, property_bindings, item_bindings): | |
lhs = self.left_side | |
rhs = self.right_side | |
if isinstance(rhs, Literal): | |
if isinstance(lhs, Item): | |
self.reference = item_bindings.make_reference(rhs.evaluate()) | |
if isinstance(lhs, Property): | |
self.reference = property_bindings.make_reference(lhs.evaluate()) | |
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
# For the query | |
# properties["artist"] == "Ziggy Stardust" and properties["years_active"] < 5 | |
bindings = ReferenceBindings() | |
# make() creates an unbound reference, and remembers its name | |
artist = bindings.make("artist") | |
years_active = bindings.make("years_active") | |
# the parse node just has the reference | |
expr = And( |
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
# For the query | |
# properties["artist"] == "Ziggy Stardust" and properties["years_active"] < 5 | |
bindings = ReferenceBindings() | |
# make() creates an unbound reference, and remembers its name | |
artist = bindings.make("artist") | |
years_active = bindings.make("years_active") | |
# the parse node just has the reference | |
expr = And( |
NewerOlder