This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert .png and .jpeg files to .heif format, ensuring "xcassets" is in the path | |
# Depending on what folder your icons are in, you may wish to append ' -not -path "*/Icons/*"' to that find command so you don't convert all your icon assets. | |
find . -path "*xcassets*" \( -name "*.png" -o -name "*.jpeg" \) | while read -r file; do | |
# Get the filename without the extension | |
filename="${file%.*}" | |
# Run the magick command to convert the file to .heif | |
/opt/homebrew/bin/magick "$file" "$filename.heif" | |
rm "$file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LiveActivityAttributes: ActivityAttributes { | |
typealias ContentState = LiveActivityState | |
struct LiveActivityState: Codable, Hashable { | |
var activityScore: Int | |
} | |
var activityName: String | |
var _image: UIImage? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bit of a crude example but it all works | |
var menu: UIMenu! | |
var selected = false | |
let toggleSelectionHandler: (UIAction) -> Void = { action in | |
selected.toggle() | |
// Actions are immutable once they're a child of a UIMenu, so we must create a copy before we modify anything | |
let replacementAction = action.copy() as! UIAction | |
if selected { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import datetime | |
import time | |
import sys | |
import os | |
params = ( | |
('parts.0', '%s/A' % sys.argv[1]), | |
('location', sys.argv[2]), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static var username: String{ | |
return keychain.get("username")! | |
} | |
static var password: String{ | |
return keychain.get("password")! | |
} | |
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
completionHandler(.useCredential, URLCredential(user: NetworkManager.username, password: NetworkManager.password, persistence: .synchronizable)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re #This is regex, it's kind of advanced for a beginner project to be honest | |
from string import punctuation #Punctuation is an array of all English puncutation marks, we use this to not translate anything that is punctuation | |
def convert_to_pyglatin(user_input): #Defining a function which takens one input parameter | |
words = re.findall(r"[\w']+|[.,!?;]", user_input) #regexr.com/4cim0 <- Look at this for an explanation | |
final_string = "" #I create an empty string where we add our words to in our loop | |
for word in words: #This is a for-loop, it'll go over every element in our words array defined above. the `word` part of it could be anything, it's like defining a variable | |
if word not in punctuation: #If the word isn't in our list of punctuation marjs, we'll try and translate | |
first_letter = word[:1].lower() # word[:1] returns the first (1) letter of a word, if we changed it to two we'd get the first two letters | |
word_without_first_letter= word[1:] #word[1:] does a similar thing, but returns the word |