Skip to content

Instantly share code, notes, and snippets.

View seungha-kim's full-sized avatar

seungha-kim

View GitHub Profile
@seungha-kim
seungha-kim / GLSL-Noise.md
Created March 15, 2023 04:34 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@seungha-kim
seungha-kim / ee-svg.md
Last active May 17, 2021 03:31
EE draft - SVG

svg

svg 태그를 사용해서 SVG 문서를 HTML 문서 내에 삽입할 수 있다.

SVG는 Scalable Vector Graphic 의 약자로, 마크업 언어로 편하게 벡터 그래픽을 그릴 수 있게 해주는 포맷. XML 문서 포맷이 정의되어 있으나, 덜 엄격한 포맷인 HTML 안에 문제없이 삽입할 수 있다.

SVG 문서는 좌표계를...블라블라

width, height 로 크기 바꾸기

@seungha-kim
seungha-kim / linked_list.rs
Last active April 29, 2021 00:54
Simple doubly linked list written in unsafe Rust
use std::ptr::{null_mut};
struct Node<T> {
value: T,
prev_ptr: *mut Node<T>,
next_ptr: *mut Node<T>,
}
impl<T> Node<T> {
fn new(value: T) -> Self {
@seungha-kim
seungha-kim / MyOpenGLView.m
Created October 3, 2020 10:03
OpenGL ES 2.0 triangle on macOS using ANGLE
#import "MyOpenGLView.h"
#import <GLES2/gl2.h>
#import <GLES2/gl2ext.h>
#import <EGL/egl.h>
const GLchar vertexShaderSource[] =
"attribute vec3 aPosition;\n"
"void main() {\n"
" gl_Position = vec4(aPosition, 1.0);\n"
"}\n";
@seungha-kim
seungha-kim / kvstorage-1.md
Created March 24, 2019 15:33
KV Storage: 첫 번째 내장 모듈

(원문: https://developers.google.com/web/updates/2019/03/kv-storage#browser-support)

(현재 일부만 번역된 상태입니다.)

KV Storage: 첫 번째 내장 모듈

브라우저 제조사들과 웹 성능 전문가들은 근래에 localStorage의 느린 속도를 대체할 무언가가 필요하다, 웹 개발자들은 이것을 더 이상 사용하지 않는 것이 좋다고 지적해왔습니다.

이 말은 틀리지 않았습니다. localStorage는 메인 스레드를 멈추게 만드는 동기적(synchronous) API를 갖고 있으며, 여기에 접근함으로써 웹 페이지가 멈추는 현상을 겪게될 수 있습니다.

class Person {
name: string
age: number
constructor(name: string, age: number) {
this.name = name
this.age = age
}
}
@seungha-kim
seungha-kim / App.test.js
Created January 18, 2019 03:18 — forked from 505aaron/App.test.js
createPortal Mock for react-test-renderer
jest.mock('react-dom');
import React from 'react';
import { createPortal } from 'react-dom';
import renderer from 'react-test-renderer';
import ShallowRenderer from 'react-test-renderer/shallow';
import ReactDOM from 'react-dom';
class Drop extends React.Component {
constructor(props) {
@seungha-kim
seungha-kim / README.md
Last active June 13, 2020 16:49
create-react-app으로 생성된 프로젝트에 eslint, prettier 설정하기

ESLint

널리 사용되는 JavaScript linter로, 코드의 품질 - 잠재적 버그, 코딩 스타일 상 문제 - 을 검사해주는 도구.

공식 사이트 링크

Prettier

널리 사용되는 code formatter. 즉, 코드를 보기 좋고 일관적인 형태로 변환해주는 도구.

@seungha-kim
seungha-kim / README.md
Created November 7, 2018 09:39
댓글 추가가 제대로 되지 않는 문제의 원인과 해결책

_embed 쿼리 스트링이 제대로 동작하지 않는 문제

문제 관찰 결과 -

  1. POST /posts/1/comments 요청을 보내면 새로 생성되는 댓글 객체의 postId 속성에 문자열 '1'이 저장됩니다. (원래는 숫자 1이 저장되어야 함. 이는 json-server의 버그)
  2. 이렇게 관계를 나타내는 속성에 문자열이 저장되어 있을 경우, _embed가 제대로 동작하지 않는 것으로 보입니다.
  3. _embed를 쓰지 않고도 요청을 한 번 더 보내서, 필요한 데이터를 가져올 수는 있습니다. 하지만 부가적인 요청을 보내야 하므로 페이지 로딩 속도가 느려집니다.

해결책