Skip to content

Instantly share code, notes, and snippets.

View ejmudrak's full-sized avatar

Erik Mudrak ejmudrak

View GitHub Profile
@ejmudrak
ejmudrak / migration.js
Created February 6, 2024 20:50
Migration script for adding standards
import type { Knex } from 'knex';
import app from '../src/app';
export async function up(knex: Knex): Promise<void> {
const isTest = app.get('postgresql').connection.isTest;
if (process.env.NODE_ENV !== 'development') {
if (!isTest) {
await knex('standards').insert([
{
@ejmudrak
ejmudrak / migration.js
Last active February 6, 2024 20:45
Add Standards Set Migration Script
import type { Knex } from 'knex';
import app from '../src/app';
const SET_NAME = 'ENTER NAME';
export async function up(knex: Knex): Promise<void> {
const isTest = app.get('postgresql').connection.isTest;
if (process.env.NODE_ENV !== 'development') {
if (!isTest) {
@ejmudrak
ejmudrak / inaccessible-password.tsx
Created December 5, 2023 16:22
Inaccessible Password
<TextField
type={showPassword ? 'text' : 'password'}
InputProps={{
endAdornment: (
<IconButton
onClick={() => setShowPassword((prev) => !prev)}
>
{showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
),
@ejmudrak
ejmudrak / accessible-password.tsx
Created December 5, 2023 16:21
Accessible Password Input
<TextField
type={showPassword ? 'text' : 'password'}
InputProps={{
endAdornment: (
<IconButton
aria-pressed={showPassword ? 'true' : 'false'}
aria-label='toggle password visibility'
onClick={() => setShowPassword((prev) => !prev)}
>
{showPassword ? <VisibilityOff /> : <Visibility />}
@ejmudrak
ejmudrak / tag_missed_elements.py
Last active November 16, 2023 17:01
Tag missed, untagged elements
# tag_missed_elements.py
# import utils to load required shared libraries
from utils import inputPath, outputPath
from pdfixsdk.Pdfix import *
# find any elements that are untagged, and find tags for them
def TagMissedElements(page:PdfPage):
pDoc = page.GetDoc()
@ejmudrak
ejmudrak / set_text_color.py
Created November 16, 2023 15:22
Change document text color to black
# set_text_color.py
# import utils to load required shared libraries
from utils import inputPath, outputPath
from pdfixsdk.Pdfix import *
def SetTextColor(page: PdfPage, color: PdfColor):
pDoc = page.GetDoc()
content = page.GetContent()
@ejmudrak
ejmudrak / set_alt_text.py
Created November 16, 2023 15:21
Set Alt Text (via document the structure tree)
# set_alt_text.py
# import utils to load required shared libraries
from utils import inputPath, outputPath
from pdfixsdk.Pdfix import *
# sets alt text on nested figures
def SetNestedAltText(struct_elem: PdsStructElement):
for i in range(struct_elem.GetNumChildren()):
# search nested child struct elements
@ejmudrak
ejmudrak / mark_images_decorative.py
Created November 13, 2023 16:20
Mark Images As Decorative
# mark_images_decorative.py
# import utils to load required shared libraries
from utils import inputPath, outputPath
from pdfixsdk.Pdfix import *
# find any images and mark them as artifacts, for decorative use only
def MarkImagesAsArtifacts(page:PdfPage):
pDoc = page.GetDoc()
@ejmudrak
ejmudrak / add_alt_text.py
Created November 13, 2023 16:18
Add Alt Text
# add_alt_text.py
# import utils to load required shared libraries
from utils import inputPath, outputPath
from pdfixsdk.Pdfix import *
def AddAltText(page:PdfPage):
pDoc = page.GetDoc()
content = page.GetContent()
@ejmudrak
ejmudrak / make_accessible.py
Created November 10, 2023 20:43
Mark images as artifacts
# make_accessible.py
# import utils to load required shared libraries
from pdfixsdk.Pdfix import *
# find any images and mark them as artifacts, for decorative use only
def MarkImagesAsArtifacts(page:PdfPage):
pDoc = page.GetDoc()
content = page.GetContent()
for i in range(content.GetNumObjects()):