Skip to content

Instantly share code, notes, and snippets.

@avivshafir
avivshafir / print_board.js
Created May 26, 2020 22:46
printing two dimensional board
let ROWS = 6;
let COLS = 6;
class Board {
constructor(props) {
this.cells = [];
for (let i = 0; i < ROWS; i++) {
for (let j = 0; j < COLS; j++) {
if (!this.cells[i]) {
this.cells[i] = [];
class MenuItem {
constructor(menuItems = []) {
this.menuItems = menuItems;
this.isVisible = false;
}
onClick = () => {
// if (this.menuItems.length !== 0) { //menu has no children -> run action
// //run action function
// } else {
@avivshafir
avivshafir / api-docs-service.js
Created June 22, 2020 18:02
API v4 Docs Service
const express = require('express');
const path = require('path');
const swaggerCombine = require('swagger-combine');
const config = {
swagger: '2.0',
info: {
title: 'v4 API',
version: {
{
swagger: "2.0",
info: {
title: "ClimaCell v4 API",
version: "1.0.0"
},
paths: {
/locations/{locationId}: {
get: {
description: "Returns an location based on a single ID",
https://gist.github.com/e16bb804d2bc9a95a4a9c0e2efe15024
let counter = 1;
function doInDelay(counterRecieved) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (counter > counterRecieved) {
return;
}
resolve("Hi") //do filter
}, 2000)