Skip to content

Instantly share code, notes, and snippets.

View BjoernRave's full-sized avatar
🌱

Björn Rave BjoernRave

🌱
View GitHub Profile
@BjoernRave
BjoernRave / gist:9e4c132b2f43dd514e9ba8e751a1914c
Last active April 13, 2023 14:05
(Next.js)React BarcodeScanner/QR Code Scanner
//next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
urlImports: ['https://cdn.jsdelivr.net/npm/@undecaf/[email protected]/'],
},
}
//in Next.js import like this
@BjoernRave
BjoernRave / gist:0a9a6e1168ca5956cda345cd76fb6518
Last active March 29, 2024 10:41
Function to get a decklist of a cardmarket wanted list. Just go to your wanted list, right click somewhere, click inspect, go to console, paste this in and hit enter
(function scrapeData() {
const tbody = document.querySelector('tbody');
const trElements = tbody.querySelectorAll('tr');
const result = [];
trElements.forEach((tr) => {
const amountElement = tr.querySelector('.amount');
const nameElement = tr.querySelector('.name');
if (amountElement && nameElement) {
export const shadeColor = (color: string, percent: number) => {
if (!color) return ''
let R = parseInt(color.substring(1, 3), 16)
let G = parseInt(color.substring(3, 5), 16)
let B = parseInt(color.substring(5, 7), 16)
R = parseInt(((R * (100 + percent)) / 100) as any)
G = parseInt(((G * (100 + percent)) / 100) as any)
B = parseInt(((B * (100 + percent)) / 100) as any)