Skip to content

Instantly share code, notes, and snippets.

@timtamimi
timtamimi / sequelize-paginate.js
Created March 8, 2021 08:29
Helper for paginating queries in Sequelize
// Helper function 👇
const paginate = (query, { page, pageSize }) => {
const offset = page * pageSize;
const limit = pageSize;
return {
...query,
offset,
limit,
};
@timtamimi
timtamimi / index.js
Created January 28, 2020 13:55
Sentiment analysis script
let fs = require("fs");
const csv = require("csv-parser");
var Sentiment = require("sentiment");
var sentiment = new Sentiment();
require("dotenv").config();
const { CanvasRenderService } = require("chartjs-node-canvas");
const percentile = require("stats-percentile");
let output = [];
@timtamimi
timtamimi / README.md
Last active August 29, 2015 14:13 — forked from mbostock/.block
Reingold-Tilford Tree from CSV (D3)

Reingold–Tilford tree. Pulls from CSV file rather than JSON. Click on the nodes to expand or collapse.

Uses bits of d3 code copied from all over the place. No copyright infringement intended. All bits and bobs copied were open source, to my knowledge.