A collection of all of the various options and styles available to you if you'd like to format data into string on iOS 15.
See every option in detail at fuckingformatstyle.com or goshdarnformatstyle.com.
#!/bin/zsh | |
# Test if the Swift compiler knows about a particular language feature. | |
# | |
# Usage: | |
# | |
# swift-has-feature [--swift SWIFT_PATH] FEATURE | |
# | |
# The exit code signals success (= the compiler knows this feature) or failure. | |
# |
# install DSPy: pip install dspy | |
import dspy | |
# Ollam is now compatible with OpenAI APIs | |
# | |
# To get this to work you must include `model_type='chat'` in the `dspy.OpenAI` call. | |
# If you do not include this you will get an error. | |
# | |
# I have also found that `stop='\n\n'` is required to get the model to stop generating text after the ansewr is complete. | |
# At least with mistral. |
# install DSPy: pip install dspy | |
import dspy | |
# This sets up the language model for DSPy in this case we are using mistral 7b through TGI (Text Generation Interface from HuggingFace) | |
mistral = dspy.HFClientTGI(model='mistralai/Mistral-7B-v0.1', port=8080, url='http://localhost') | |
# This sets the language model for DSPy. | |
dspy.settings.configure(lm=mistral) | |
# This is not required but it helps to understand what is happening |
# install DSPy: pip install dspy | |
import dspy | |
# This sets up the language model for DSPy in this case we are using GPT-3.5-turbo | |
turbo = dspy.OpenAI(model='gpt-3.5-turbo') | |
# This sets the language model for DSPy. This must be set or you get an error that is not helpful: | |
# --> temperature = lm.kwargs['temperature'] if temperature is None else temperature | |
# --> AttributeError: 'NoneType' object has no attribute 'kwargs' |
# install DSPy: pip install dspy | |
import dspy | |
# This sets up the language model for DSPy in this case we are using GPT-3.5-turbo | |
turbo = dspy.OpenAI(model='gpt-3.5-turbo') | |
# This sets the language model for DSPy. This must be set or you get an error that is not helpful: | |
# --> temperature = lm.kwargs['temperature'] if temperature is None else temperature | |
# --> AttributeError: 'NoneType' object has no attribute 'kwargs' |
#!/bin/bash | |
# https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api | |
searchTerms=( | |
# File timestamp APIs | |
"creationDate" | |
"modificationDate" | |
"fileModificationDate" | |
"contentModificationDateKey" | |
"creationDateKey" |
A collection of all of the various options and styles available to you if you'd like to format data into string on iOS 15.
See every option in detail at fuckingformatstyle.com or goshdarnformatstyle.com.
Allow the consumer of a SwiftUI UIViewRepresentable View to inject delegate implementations for the wrapped UIView through View Modifiers by using a proxy delegate.
This can be a helpful pattern when providing a SwiftUI wrapper for a very heavy and complex UIView, where the wrapper implements many of the delegate methods of the wrapped UIView. But you want someone consuming the wrapper to have the ability to inject their own delegate method implementations to override yours, or to leverage some of the methods your not implementing.
class MyCell: UITableViewCell { | |
let titleLabel = UILabel() | |
let subtitleLabel = UILabel() | |
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
super.init(style: style, reuseIdentifier: reuseIdentifier) | |
} | |
required init?(coder: NSCoder) { nil } | |
/* | |
Cory Benfield - Building State Machines in Swift | |
https://www.youtube.com/watch?v=7UC7OUdtY_Q | |
What is a Finite State Machine? | |
- Structured way to represent computation | |
- System can be in one of a finite number of states at any time | |
- Reacts to inputs by changing state, and optionally producing a side effect | |
- Deterministic and nondeterministic flavors | |
- Simple model of computation: easy to understand |