Skip to content

Instantly share code, notes, and snippets.

@xnuk
Created October 14, 2022 11:53
Show Gist options
  • Save xnuk/c06724435ff4301f4b16a7932fa618f2 to your computer and use it in GitHub Desktop.
Save xnuk/c06724435ff4301f4b16a7932fa618f2 to your computer and use it in GitHub Desktop.
copy(
(() => {
const a = {}
for (
const el
of document.querySelectorAll('#problem-body .sampledata[id^=sample-]')
) {
const m = el.id.match(/^sample-(input|output)-([0-9]+)$/)
if (m == null) continue
const o = (a[m[2]] ??= {})
o[m[1]] = el.textContent
}
return JSON.stringify(a, null, 2)
})()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment