Skip to content

Instantly share code, notes, and snippets.

@maxp-edcast
maxp-edcast / example.csv
Last active April 19, 2019 02:11
DEBUG CSV
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 62 columns, instead of 13. in line 1.
time,_card_id,_user_id,analytics_version,assigned_to_user_id,attributes,average_rating,card_author_full_name,card_author_id,card_bookmark_id,card_duration,card_id,card_level,card_rating,card_resource_url,card_state,card_subtype,card_title,card_type,changed_column,channel_id,channel_name,comment_id,comment_message,comment_type,ecl_id,ecl_source_name,event,event_recorder,is_admin_request,is_card_promoted,is_channel_curated,is_channel_featured,is_channel_public,is_correct,is_live_stream,is_public,is_system_generated,is_user_generated,journey_id,journey_name,new_val,old_val,org_hostname,org_id,org_name,pathway_id,pathway_name,pin_id,platform,platform_version_number,poll_option_id,poll_option_label,quiz_option_id,quiz_option_label,readable_card_type,shared_to_user_id,team_id,user_agent,user_full_name,user_handle,user_id
2019-04-19T01:44:05.408710236Z,3554232,115112,2.0.0,4,SOME USER,112319,0,3554232,https://www.youtube.com/watch?v=5FUdrBq-WFo,published,video,Selenium Tutorial For Beginners | What Is Selenium? | Se
@maxp-edcast
maxp-edcast / events_timeline_prod.txt
Last active March 21, 2019 19:26
events timeline (3/21/19)
1970-01-01 - card_added_to_channel
2015-12-03 - channel_followed
2015-12-03 - user_followed
2016-01-06 - user_unfollowed
2016-04-06 - group_user_added
2016-09-02 - card_assigned
2016-12-06 - channel_created
2016-12-23 - channel_unfollowed
2017-01-03 - group_created
2017-01-04 - card_added_to_pathway
@maxp-edcast
maxp-edcast / main.go
Last active October 29, 2018 23:12
mocked instance method in golang
package main
import "fmt"
type myType struct {
fn func(int) int
}
func main () {
inst := myType{fn: func(i int) int { return i }}
@maxp-edcast
maxp-edcast / query
Last active August 10, 2018 21:21
query
(
SELECT
SUM(smartbites_created_count) AS smartbites_created,
SUM(smartbites_consumed_count) AS smartbites_consumed,
AVG(user_metrics_aggregations.time_spent_minutes) AS average_session,
COUNT(DISTINCT(teams_users.user_id)) AS total_users,
teams.id AS team_id,
COUNT(DISTINCT(teams_users.user_id)) AS active_users,
COUNT(DISTINCT(teams_users.user_id)) AS new_users
FROM user_metrics_aggregations
SELECT
'' AS smartbites_created,
'' AS smartbites_consumed,
'' AS average_session,
'' AS total_users,
teams.id AS team_id,
COUNT(DISTINCT(teams_users.user_id)) AS active_users
FROM user_metrics_aggregations
INNER JOIN users ON users.id = user_metrics_aggregations.user_id
INNER JOIN teams_users ON teams_users.user_id = users.id
@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>...]
class A
def a(arg)
b(c(arg))
end
def b(arg)
do_expensive_thing(arg)
end
def c(arg)
using Fluent;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class RobotDialog : FluentScript
{
public override FluentNode Create()
@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,