Skip to content

Instantly share code, notes, and snippets.

View scarf005's full-sized avatar

scarf scarf005

View GitHub Profile
@chrisgervang
chrisgervang / ComponentSynthetic.tsx
Last active January 7, 2024 03:59
Understanding Typescript: "allowSyntheticDefaultImports": true
// React doesn't use es2015 "export default react" syntax in their NPM dist.
// Instead they set a "default" key in their export object.
/** node_modules/react/cjs/react.development.js
...
var React$2 = Object.freeze({
default: React
});
@ChenyangGao
ChenyangGao / ufcs.py
Last active July 1, 2024 13:42
Uniform Function Call Syntax (UFCS) for Python
'''
This module implements UFCS for Python.
[Uniform Function Call Syntax (UFCS)](https://tour.dlang.org/tour/en/gems/uniform-function-call-syntax-ufcs)
UFCS is a key feature of D and enables code reusability and scalability through well-defined encapsulation.
UFCS allows any call to a free function fun(a) to be written as a member function call a.fun().
If a.fun() is seen by the compiler and the type doesn't have a member function called fun(),