Skip to content

Instantly share code, notes, and snippets.

View Seunghyum's full-sized avatar
🎯
Focusing

Dave Moon (문승현) Seunghyum

🎯
Focusing
  • Grip Company
  • South Korea
View GitHub Profile
@Seunghyum
Seunghyum / price.test.js
Last active November 30, 2023 02:00
툴팁 내 텍스트 정규화 테스트 코드
import { prettifyFloat, prettifyNumbers } from "./number"
import { describe, expect, test } from "@jest/globals"
describe("prettifyFloat Function Util Test", () => {
test("0.01 & demical point 1 to Equal '0.01'", () => {
expect(prettifyFloat(0.01)).toBe("0.01")
})
test("1.0001 & demical point 1 to Equal '1.0'", () => {
@Seunghyum
Seunghyum / deep_copy.js
Created March 22, 2021 14:12
deep copy 방법
const targetObj = {
id:1,
name: 'seunghyun'
}
// 1
const obj = JSON.parse(JSON.stringfy(targetObj))
// 2
function structuralClone(obj) {
import React, { useEffect, useState, useRef } from 'react';
import useWhenVisible from './useWhenVisible';
const TodoList = () => {
const limit = 25;
const [offset, setOffset] = useState(0);
const [todos, setTodos] = useState([]);
const lastEl = useRef();
useEffect(() => {
@Seunghyum
Seunghyum / convertToArray.js
Created August 13, 2020 04:10
Convert a Number to an Array of Digits
const convertToArray = number => [...`number`].map(el => parseInt(el))
convertToArray(5678) // [5,6,7,8]
@Seunghyum
Seunghyum / cloudSettings
Last active May 9, 2021 05:47
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-05-09T05:47:26.497Z","extensionVersion":"v3.4.3"}
@Seunghyum
Seunghyum / README-Template.md
Created March 14, 2019 03:12 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@Seunghyum
Seunghyum / mongodb_explain.json
Created December 5, 2016 07:38
몽고 쉘에서 db.news.find({"byline":{"$ne":[]}, "provider_code":"02100501"}).explain() 했을 때 나오는 결과값
> db.news.find({"byline":{"$ne":[]}, "provider_code":"02100501"}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "newstrust.news",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"provider_code" : {
@Seunghyum
Seunghyum / mongodb_explain.json
Created December 5, 2016 07:38
몽고 쉘에서 db.news.find({"byline":{"$ne":[]}, "provider_code":"02100501"}).explain() 했을 때 나오는 결과값
> db.news.find({"byline":{"$ne":[]}, "provider_code":"02100501"}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "newstrust.news",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"provider_code" : {
@Seunghyum
Seunghyum / DashboardController.js
Created October 22, 2016 02:55
sails Promise - DashboardController.js
findReports: function(req, res) {
Report.find()
.populateAll()
.then((reports) => {
return Promise.all(reports.map((report) => {
if (report.post) {
var reportUser = report.post.user
} else {
var reportUser = report.comment.user
}
@Seunghyum
Seunghyum / anything_controller.rb
Created October 21, 2016 16:29
flash message - anything_controller.rb
def index
flash[:danger] = "다른 사람이 이미 가져갔습니다."
end