Skip to content

Instantly share code, notes, and snippets.

View aarr0n's full-sized avatar

Aarron Painter aarr0n

  • Auckland
  • 16:02 (UTC -12:00)
View GitHub Profile
// jscodeshift -t padding-to-classnames.ts --extensions=tsx,jsx path/ --parser=tsx
import {
Transform,
FileInfo,
API,
JSXAttribute,
JSXElement,
JSXOpeningElement,
Expression,
@aarr0n
aarr0n / copy-table-to-clipboard.js
Created March 19, 2023 22:12 — forked from bennetthardwick/copy-table-to-clipboard.js
Turn a table into a JSON and copy it!
(() => {
const table = document.querySelector('table');
const head = document.querySelector('thead');
const body = document.querySelector('tbody');
const keys = Array.from(head.querySelectorAll('th'))
.map(cell => cell.innerText);
const values = Array.from(body.querySelectorAll('tr'))
.map(row => Array.from(row.querySelectorAll('td')).map(cell => cell.innerText));