Skip to content

Instantly share code, notes, and snippets.

export class OneRepMaxCalculator {
private readonly weight: number
private readonly repetitions: number
private readonly smallestPlate: number
constructor(weight: number, repetitions: number, smallestPlate: number = 5) {
this.weight = weight
this.repetitions = repetitions
this.smallestPlate = smallestPlate
}
test
@bali182
bali182 / setup-js-project.md
Last active May 10, 2017 14:38
Setup js project

Basics

  • node
  • npm
  • IDE - VSCode
  • command line

Init project

  • npm init
  • npm install --save-dev webpack webpack-dev-server
[
{ "key": "cmd+shift+f", "command": "editor.action.format", "when": "editorTextFocus" },
{ "key": "cmd+alt+down", "command": "editor.action.copyLinesDownAction", "when": "editorTextFocus" },
{ "key": "cmd+alt+up", "command": "editor.action.copyLinesUpAction", "when": "editorTextFocus" },
{ "key": "alt+down", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus" },
{ "key": "alt+up", "command": "editor.action.moveLinesUpAction", "when": "editorTextFocus" },
{ "key": "cmd+d", "command": "editor.action.deleteLines", "when": "editorTextFocus" },
{ "key": "alt+shift+r", "command": "editor.action.rename", "when": "editorTextFocus" },
{ "key": "ctrl+space", "command": "editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "f3", "command": "editor.action.goToDeclaration", "when": "editorTextFocus" },
/// <reference path="react.d.ts"/>
declare module "react-responsive-grid" {
import {Component} from 'react'
import * as React from 'react'
interface ContainerProps {
children?: any
style?: Object
}
@bali182
bali182 / labyrinth.js
Created May 3, 2016 18:34
Labyrinth solution
"use strict";
function labyrinth(matrix) {
const rows = matrix.length, cols = matrix[0].length; // lets assume, that rows have the same length
const seen = new Array(rows).fill(1).map(_ => new Array(cols).fill(false)); // temp matrix of the same size as the input
function recursiveSolve(x, y) {
if (x === rows - 1 && y === cols - 1) return true; // we reached bottom right
if (matrix[x][y] !== 0 || seen[x][y]) return false; // no path :(
seen[x][y] = true;
return (x !== 0 && recursiveSolve(x - 1, y)) // left
[
{ "key": "ctrl+shift+f", "command": "editor.action.format", "when": "editorTextFocus" },
{ "key": "ctrl+alt+down", "command": "editor.action.copyLinesDownAction", "when": "editorTextFocus" },
{ "key": "ctrl+alt+up", "command": "editor.action.copyLinesUpAction", "when": "editorTextFocus" },
{ "key": "alt+down", "command": "editor.action.moveLinesDownAction", "when": "editorTextFocus" },
{ "key": "alt+up", "command": "editor.action.moveLinesUpAction", "when": "editorTextFocus" },
{ "key": "ctrl+d", "command": "editor.action.deleteLines", "when": "editorTextFocus" },
{ "key": "alt+shift+r", "command": "editor.action.rename", "when": "editorTextFocus" },
{ "key": "ctrl+space", "command": "editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "f3", "command": "editor.action.goToDeclaration", "when": "editorTextFocus" },