Skip to content

Instantly share code, notes, and snippets.

View kyh196201's full-sized avatar
🐣
Hi

Seungwoo Kim kyh196201

🐣
Hi
View GitHub Profile
@odewahn
odewahn / error-handling-with-fetch.md
Last active November 3, 2025 07:54
Processing errors with Fetch API

I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.

Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:

fetch("/api/foo")
  .then( response => {
    if (!response.ok) { throw response }
    return response.json()  //we only get here if there is no error
 })
@richardtorres314
richardtorres314 / flexbox.scss
Last active March 24, 2025 17:35
CSS Flexbox - Sass Mixins
// --------------------------------------------------
// Flexbox SASS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
@mixin flexbox {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
@parmentf
parmentf / GitCommitEmoji.md
Last active December 16, 2025 19:51
Git Commit message Emoji

Inspired by dannyfritz/commit-message-emoji

See also gitmoji.

Commit type Emoji
Initial commit πŸŽ‰ :tada:
Version tag πŸ”– :bookmark:
New feature ✨ :sparkles:
Bugfix πŸ› :bug:
@paulirish
paulirish / what-forces-layout.md
Last active December 30, 2025 21:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@PurpleBooth
PurpleBooth / README-Template.md
Last active December 31, 2025 04:34
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

@nkbt
nkbt / .eslintrc.js
Last active July 21, 2025 17:55
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active December 30, 2025 02:37
λ§ˆν¬λ‹€μš΄(Markdown) μ‚¬μš©λ²•

[곡톡] λ§ˆν¬λ‹€μš΄ markdown μž‘μ„±λ²•

μ˜μ–΄μ§€λ§Œ, 쑰금 더 μƒμ„Έν•˜κ²Œ λ§ˆν¬λ‹€μš΄ μ‚¬μš©λ²•μ„ μ•ˆλ‚΄ν•˜κ³  μžˆλŠ”
"Markdown Guide (https://www.markdownguide.org/)" λ₯Ό λ³΄μ‹œλŠ” 것을 μΆ”μ²œν•©λ‹ˆλ‹€. ^^

μ•„, 그리고 λ§ˆν¬λ‹€μš΄λ§ŒμœΌλ‘œ ν‘œν˜„μ΄ λΆ€μ‘±ν•˜λ‹€κ³  λŠλΌμ‹ λ‹€λ©΄, HTML νƒœκ·Έλ₯Ό ν™œμš©ν•˜μ‹œλŠ” 것도 μ’‹μŠ΅λ‹ˆλ‹€.

1. λ§ˆν¬λ‹€μš΄μ— κ΄€ν•˜μ—¬