Skip to content

Instantly share code, notes, and snippets.

View jimbrayrcp's full-sized avatar
😀

Jim Bray jimbrayrcp

😀
  • San Antonio, Texas
View GitHub Profile
@jimbrayrcp
jimbrayrcp / Flashing Messages (in method).py
Last active August 24, 2023 17:11
placing line break flash messages ~or~ multi line flash messages in a python flask html template
# EDIT THIS CODE TO YOUR SPECIFIC NEEDS
# THIS CODE REQUIRES SPECIFIC HTML CODE TO BE PLACED
# INSIDE THE TEMPLATE EXAMPLE FOUND BELOW
from flask import Flask, flash
def some_method():
@jimbrayrcp
jimbrayrcp / Find Core Data File.txt
Last active April 14, 2022 21:14
Find the sql lite file path attached to a core data project. Open with SqlLiteBrowser downloaded from https://sqlitebrowser.org/. You will find the file within the folder path given just inside of the folder labeled with /YOUR-PROJECT-NAME/. ~ and. ~ then find the DB labeled YourProjectName.sqlite
func whereIsMySQLite() {
let path = FileManager
.default
.urls(for: .applicationSupportDirectory, in: .userDomainMask)
.last?
.absoluteString
.replacingOccurrences(of: "file://", with: "")
.removingPercentEncoding
print(path ?? "Not found")
@jimbrayrcp
jimbrayrcp / Dynamic Decimal (let) Extension.swift
Last active April 22, 2022 04:40
Dynamically removes trailing zeros from doubles in swiftui view text field. To use a (func) type extension instead : snippetslab://snippet/5D3360F4-38A6-4504-8B98-86F441E1E931/
struct RowView: View {
var coin: Coins
var body: some View {
HStack(alignment: .bottom) {
Spacer()
Text("\((dynamicDrecimalFormat(dynamicDrecimal: Double(coin.paymentThreshold))))")
Text(coin.symbol ?? "")
.font(.footnote)
}
}
@jimbrayrcp
jimbrayrcp / Dynamic Decimal (func) Extension.swift
Last active April 22, 2022 04:40
Dynamically removes trailing zeros from doubles in swiftui view text fields. To use a (let) type extension instead use: snippetslab://snippet/ABECB304-F4B9-451A-A47D-69602E7F56A6/
struct RowView: View {
var coin: Coins
var body: some View {
VStack() {
let _ = print("\((Double("\(coin.paymentThreshold)")!.dynamicDrecimalFormat())) ")
HStack(alignment: .bottom) {
Spacer()
Text("\((Double("\(coin.paymentThreshold)")!.dynamicDrecimalFormat())) ")