Skip to content

Instantly share code, notes, and snippets.

Tag Recommendation

Context

Given a list of events, including pageview and search events, recommend tags to add to each page based on search terms. In addition, take 30-minute session into consideration.

Challenge

Set up a small project to take inputs and output the recommendations. Besides, set up tests to make sure it works correctly.

@malikid
malikid / sequelizeRequiredNote.js
Created November 22, 2017 18:41
Notes for ORM Sequelize - required field while joining tables
// required: true - Sequelize Code
test = (guideId) => this.Manual.findAll({
include: [
{model: this.Topic, required: true, include: [
{model: this.Guide, where: {id: guideId}}
]}
]
});
// required: true - Interpreted SQL (Modified for being readable)
SELECT "manual".*, "topics".*, "topics->guides".*
@malikid
malikid / sequelizeJoinNote.js
Created November 22, 2017 18:34
Notes for ORM Sequelize - findOne/findAll while joining more than two tables
/*************************************************
* findAll VS findOne (Wrong!!! Not as expected) *
*************************************************/
// findAll - Sequelize Code
test = (guideId) => this.Manual.findAll({
include: [
{model: this.Topic, required: true, include: [
{model: this.Guide, where: {id: guideId}}
]}
]
@malikid
malikid / StockMaintenance.vb
Created March 5, 2017 13:26
A stock maintenance macro I coded for a friend in vba.
Const NOT_FOUND = -1
Sub Auto_Open()
Call StockMaintenance
End Sub
Sub StockMaintenance()
Const PRODUCTS_INTERVAL_ROWS = 19
Const STOCK_RELATIVE_ROW = 11
Const PRODUCTION_NAME_COLUMN = 2
@malikid
malikid / gist:42b83c57356d7b12190e
Created October 18, 2014 04:09
My Custom StackEdit Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= documentTitle %></title>
<link rel="stylesheet" href="https://stackedit.io/res-min/themes/base.css" />
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
<script src='https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian'/>
<style>
pre.prettyprint {
@malikid
malikid / gist:c97ff0be2f5b3077f064
Created October 18, 2014 04:05
StackEdit default template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= documentTitle %></title>
<link rel="stylesheet" href="https://stackedit.io/res-min/themes/base.css" />
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body><div class="container"><%= documentHTML %></div></body>
</html>
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0