Skip to content

Instantly share code, notes, and snippets.

View gladimdim's full-sized avatar
💭
Unreal Engine

Dmytro Gladkyi gladimdim

💭
Unreal Engine
View GitHub Profile
async function initializeClient() {
const client = await ZoomdataSDK.createClient({
credentials: {
key: "KVKWiD8kUl"
},
application: {
secure: true,
host: "developer.zoomdata.com",
port: 443,
path: "/zoomdata-2.6"
@gladimdim
gladimdim / oldconverter.js
Created December 18, 2017 11:47
Old version of JS converter
function transformToCount20(metric) {
var countMetric20 = {};
if (metric) {
_.set(countMetric20, 'type', 'COUNT');
if (_.has(metric, 'label')) {
_.set(countMetric20, 'label', metric.label);
}
return metric.name === 'count' ? countMetric20 : metric;
@gladimdim
gladimdim / metric_types.re
Created December 18, 2017 11:51
Type definitions for two metrics
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
@gladimdim
gladimdim / constructors_metrics.re
Created December 18, 2017 11:57
Constructors for two metric types
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
let createCountWithLabel = (label: string) : metricWithLabel => {type_: "COUNT", label};
let countMetric: metricCount = {type_: "COUNT"};
@gladimdim
gladimdim / decoding_json.re
Last active December 18, 2017 12:04
Decoding JSON maybe undefined properties
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
let createCountWithLabel = (label: string) : metricWithLabel => {type_: "COUNT", label};
let countMetric: metricCount = {type_: "COUNT"};
@gladimdim
gladimdim / switch_code.re
Created December 18, 2017 12:12
Switch statement for optional
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
let createCountWithLabel = (label: string) : metricWithLabel => {type_: "COUNT", label};
let countMetric: metricCount = {type_: "COUNT"};
@gladimdim
gladimdim / reason_records_version.re
Created December 18, 2017 12:27
Reason Records
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
let createCountWithLabel = (label) : metricWithLabel => {type_: "COUNT", label};
type metric =
@gladimdim
gladimdim / Compiled_to_JS_reason_records.js
Created December 18, 2017 12:29
Compiled to JS reason records
// Generated by BUCKLESCRIPT VERSION 2.1.0, PLEASE EDIT WITH CARE
'use strict';
var Block = require("bs-platform/lib/js/block.js");
var Json_decode = require("bs-json/src/Json_decode.js");
function createCountWithLabel(label) {
return /* record */[
/* type_ */"COUNT",
/* label */label
@gladimdim
gladimdim / reason_encode_json.re
Created December 18, 2017 12:36
Encode Reason records back into JSON
module MetricEncoder = {
let encodeCountMetricWithLabel = (m: metricWithLabel) =>
Json.Encode.(object_([("type", string(m.type_)), ("label", string(m.label))]));
let encodeCountMetric = (m: metricCount) => Json.Encode.(object_([("type", string(m.type_))]));
};
@gladimdim
gladimdim / QueryReason.re
Created December 18, 2017 12:37
FInal version of converting function
type metricCount = {type_: string};
type metricWithLabel = {
type_: string,
label: string
};
let createCountWithLabel = (label) : metricWithLabel => {type_: "COUNT", label};
let countMetric: metricCount = {type_: "COUNT"};