cd /etc/udev/rules.d
sudo wget https://raw.githubusercontent.com/Yubico/libu2f-host/master/70-u2f.rules
sudo udevadm control --reload
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); |
/** | |
* 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. |
/** | |
* 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. |
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): |
static get observedAttributes() { | |
return ['height', 'width']; | |
} | |
get height() { | |
return this.hasAttribute('height') && Number(this.getAttribute('height').replace('px', '')); | |
} | |
set height(val) { | |
if (val) { |
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: [email protected]
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 |