https://github.com/danser-freelancer/code_bits
Miscellanious bits of javascript code.
https://github.com/danser-freelancer/code_bits
code customization experiment javascript metaprogramming prototype weird-language
Last synced: 3 months ago
JSON representation
Miscellanious bits of javascript code.
- Host: GitHub
- URL: https://github.com/danser-freelancer/code_bits
- Owner: DANser-freelancer
- License: bsd-3-clause
- Created: 2024-10-20T15:15:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-13T07:36:51.000Z (about 1 year ago)
- Last Synced: 2025-01-13T08:21:13.533Z (about 1 year ago)
- Topics: code, customization, experiment, javascript, metaprogramming, prototype, weird-language
- Homepage:
- Size: 212 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About
This is a repo of all the JavaScript things that I come up with.
Javascript might seem like a simpler or "lesser" language to some people, but I know it's rich in features, can be performant, and has many metaprogramming options.
This code is meant to do funny, complicated, silly, or cool things.
Consider this a free RnD project of one guy who wrote vanilla JavaScript for 6 years.
Upgrades are welcome too. Every branch has a copy of the permissive free licence.
### Q&A
*Why does this work?*
A short explanation for most code bits would be:
- *almost* everything in javascript is an object, one way or another.
- `.prototype` chains are useful to globally alter behavior of objects (including primitives as they are boxed).
- `constructor.name`, `instanceof`, `name`, and `typeof` can all be used in different scenarios to precisely determine what object you are dealing with.
- JavaScript's heavy lean into flexibility allows me to do some metaprogramming using granular property control, some "magic methods", monkeypatching, code-as-data, and reflection.