This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$let = fn(...$a) => array_pop($a)(...$a); | |
$v1 = 10; | |
$let($v1 + 1, fn($v2) => | |
$let($v2 + 1, fn($v3) => | |
$let($v3 + 1, fn($v4) => | |
var_dump($v1, $v2, $v3, $v4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ReSort = ({ items, onChange, keySelector, itemRender }) => { | |
const [selected, setSelected] = useState(null) | |
const onClick = (item) => (event) => { | |
if (!selected) { | |
setSelected(item) | |
} else if (selected === item) { | |
setSelected(null) | |
} else { | |
const selected_index = items.indexOf(selected) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react" | |
const toHexString = (num) => { | |
return num.toString(16).toUpperCase() | |
} | |
const fromHexString = (hex) => { | |
return hex ? parseInt(hex, 16) : 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dom from "./dom.js" | |
// 1 | |
const div = dom.div({ className: "foo" }, [ | |
dom.input(), | |
dom.input({ type: "checkbox" }) | |
]) | |
document.body.append(div) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import glob | |
for arg in sys.argv[1:]: | |
for path in glob.glob(arg, recursive=True): | |
with open(path, "rb") as f: | |
text1 = f.read().decode() | |
text2 = text1.replace("\r\n", "\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const A = gen() | |
const B = gen() | |
const a = A({ v: 0 }) | |
const b = B({ v: 1 }) | |
class C {} | |
const c = new C() | |
const values = [ | |
new Date(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<script> | |
// for emotion | |
window.process = { env: {} } | |
</script> | |
<script type="module"> | |
import { html, render } from "https://unpkg.com/[email protected]/lit-html.js" | |
import { css, cx } from "https://unpkg.com/@emotion/[email protected]/dist/emotion-css.esm.js?module" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<style> | |
.flex-container { | |
display: flex; | |
flex-flow: row wrap; | |
gap: 20px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<style> | |
body { | |
margin: 0; | |
} | |
.control { | |
display: inline-block; |