Skip to content

Instantly share code, notes, and snippets.

View dance2die's full-sized avatar
🐰
Working

Sung M. Kim dance2die

🐰
Working
View GitHub Profile
@dance2die
dance2die / 1280x720.sh
Last active January 12, 2021 20:16
Bash scripts to change screen resolution
#!/bin/bash
xrandr --output eDP-1-1 --mode 1280x720
@astoilkov
astoilkov / useDebounceCallback.ts
Last active March 16, 2020 08:22
React hook for debouncing callbacks
import { useCallback, useLayoutEffect, DependencyList } from 'react'
/**
* This version bounces each version of the callback. This ensures that the callback
* will be called with each state of the application. That's why `deps` is a required argument.
*
* Previous version used `useRef` for `timeoutId` and didn't have `deps` argument.
* This resulted in missing calling the callback for the previous state and necessarily
* calling it for the new state.
*
@developit
developit / *constant-locals-loader.md
Last active February 4, 2022 17:15
Inline Webpack CSS Modules classNames, reducing bundle size. https://npm.im/constant-locals-loader

constant-locals-loader for Webpack

This loader optimizes the output of mini-css-extract-plugin and/or css-loader, entirely removing the potentially large CSS classname mappings normally inlined into your bundle when using CSS Modules.

Run npm install constant-locals-loader, then make these changes in your Webpack config:

module.exports = {
 module: {
@swyxio
swyxio / cloudos.md
Last active May 3, 2023 12:23
Cloud Operating Systems and Reconstituting the Monolith. tweet responses: https://twitter.com/swyx/status/1226257539886669825?s=20
@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@sebmarkbage
sebmarkbage / WhyReact.md
Created September 4, 2019 20:33
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr

@karlhadwen
karlhadwen / cloudSettings
Last active December 6, 2022 09:03
VSCode Settings
{"lastUpload":"2020-12-31T16:16:14.406Z","extensionVersion":"v3.4.3"}
@dance2die
dance2die / Add syntax highlight.md
Last active November 14, 2019 14:28
dev.to moderator replies

Hi,

Would you be be able to update the post with a syntax highlight as to improve the readability? Refer to the Editor Guide for more info.

@CodeMouse92
CodeMouse92 / beginners-tag.md
Last active March 6, 2024 06:03
DEV.to Moderation Comments and Messages

MOVED TO https://github.com/CodeMouse92/DEVModInACan

#BEGINNERS TAG REMOVALS

Non-Beginner Article

All articles on #beginners should be written for those new to programming, development, networking, or to a particular language. These posts should also require little to no prerequisite knowledge. If you wish, you may rewrite your post to meet these requirements, at which point you may request that the tag be added back. Otherwise, just use the appropriate technology tags. (Read more about the tag rules here.)

Non-Beginner Question

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.