Skip to content

Instantly share code, notes, and snippets.

@Sheraff
Sheraff / codeswing.json
Last active July 2, 2021 06:55
Animatable multiline underline that skips descenders
{
"scripts": [],
"styles": [],
"themePreview": false
}
@Sheraff
Sheraff / codeswing.json
Last active June 26, 2021 15:19
Animate object-fit `contain` to `cover`
{
"scripts": [],
"styles": []
}
@Sheraff
Sheraff / codeswing.json
Last active July 2, 2021 06:56
SVG scale path to parent but not text
{
"scripts": [],
"styles": []
}
@Sheraff
Sheraff / App.jsx
Last active November 16, 2023 23:32
React: add children to child
function Wrapper({ children }) {
return (
<ul>
{React.Children.map(children, (child) => (
<li>{child}</li>
))}
</ul>
)
}
@Sheraff
Sheraff / codeswing.json
Last active June 27, 2021 07:08
`with` + `Proxy`: no global reference error
{
"scripts": [],
"showConsole": true
}
@Sheraff
Sheraff / codeswing.json
Last active June 27, 2021 07:12
`defineProperty` on `this`: ever-changing reference value
{
"scripts": [],
"showConsole": true
}
@Sheraff
Sheraff / codeswing.json
Last active June 26, 2021 21:41
Try all <source> before falling back to <img>
{
"scripts": [],
"styles": [],
"showConsole": true
}
@Sheraff
Sheraff / README.md
Last active July 1, 2021 18:34
sort HTML table with native interface

For this problem, I'm going to assume that the table will have a <thead> (for the clickable elements) and a single <tbody>.

Native JS API for interacting with <table>

A good thing to know is that a <table> element in JS has a special interface HTMLTableElement that allows us to perform a few selections / actions easily. So once we select our element:

const table = document.querySelector('table')

We have access to its entire structure. For example:

@Sheraff
Sheraff / codeswing.json
Created June 28, 2021 21:19
Object Proxy: random missing properties
{
"scripts": [],
"showConsole": true
}
@Sheraff
Sheraff / README.md
Last active July 3, 2021 12:00
CodeSwing template theming tests

Heading level 1

Heading level 2

hello

some quote

private css: string = "";