function renderWithRedux(ui, { initialState, store = createStore(rootReducer, initialState) } = {}, renderFn = render) {
const obj = {
...renderFn(<Provider store={store}>{ui}</Provider>),
store,
};
obj.rerenderWithRedux = (el) => renderWithRedux(el, { store }, obj.rerender);
return obj;
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"; | |
interface Dimensions { | |
width: number | null; | |
height: number | null; | |
} | |
export const useWindowDimensions = (): Dimensions => { | |
const hasWindow = typeof window !== "undefined"; |
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
// mock file | |
function MockFile() { }; | |
MockFile.prototype.create = function (name, size, mimeType) { | |
name = name || "mock.txt"; | |
size = size || 1024; | |
mimeType = mimeType || 'plain/txt'; | |
function range(count) { | |
var output = ""; |
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
{ | |
"type":"object", | |
"require": true, | |
"patternProperties":{ | |
"[A-Za-z:0-9]":{ | |
"type":"object", | |
"additionalProperties":false, | |
"required":[ | |
"time", | |
"timestamp", |
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
// Require to install a package from npm with ResizeObserver typings. | |
// yarn --dev @types/resize-observer-browser | |
import { useCallback, useLayoutEffect, useRef, useState } from "react"; | |
import ResizeObserver from 'resize-observer-polyfill' | |
type RectResult = { | |
bottom: number; | |
height: number; | |
left: number; |
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 { RefObject, useEffect } from 'react'; | |
const MOUSEDOWN = 'mousedown'; | |
const TOUCHSTART = 'touchstart'; | |
type HandledEvents = [typeof MOUSEDOWN, typeof TOUCHSTART]; | |
interface UseOnClickOutsideProps { | |
innerRef: RefObject<HTMLElement>; | |
outerRef?: RefObject<HTMLElement> | { current: HTMLDocument }; |
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
const hiddenNumNeurons = 20 | |
const hidden2NumNeurons = 5 | |
const learningRate = 0.01 | |
const num_iterations = 100 | |
const batch_size = 20 | |
const weights = tf.variable(tf.randomNormal([2, hiddenNumNeurons])) | |
const biases = tf.variable(tf.zeros([hiddenNumNeurons])) | |
const weights2 = tf.variable(tf.randomNormal([hiddenNumNeurons, hidden2NumNeurons])) |
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
class Minesweeper { | |
constructor(cols, rows, mines) { | |
this.cols = cols | |
this.rows = rows | |
this.mines = mines | |
} | |
drawGrid() { | |
let grid = [] | |
for (let i = 0; i < this.rows; i++) { |
- Update street names in
all-streets.txt
. - Update your
COUNTRY_CODE = 'sg'
ingeojson_generator.py
. - Run
geojson_generator.py
- Check
*.csv
andgeojson.json
file.
Nominatim is a search engine for OpenStreetMap data. This is the debugging interface. You may search for a name or address (forward search) or look up data by its geographic coordinate (reverse search). Each result comes with a link to a details page where you can inspect what data about the object is saved in the database and investigate how the address of the object has been computed. To enhance understand of Nominatim, recommend to visit https://nominatim.openstreetmap.org/ and play for a while.
NewerOlder