Skip to content

Instantly share code, notes, and snippets.

View Chudesnov's full-sized avatar

Alexander Chudesnov Chudesnov

View GitHub Profile
@tenphi
tenphi / bemnames.js
Created September 2, 2017 11:25
BEM-class Generator for React
import classNames from 'classnames';
// modName -> mod_name
function toKebabCase(str) {
return str ? str.replace(/[A-Z]/g, function(s) {return '-' + s.toLowerCase() }).replace(/$\-/, '') : '';
}
function BEM(blockName) {
blockName = blockName || '';
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active March 22, 2025 07:22
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@TheRadziu
TheRadziu / ultimate-vita-comparison.md
Last active February 1, 2025 15:22
Ultimate Vita Comparison (Firmwares & Rips vs Dumps)

Due to so many misinformation, false claims and confusion that goes around the web I've decided to make this quick comparison of all most known backup enabling tools, hackable vita firmwares and which one you should be using and why.
Date of last update: 13.01.2020

NoNpDRM Rips vs Dumps

NoNpDRM Rips Vitamin / MaiDumpTool Dumps
All original files untouched
Support Retail DLCs
Support Ripped (NoNpDRM) DLCs
Support Dumped (Vitamin/Mai) DLCs 1

Batching makes it difficult to perform imperative actions like focus

Solution to the problem discussed with Dan Abramov here.

implementation:

export default function useQueueFocus(): (elementRef: React.MutableRefObject<HTMLElement | null>) => void {
  const isUnmountedRef = useRef(false)
  const forceUpdate = useForceUpdate()
  const ref = useRef<MutableRefObject<HTMLElement | null> | undefined>(undefined)
@mcking65
mcking65 / modeless_dialog_proposal.md
Last active August 31, 2023 15:05
An Accessibility Opportunity Hidden in Modeless Web Dialogs

An Accessibility Opportunity Hidden in Modeless Web Dialogs

In the current effort to resolve issues related to standardizing web dialogs (see ARIA issue 1708), it is proposed that the ARIA specification recommend that browsers and screen readers treat modeless dialogs as landmark regions. While the discussion has surfaced some potential benefits to modeless dialog landmarks, I believe equating modeless dialogs and landmark regions is not an optimal path. I might even go so far as to call it a huge mistake. That path would preclude extremely valuable user benefits that can only be realized if screen readers do not render boundaries of modeless dialogs the way they render boundaries of landmark regions.

If ARIA were to standardize modeless dialogs as landmark regions, we would give web authors yet another construct for doing little more than labeling a group of elements within a page. Yet, non-web platforms offer other grouping constructs with a different set of sc