Skip to content

Instantly share code, notes, and snippets.

asdasdasddsvsd

@maxp-edcast
maxp-edcast / source.txt
Last active November 11, 2017 04:31
test.md
### AWS setup
#### General setup
1. Make sure python 2.7 is installed:
- `python --version`
2. Make sure pip is installed
- `brew install pip`
@maxp-edcast
maxp-edcast / subclass_through_module.rbb
Created January 17, 2018 05:21
subclass through module
module Subclass
def self.included(base)
base.const_set "Subclass", Class.new
end
end
class Foo
include Subclass
end
@maxp-edcast
maxp-edcast / notes.md
Last active February 26, 2018 17:31
User scores notes
tags: user_id=1028
time                total_user_score smartbites_commented_count smartbites_completed_count smartbites_created_count smartbites_consumed_count smartbites_liked_count total_smartbite_score time_spent_minutes
----                ---------------- -------------------------- -------------------------- ------------------------ ------------------------- ---------------------- --------------------- ------------------
1519603200000000000 4
@maxp-edcast
maxp-edcast / group_daily_scores_query.md
Last active March 9, 2018 05:25
group_daily_scores query

We have user_scores_daily created every day for every user. Each of these records has a _user_id tag and some numeric fields.

Each user belongs to multiple "groups" (i.e. teams).

We also want to get group_scores_daily, which containns the sum of user_scores_daily fields for all users in each group (per day).

We currently do this in a background job with Ruby. It runs every day and combines data using two separate Influx queries.

  1. We get a mapping of group_id => user_ids
@maxp-edcast
maxp-edcast / user_scores_daily_cq.md
Created March 9, 2018 01:55
user_scores_daily CQ

This is the continuous query we run to get daily aggregations of user_scores. There is a unique record produced per user per day.

SELECT
  MEAN(total_user_score) AS total_user_score,
  MEAN(smartbites_commented_count) AS smartbites_commented_count,
  MEAN(smartbites_completed_count) AS smartbites_completed_count,
  MEAN(smartbites_created_count) AS smartbites_created_count,
  MEAN(smartbites_consumed_count) AS smartbites_consumed_count,
  MEAN(smartbites_liked_count) AS smartbites_liked_count,
using Fluent;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class RobotDialog : FluentScript
{
public override FluentNode Create()
class A
def a(arg)
b(c(arg))
end
def b(arg)
do_expensive_thing(arg)
end
def c(arg)
@maxp-edcast
maxp-edcast / 1. main response
Last active July 10, 2018 22:36
/channels/:id/aggregated_metrics response format
[
{
"tags": {
"org_id": <org id>,
"channel_id": <channel id>,
"top_cards": [<top cards records>...],
"top_contributors": [<top contributors records>...],
"top_scoring_users: [<top scoring user records>...],
},
"values": [<channel aggregation records>...]