Skip to content

Instantly share code, notes, and snippets.

View KevinGutowski's full-sized avatar

Kevin Gutowski KevinGutowski

View GitHub Profile
@KevinGutowski
KevinGutowski / parseDeckstring.js
Created April 6, 2023 05:56
Parse Pokémon Trading Card Online Deckstring
function importDeckString(deckString) {
var lines = deckString.trim().split('\n');
lines = lines.filter(item => item !== "");
lines.pop()
const cards = [];
var numOfPokemon = 0
var numOfTrainers = 0
var numOfEnergy = 0
@KevinGutowski
KevinGutowski / parseCard.py
Created April 3, 2023 05:03
Parse a card from Pokemon-card.com (output a JSON file)
import os
import sys
import requests
import bs4
import json
if len(sys.argv) < 2:
print("Please provide a URL as input")
sys.exit(1)
@KevinGutowski
KevinGutowski / parse.py
Created March 21, 2023 21:24
Parse a japanese pokemon card
baseURL = 'https://www.pokemon-card.com'
def parseSoup(soup):
topHeadings = soup.find_all('h2')
leftBox = soup.find(class_='LeftBox')
rightBox = soup.find(class_='RightBox')
topInfo = soup.find(class_='TopInfo')
atr = {
'name':'',
'cardClass': '', # "ポケモン, Trainer, エネルギー"
@KevinGutowski
KevinGutowski / exportCSV.js
Last active October 11, 2022 22:30
PKMNCards to CSV
let main = document.getElementById('genesis-content')
let headings = main.getElementsByClassName('headings')[0]
let headingText = Array.from(headings.children).map(el=>el.innerText.split(":")[0].replace("\n","")).join(',')
let article = Array.from(main.getElementsByTagName('article'))
let rowTextArray = article.map(el=>{
let columns = Array.from(el.getElementsByClassName('column'))
return columns.map(el=>el.innerText.replace('\n',"")).join(',')
@KevinGutowski
KevinGutowski / reorder.py
Created January 7, 2022 21:17
Reorder pandas column using indexes
columns = list(df.columns)
df = df[[columns[i] for i in [3,2,1,4,6,4,8]]
@KevinGutowski
KevinGutowski / hide.js
Created November 12, 2021 05:28
Hide Connector Nodes
let connectors = figma.currentPage.children.filter(layer=>layer.type=="CONNECTOR")
connectors.forEach(layer=>{layer.visible = false})
@KevinGutowski
KevinGutowski / resizeProgressBars.js
Created October 13, 2021 21:34
Resize widths of progress bars - Figma
let selection = figma.currentPage.selection[0]
let paddingWidth = selection.paddingLeft + selection.paddingRight
let insetWidth = selection.width - paddingWidth
let times = [60*10+10,60*10+22,60*12+42,60*13+59]
// Remove extra children
selection.children.forEach((e,i)=>{
if (i>0) {
e.remove()
}
@KevinGutowski
KevinGutowski / resizeTo16by9.js
Created October 13, 2021 21:33
16:9 - Figma
let selection = figma.currentPage.selection
let width = selection[0].width
let height = selection[0].height
let multiplier = Math.floor(width/16)
selection[0].resize(16*multiplier,9*multiplier)
selection[0].constrainProportions = true
@KevinGutowski
KevinGutowski / createLayers.js
Created October 1, 2021 08:01
Create layers for each pixel with opacities
let sketch = require('sketch')
let Rectangle = sketch.Rectangle
let ShapePath = sketch.ShapePath
let Style = sketch.Style
let Group = sketch.Group
let document = sketch.getSelectedDocument()
let selection = document.selectedLayers.layers[0]
let nativeSelection = selection.sketchObject
@KevinGutowski
KevinGutowski / updateColors.js
Last active September 13, 2021 19:49
Update Figma Color Descriptions to include RGB
// Update color descriptions to include rgb code
let paintStyles = figma.getLocalPaintStyles()
paintStyles.forEach(paintStyle=>{
let color = paintStyle.paints[0].color
let description = `rgb(${(color.r*256).toFixed(0)},${(color.g*256).toFixed(0)},${(color.b*256).toFixed(0)})`
paintStyle.description = description
})