Skip to content

Instantly share code, notes, and snippets.

View sujinleeme's full-sized avatar
🎯
Focusing

Sujin Lee sujinleeme

🎯
Focusing
View GitHub Profile
@sujinleeme
sujinleeme / sample-commit-msg
Created March 30, 2018 16:47
commit message sample
feat: Summarize changes in around 50 characters or less
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.
Explain the problem that this commit is solving. Focus on why you
@sujinleeme
sujinleeme / README.md
Last active May 21, 2019 12:20
Convert a JSON's file tree structure

Convert a JSON's file tree structure

If you want to make the tree command available on mac OS X, run brew install tree.

Simply, change BASE_DIR and OUTPUT_JSON_FILENAME. Run convert-file-tree-json.py.

You can use the tree command which lists a directory structure recursively.

e.g)

@sujinleeme
sujinleeme / README.md
Last active July 9, 2024 03:01
Get street Geojson using Openstreet's Nominaim API

Get Street Geojson using Openstreet's Nominaim API

  1. Update street names in all-streets.txt.
  2. Update your COUNTRY_CODE = 'sg' in geojson_generator.py.
  3. Run geojson_generator.py
  4. Check *.csv and geojson.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.

@sujinleeme
sujinleeme / README.md
Last active May 27, 2019 14:48
Find the nearest coordinate from a set of geographical coordinates using haversine

Find the nearest coordinate from a set of geographical coordinates using haversine

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++) {
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]))
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 };
@sujinleeme
sujinleeme / react-testing-library--renderWithRedux.md
Created November 26, 2020 22:16 — forked from fleepgeek/react-testing-library--renderWithRedux.md
An Improvement to renderWithRedux helper function to enable rerender

Basic Implmentation

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;
@sujinleeme
sujinleeme / useRect.tsx
Last active March 21, 2024 15:27 — forked from morajabi/useRect.js
useRect — getBoundingClientRect() React Hook with resize handler (TypeScript)
// 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;