Skip to content

Instantly share code, notes, and snippets.

View datalater's full-sized avatar
🎯
Focusing

Min datalater

🎯
Focusing
View GitHub Profile
@1Marc
1Marc / reactive.js
Last active June 13, 2024 12:24
Vanilla Reactive System
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/
let context = [];
export function untrack(fn) {
const prevContext = context;
context = [];
const res = fn();
context = prevContext;
return res;
@vesse
vesse / jest-mocked-class.test.ts
Last active April 9, 2024 10:49
Mock 3rd party class with Jest in Typescript
import routeHandler from '../src/routeHandler';
import { mockResponse, mockRequest } from './test-helpers';
jest.mock('@googlemaps/google-maps-services-js');
import { Client } from '@googlemaps/google-maps-services-js';
const mockClient = {
geocode: jest.fn(),
};
@ninanung
ninanung / login-with-github.md
Last active September 20, 2023 16:16
Github로 로그인하기!

Github로 로그인하기 feat.Vue and Node.js

1. Github로 로그인하기?

요즘들어 "~로 로그인하기" 가 많아지고 있다. 페이스북이나 구글이 대표적이고, 한국에서는 네이버도 많이 사용하며 개발자 관련 웹에서는 깃허브도 껴있는 경우가 많다. 이런 식의 다른 서비스를 통해 인증하는 방식을, OAuth 인증 방식이라고 하는 모양이다. 내가 회사 업무를 위해 사용하는 몇몇 소프트웨어도 이러한 인증을 지원하는 경우가 많다. 이 글에서는 그러한 인증을 구현하지는게 아니라 그러한 인증을 사용해 보자는 것에 목적을 둔다. 어떤 방식으로 인증하는지를 직접 사용해보고 OAuth방식 인증의 절차를 알아보는 기회도 될것이다.

2. 목표

목표
위와 같이 버튼을 누르면 Github에서 인증을 실행하고 관련 데이터를 받아오는 동작을 구현해 볼 것이다.

@sebmarkbage
sebmarkbage / Infrastructure.js
Last active June 2, 2024 08:51
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@carly-lee
carly-lee / what-is-functional-programming.md
Last active August 14, 2021 04:04
함수형 프로그래밍 기본에 대한 정리

Functional Programming

Functional Programming is a style of writing programs by simply composing a set of pure functions.

순수한 함수들을 조합하여 프로그램을 만드는 방법론

함수형 프로그래밍에서 중요한 원칙들

  • Pure functions
  • Function composition
  • Avoid shared state
@parmentf
parmentf / GitCommitEmoji.md
Last active June 19, 2024 11:33
Git Commit message Emoji
@squarism
squarism / iterm2.md
Last active June 18, 2024 19:42
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@paulirish
paulirish / what-forces-layout.md
Last active June 19, 2024 15:52
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
@ihoneymon
ihoneymon / how-to-write-by-markdown.md
Last active June 19, 2024 23:52
마크다운(Markdown) 사용법

[공통] 마크다운 markdown 작성법

영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^

아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.

1. 마크다운에 관하여

@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE