Skip to content

Instantly share code, notes, and snippets.

View rzachariah's full-sized avatar

Ranjith Zachariah rzachariah

View GitHub Profile
const cities = ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris'];
const result = groupPermutations(cities);
console.log(result);
function groupPermutations(words) {
const map = words.reduce((acc, next) => {
sortedName = next.toLowerCase().split('').sort().join('');
var list = acc[sortedName];
@rzachariah
rzachariah / Dockerfile
Created October 10, 2016 19:40
sbt in a Dockerfile
FROM openjdk:8
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -qq update
# Install node
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
// Imagine we have an observable of key counts. Each message has a key and a count, like so
// {
// key: "SomeKey",
// count: 16
// }
// We use buffer to convert this to an observable of arrays of messages
// Now we want to reduce each array, keeping only the latest count for each key
var messages = getKeyCountsObservablefromSomewhere()
.buffer(function () { return Rx.Observable.timer(50); })