Skip to content

Instantly share code, notes, and snippets.

View shoveller's full-sized avatar

cinos shoveller

  • SEOUL, SouthKorea
  • 18:06 (UTC +09:00)
View GitHub Profile
@shoveller
shoveller / postbodyEnc.md
Created September 24, 2023 04:50 — forked from jays1204/postbodyEnc.md
Http Method는 POST, Content-Type이 application/x-www-form-urlencoded인 경우 body를 encoding하는게 맞을까?

요즘의 Request

RestFul API를 사용하며 json을 많이 사용하게 됨에 따라 요즈음의 request의 Content-Type은 대부분이 application/json인 것이 많다.

아니면 파일 첨부를 위해 multipart/*를 사용한다. application/x-www-form-urlencoded는 form에서 default로 사용되는 것 이외에는 사실 잘 사용하지 않는 편으로 보인다.

요새 자주 사용하지 않지만, 하지만 여전히 application/x-www-form-urlencoded를 사용하는 경우가 존재한다.

Content-Type이 다름에 따라 뭐가 달라지겠느냐 하겠지만 다른 점이 분명히 있다.

@shoveller
shoveller / UT.json
Created August 12, 2022 00:42
CSS Grid Overlay - settings
[
{
"columns": 4,
"margins": 24,
"gutters": 8,
"from": 320,
"to": 599
},
{
"columns": 8,
@shoveller
shoveller / README.md
Created March 1, 2022 05:29 — forked from ngryman/README.md
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
@shoveller
shoveller / App.tsx
Last active January 21, 2022 18:07
useState의 대안으로 useReducer 사용하기
import {useCountContext} from "./store/counter";
import './App.css'
const Viewer = () => {
const {count} = useCountContext()
return <p>
count is: {count}
</p>
}
@shoveller
shoveller / sw-await.js
Created October 28, 2020 05:55 — forked from bakoushin/sw-await.js
Service Worker: Promises vs Async/Await
const version = 1;
const appPrefix = 'myApp-';
const staticCacheName = appPrefix + 'static-v' + version;
const imagesCacheName = appPrefix + 'content-imgs';
var allCaches = [
staticCacheName,
imagesCacheName
];
self.addEventListener('message', event => {
@shoveller
shoveller / oop.js
Last active April 4, 2018 04:20
oop로 설계한 http 서버 프로그램
const http = require('http');
const url = require('url');
const querystring = require('querystring');
class MyServer {
constructor(req, res) {
this.req = req;
this.res = res;
this.body = '';
this.params = {};
@shoveller
shoveller / traditional.js
Last active April 4, 2018 04:20
전통적인 http 서버의 구현 예
const http = require('http');
const url = require('url');
const querystring = require('querystring');
const onRequest = (res, method, pathname, params) => res.end(JSON.stringify(params));
http.createServer((req, res) => {
const method = req.method;
const uri = url.parse(req.url, true);
const pathname = uri.pathname;
@shoveller
shoveller / range.js
Created March 30, 2018 07:39
제네레이터로 구현한 레인지 함수
function* range(start, end, step = 1) {
for (let value = start; (step > 0 ? value <= end : value >= end); value = value + step) {
yield value;
}
}
for (const val of range(0, 10, 3)) {
console.log(val); // 0 1 2
}
@shoveller
shoveller / range.js
Last active March 30, 2018 08:22
커스텀 이터레이터로 구현한 레인지 함수
function range(start, end, step = 1) {
const iterable = {
[Symbol.iterator]() {
let value = start;
const iterator = {
next() {
value = value + step;
let done = value === end + step;
if (done) {
@shoveller
shoveller / iter.js
Created March 30, 2018 05:25
이터레이터, 이터러블, 이터레이터 리절트의 정의
// 이터러블은 Symbol.iterator 메서드를 가지는 객체
var iterable = {
[Symbol.iterator]() {
// 이터레이터는 next 메서드를 가지는 객체
const iterator = {
// next 메서드는 이터레이터 리절트를 반환하는 함수
next() {
return {
done: true,
value: 'test'