git config --global --add --bool push.autoSetupRemote true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rob Pike's 5 Rules of Programming | |
Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is. | |
Rule 2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest. | |
Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.) | |
Rule 4. Fancy algorithms are buggier than simple ones, and they're much harder to implement. Use simple algorithms as well as simple data structures. | |
Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming. | |
Pike's rules 1 and 2 restate Tony Hoare's famous maxim "Premature |
There are two exercises in this document that are expected to be completed.
The source-code for each exercise should live in a separate repository, Github or GitLab, and should be accessible to the reviewer of the assignment. Each repository should contain a README file explaining the purpose of the repository and how to run it locally.
For each exercise you are free to use whatever libraries and technologies you like, but a combination of Javascript/Typescript/React is preferred for the first exercise, and Nodejs/PHP for the second.
Please do your best to write production-quality code.
Once completed, links to both of the repositories should be sent to: insert@email.here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static get observedAttributes() { | |
return ['height', 'width']; | |
} | |
get height() { | |
return this.hasAttribute('height') && Number(this.getAttribute('height').replace('px', '')); | |
} | |
set height(val) { | |
if (val) { |
- Explain the Game of life rules to the candidate, make sure they understand it.
- Walk through the program and its various parts with the candidate. Have the candidate read the code and explain what it does.
- Explain to the candidate to treat this as a regular code review where they are allowed to ask questions to clarify code/logic and that they should aim to make suggestions for how this code can be improved/refactored.
- Candidate should be able to read and explain each section of the code.
- Candidate should be able to highlight parts of the code that is not considered good practice, e.g. code-smells, anti-patterns.
- Candidate should suggest places for validations in the code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CELL_ALIVE_CHAR = '*' | |
CELL_DEAD_CHAR = '.' | |
class Location: | |
def __init__(self, row_index, col_index): | |
self.row = row_index | |
self.col = col_index | |
class Cell: | |
def __init__(self, state): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Conway's Game of Life | |
* | |
* The world of the Game of Life is an infinite two-dimensional orthogonal grid of square | |
* "cells", each of which is in one of two possible states, alive or dead. | |
* | |
* Rules: | |
* 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation. | |
* 2. Any live cell with two or three live neighbours lives on to the next generation. | |
* 3. Any live cell with more than three live neighbours dies, as if by overpopulation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Conway's Game of Life | |
* | |
* The world of the Game of Life is an infinite two-dimensional orthogonal grid of square | |
* "cells", each of which is in one of two possible states, alive or dead. | |
* | |
* Rules: | |
* 1. Any live cell with fewer than two live neighbours dies, as if by underpopulation. | |
* 2. Any live cell with two or three live neighbours lives on to the next generation. | |
* 3. Any live cell with more than three live neighbours dies, as if by overpopulation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
import { debounce } from 'lodash'; | |
/** | |
* React Hook that returns an index for the right-most element that is horizontally | |
* visible within the boundaries of the container. | |
*/ | |
function useVisibleElementsIndex(containerRef, items) { | |
const [visibleElementsIndex, setVisibleElementsIndex] = useState(0); |
NewerOlder