Skip to content

Instantly share code, notes, and snippets.

View ppeelen's full-sized avatar
🎯
Focusing, always!

Paul Peelen ppeelen

🎯
Focusing, always!
View GitHub Profile
@ppeelen
ppeelen / SwiftCharts-MultiDataType-Start.swift
Last active February 13, 2023 18:30
The start of the tutorial for multi data type in Swift Chart
import SwiftUI
import PlaygroundSupport
import Charts
// MARK: Chart implementation
struct ChartView: View {
@Binding var consumption: [Consumption]
var body: some View {
@ppeelen
ppeelen / SwiftCharts-MultiDataType-Complete.swift
Created February 13, 2023 22:13
The end result of the tutorial for multi data type in Swift Chart
import SwiftUI
import PlaygroundSupport
import Charts
// MARK: Chart implementation
struct ChartView: View {
@Binding var consumption: [Consumption]
var body: some View {
@ppeelen
ppeelen / String+Sanitiser.swift
Last active December 11, 2023 07:43
A simple sanitiser for Swift strings. Removed certain sensitive information; great for using in logs.
extension String {
/**
Sanitizes the string by obscuring sensitive information.
- Returns: A sanitized version of the string where sensitive information is replaced with `*******`.
This method searches for specific keys (namely `access_token`, `refresh_token`, and `id_token`) in various formats including JSON-like strings, query strings, HTTP headers, plain text, and also searches for email addresses. It replaces their associated values or the email addresses with a placeholder string to obscure sensitive information.
## Examples: