Skip to content

Instantly share code, notes, and snippets.

View pj4533's full-sized avatar

PJ Gray pj4533

View GitHub Profile
@pj4533
pj4533 / apple_docs_scraper.py
Created June 14, 2025 23:40
Apple Docs Scraper
#!/usr/bin/env python3
"""
Apple Documentation Scraper
Converts Apple documentation sections to markdown files recursively
"""
import requests
import json
import time
import re
@pj4533
pj4533 / foundation_models_docs.md
Last active June 11, 2025 13:33
foundation_models_docs.md

Apple Foundation Models Framework Documentation

Overview

The Foundation Models framework is Apple's new API announced at WWDC 2025 that provides developers with direct access to the on-device large language model powering Apple Intelligence. Released to beta on June 9, 2025, this framework enables developers to integrate powerful AI capabilities directly into their apps while maintaining user privacy through on-device processing.

Key Features

  • On-device processing: All AI inference runs locally on the device
  • Privacy-focused: No data leaves the device or is sent to cloud servers
@pj4533
pj4533 / refactor-big-files.md
Created June 5, 2025 14:35
Refactor Big Files Claude Code Slash Command

Look thru the whole code base for any files bigger than 300 lines. Refactor any file over 300 lines to be smaller. Consider separation of concerns and keep things organized and tidy.

DO NOT CHANGE ANY FUNCTIONALITY.

  • For classes, separate into extensions, named and grouped appropriately.
  • For views, split into subviews

Remember: only one object per file, so if some files have multiple objects thats an easy place to start.

@pj4533
pj4533 / no_op_cgimage.swift
Created July 1, 2023 14:03
An empty CGImage based on another CGImage
func createBlackCGImage(basedOn originalImage: CGImage) -> CGImage? {
let width = originalImage.width
let height = originalImage.height
let bitsPerComponent = originalImage.bitsPerComponent
let bytesPerRow = originalImage.bytesPerRow
let colorSpace = originalImage.colorSpace ?? CGColorSpace(name: CGColorSpace.sRGB)!
let bitmapInfo = originalImage.bitmapInfo
// Create an empty context with the same parameters as the original image
guard let context = CGContext(data: nil,
SELECT * FROM (
SELECT
`dutchess_tax_roll`.`parcel_location_address`,
`dutchess_tax_roll`.`primary_owner`,
`dutchess_tax_roll`.`street_address`,
`dutchess_tax_roll`.`loc_st_name`,
`dutchess_tax_roll`.`city_state_zip_code`,
levenshtein(`dutchess_tax_roll`.`parcel_location_address`, `dutchess_tax_roll`.`street_address`) as lev_distance
FROM `state_boe_active_012219`
RIGHT JOIN `dutchess_tax_roll` ON (
SELECT
`dutchess_tax_roll`.`parcel_location_address`,
`dutchess_tax_roll`.`primary_owner`,
`dutchess_tax_roll`.`street_address`,
`dutchess_tax_roll`.`loc_st_name`,
`dutchess_tax_roll`.`city_state_zip_code`
FROM `state_boe_active_012219`
RIGHT JOIN `dutchess_tax_roll` ON (
`dutchess_tax_roll`.`parcel_location_address` = `state_boe_active_012219`.`CUSTOM_STREET_ADDRESS`
)
SELECT
`dutchess_tax_roll`.`parcel_location_address`,
`dutchess_tax_roll`.`primary_owner`,
`dutchess_tax_roll`.`street_address`,
`dutchess_tax_roll`.`loc_st_name`,
`dutchess_tax_roll`.`city_state_zip_code`
FROM `state_boe_active_012219`
RIGHT JOIN `dutchess_tax_roll` ON (
`dutchess_tax_roll`.`parcel_location_address` = `state_boe_active_012219`.`CUSTOM_STREET_ADDRESS`
)
UPDATE `state_boe_active_012219`
SET `state_boe_active_012219`.`CUSTOM_STREET_ADDRESS` = CONCAT(`state_boe_active_012219`.`RADDNUMBER`, ' ',`state_boe_active_012219`.`RSTREETNAME`)
SELECT * from `state_boe_012219`
WHERE
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` LIKE '%GE16%') AND
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` LIKE '%GE18%') AND
(`state_boe_012219`.`CLEANED_VOTER_HISTORY` NOT LIKE '%GE17%')
UPDATE `state_boe_012219` SET `state_boe_012219`.`CLEANED_VOTER_HISTORY` = 'GE18GE17GE16PP16GE12GE10GE08PP08GE06GE05GE04GE03GE02' WHERE `state_boe_012219`.`COUNTYVRNUMBER` = '918273';
UPDATE `state_boe_012219` SET `state_boe_012219`.`CLEANED_VOTER_HISTORY` = 'GE18GE03GE02' WHERE `state_boe_012219`.`COUNTYVRNUMBER` = '817623';