Skip to content

Instantly share code, notes, and snippets.

View donatj's full-sized avatar
🥽
Getting back to business

Jesse Donat donatj

🥽
Getting back to business
View GitHub Profile
/**
* Method for taking a string formatted as a css selector and breaking it down into id/classes/attributes/in-line styles
* to use in the creatin of an element. I.E. "#id.class.class2[attribute=value]{ border: 1px solid blue; }"
*
* @ignore this is the original regex i wrote, which was awesome, but broke on some edge cases ...
* "!(\#(.+?)(\.|\[|\{)){1,}!" => ' id="$2" $3', //ID
* "!(\.(.*?)(\[|\{)){1,}!" => ' class="$2" $3', //CLASS
* "!\[(.*?)=([^\[]*)\]!" => ' $1="$2" ', //ATTRS
* "!\{(.*)\}!" => ' style="$1" ', //INLINE STYLE
* "!\.([a-zA-Z_]+[\w\-]*)!" => ' $1', //SPECIFIC CLASSES
@donatj
donatj / main.go
Created March 19, 2024 21:27 — forked from brandon-braner/main.go
my attempt at processing a large csv
package main
import (
"database/sql"
"encoding/csv"
"fmt"
"io"
"log"
"os"
"sync"