Skip to content

Instantly share code, notes, and snippets.

View dir01's full-sized avatar

Andrew Zhukovskiy dir01

  • Tel Aviv, Israel
View GitHub Profile
const flatten = <T>(arr: T[][]): T[] => ([] as T[]).concat(...arr);
test("flatten", () => {
expect(flatten([[1], [2], [3, 4]])).toEqual([1, 2, 3, 4]);
});
@dir01
dir01 / Dockerfile
Last active May 15, 2019 09:07
[email protected] bug reproduction
FROM node:10.14
RUN mkdir /app
WORKDIR /app
RUN npm install [email protected]
COPY ./index.js .
CMD node ./index.js
@dir01
dir01 / circularQueue.spec.js
Created November 26, 2019 22:28
Ring buffer implementation
class CircularQueue {
constructor(size) {
this.size = size;
this.storage = Array.from(new Array(size));
Object.seal(this.storage);
this.head = -1;
this.tail = -1;
}
queue(value) {