Skip to content

Instantly share code, notes, and snippets.

View YannisDC's full-sized avatar

Yannis De Cleene YannisDC

View GitHub Profile
@YannisDC
YannisDC / trustpilot.py
Created March 24, 2023 19:45
Gets Reviews from Trustpilot and plots them
import requests
from bs4 import BeautifulSoup
import csv
def fetch_reviews(company_name):
# Initialize variables
url = f"https://www.trustpilot.com/review/{company_name}"
reviews_list = []
while url:
@YannisDC
YannisDC / SimultaneousMultiRoundAuctions.swift
Created November 18, 2020 16:45
This is just a training style problem solve to the 2020 Nobel Prize in Economics
import UIKit
// https://www.nobelprize.org/prizes/economic-sciences/2020/summary/
// All objects are auctioned simultaneously
// Bidder silently post their bids
// At the end of the first round the bidders can see all the bids and decide if they want to increase their bids or withraw their bid for thee next round
// The rounds keep going until we have a round where no more bids are placed or no more bids are withdrawn
enum LotAction {
case bid(offer: Double)
@YannisDC
YannisDC / workaroundrepository.swift
Created November 7, 2020 18:41
grpc workaround2
import Foundation
import Combine
import Resolver
class RESTFirestoreGalleryCollectionRepository: BaseCollectionRepository, GalleryCollectionRepository, ObservableObject {
let objectsPath: String = "objects"
let collectionsPath: String = "collections"
private static let imageProcessingQueue = DispatchQueue(label: "image-processing")
private var cancellables = Set<AnyCancellable>()
@YannisDC
YannisDC / grpc.swift
Last active November 7, 2020 18:38
grpc workaround
import Foundation
struct StringValue: Codable {
var stringValue: String?
}
struct IntValue: Codable {
var integerValue: String?
}
@YannisDC
YannisDC / Apple Card Demo
Created September 20, 2019 14:06
Simple Apple Card Combined Radial Gradient Demo
import SwiftUI
struct ContentView: View {
@State var show = false
var body: some View {
VStack{
ZStack{
Rectangle()
.fill(Color.white)
import Cocoa
fileprivate extension CodingUserInfoKey {
static let fragmentBoxedType = CodingUserInfoKey(rawValue: "CodingUserInfoKey.fragmentBoxedType")!
}
extension JSONDecoder {
private struct FragmentDecodingBox<T : Decodable> : Decodable {
var value: T
init(from decoder: Decoder) throws {
@YannisDC
YannisDC / HackyCombinePropertyLevelEncryption.swift
Created April 4, 2019 18:55
This works but not sure how fragile
import Cocoa
fileprivate extension CodingUserInfoKey {
static let fragmentBoxedType = CodingUserInfoKey(
rawValue: "CodingUserInfoKey.fragmentBoxedType"
)!
}
extension JSONDecoder {
private struct FragmentDecodingBox<T : Decodable> : Decodable {
import Cocoa
struct Person: Codable {
let name: String
let age: Int
let friends: [Person]?
}
let person = Person(name: "Brad", age: 53, friends: nil)
protocol Identifiable {
@YannisDC
YannisDC / CodablePropertyLevelEncryption.swift
Last active April 4, 2019 15:14
Playground that shows propertyLevel encryption for Blockstack Byte option
import Cocoa
struct Person: Codable {
let name: String
let age: Int
let friends: [Person]?
}
let person = Person(name: "Brad", age: 53, friends: nil)
protocol Identifiable {
@YannisDC
YannisDC / PropertyLevelEncryption.swift
Last active April 4, 2019 12:58
Playground that shows propertyLevel encryption for Blockstack (Byte option not included yet)
import Cocoa
protocol Identifiable {
var uuid: String { get set }
}
protocol Encryptable {
var encrypted: Bool { get }
func encrypt()