Skip to content

Instantly share code, notes, and snippets.

@brightchul
brightchul / keybindings.json
Created July 20, 2023 02:05
enter the curren project root path in terminal
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+j",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "cd ${workspaceFolder}\u000D"
},
"when": "terminalFocus && !findInputFocussed && !renameInputFocussed"
}
@brightchul
brightchul / chatsSlice.ts
Created December 6, 2022 07:30 — forked from markerikson/chatsSlice.ts
Nested `createEntityAdapter` example
// Example of using multiple / nested `createEntityAdapter` calls within a single Redux Toolkit slice
interface Message {
id: string;
roomId: string;
text: string;
timestamp: string;
username: string;
}
@brightchul
brightchul / CalcHomework.kt
Created June 4, 2022 11:55
1주차 과제 제출 합니다.
class CalcHomework {
private val trimRegex: Regex = """[^.\d-+*\(\)/]""".toRegex()
private val splitRegex: Regex = """[\-]*[.\d]+|[\+\-\*\/\(\)]""".toRegex()
private val getSingleMinusBeforeNumberRegex = """(?<=\d)\-(?=\d)""".toRegex()
private val getMinusOperatorBeforeBracketRegex = """(?<=\/|/*)[\/\*]\-(?=\()""".toRegex()
private fun trim(v: String): String = v.replace(trimRegex, "")
private fun replaceMinusToPlusMinus(v: String) = v.replace(getSingleMinusBeforeNumberRegex, "+-")
private fun replaceMinusOperationToMinusOneOperation(v: String): String = v.replace(getMinusOperatorBeforeBracketRegex) {
val (_, operator, sign) = it.value.split("")
@brightchul
brightchul / gist:aad7e7c6aa8a9f67397adfda518a7714
Created May 4, 2022 14:58 — forked from subicura/gist:8329759
유명 서비스들의 API Response 분석
@brightchul
brightchul / gen.js
Created February 22, 2022 07:14 — forked from cgiosy/gen.js
const fs = require('fs');
const filenum = 30; // or 100
const lines = 2000000; // or 1000000
const errors = 100000;
const ratio = lines / errors | 0;
const count = lines / ratio | 0;
for (let i = 1; i <= filenum; i += 1) {
@brightchul
brightchul / mov2gif.sh
Last active November 30, 2020 05:11
mov2gif.sh
#!/bin/bash
# By: Hua Liang [Stupid ET]
# Website: http://EverET.org
# sh mov2gif.sh adf.mov something.fig
# brew install ffmpeg image2pipe gifsicle
mov_file=$1
gif_file=$2
ffmpeg -i $mov_file -r 10 -f image2pipe -vcodec ppm - | convert -verbose +dither -layers Optimize -resize 640x640\> - gif:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile -> $gif_file
@brightchul
brightchul / dragstop.css
Created August 16, 2020 22:46
이미지 드래그 막기
img {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
export default {
get: function (url, data) {
return fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
@brightchul
brightchul / aaa.html
Created August 3, 2020 04:18
참고용 코드
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.line-graph-conponent {
width: 100%;
display: flex;
@brightchul
brightchul / index.html
Created July 16, 2020 00:56
마우스 드래그 이벤트
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.parent {
display: flex;
}