Skip to content

Instantly share code, notes, and snippets.

View winstonjay's full-sized avatar
🍏
Eating an apple

Karl Sims winstonjay

🍏
Eating an apple
View GitHub Profile
import Foundation
// use cases that only need to return a value
public struct ValueProvider<Output>: Sendable {
private var provider: @Sendable () -> Output
public init(provider: @escaping @Sendable () -> Output) {
self.provider = provider
}
@winstonjay
winstonjay / DynamicTypeStack.swift
Last active March 15, 2024 13:56
Dynamically Stacking Items in Swift UI based on DynamicTypeSize
//
// DynamicTypeStack.swift
//
// Created by Karl Sims on 15/03/2024.
//
import SwiftUI
struct DynamicTypeStack<Content: View>: View {
@Environment(\.dynamicTypeSize) var dynamicTypeSize
/*
tfidf.js provides a class which provides methods and data structures for the
creating a tf-idf vector representation of a collection of documents.
It also provides added methods for comparing documents through cosine
similarity.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
## Tf-Idf
'''
delete_tweets.py
Helps deletes all your tweets 1000 at a time.
NOTE: WARNING THIS WILL DELETE APPROXIMATELY 750 TWEETS OF THE AUTHORISED
ACCOUNT THAT IS ACCESSING THE API. THIS CANNOT BE UNDONE.
NOTE: Requires app authentication from https://apps.twitter.com/ with read -
write privileges. You set your authentication tokens as enviroment varibles
@winstonjay
winstonjay / gameOfLife.py
Last active September 20, 2017 00:51
Conway's game of life...
"""
Conway's Game of Life.
Fundamental Rules:
1) Any live cell with fewer than two live neighbors dies,
as if caused by underpopulation.
2) Any live cell with more than three live neighbors dies,
as if by overcrowding.