Skip to content

Instantly share code, notes, and snippets.

View kaishin's full-sized avatar

Reda Lemeden kaishin

View GitHub Profile
@maxidorius
maxidorius / notes.md
Last active November 16, 2023 00:05
Notes on privacy and data collection of Matrix.org

Notes on privacy and data collection of Matrix.org


This version of the document is no longer canonical. You can find the canonical version hosted at Gitlab and Github.

PART 2 IS OUT, INCLUDING THE DISCLOSURE OF A GLOBAL FEDERATION DATA LEAK, AND THE ANATOMY OF A GDPR DATA REQUEST HANDLED BY MATRIX.ORG. SEE THE REPOS ABOVE.

import SwiftUI
struct NumbersCollectionView : UIViewRepresentable {
@Binding var numbers: [Int]
func makeUIView(context: Context) -> UICollectionView {
let layout = UICollectionViewFlowLayout()
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = .white
@simonliotier
simonliotier / SwiftUI+CustomFonts+DynamicType.swift
Last active December 11, 2019 14:27
Example of how to get Dynamic Type with custom fonts in SwiftUI
import SwiftUI
/// Example of how to get Dynamic Type with custom fonts in SwiftUI.
struct ContentView: View {
var body: some View {
VStack(spacing: 20) {
Text("A large title").customFont(.largeTitle) // "Optima-ExtraBlack", 28
Text("A body").customFont(.body) // "Kailasa", 16
Text("A caption").customFont(.caption2) // "IowanOldStyle-Italic", 11
}
@brimelow
brimelow / ContentView.swift
Created June 13, 2019 07:51
Random 100 Circles Animation in SwiftUI
//
// ContentView.swift
// DrawingGroup
//
// Created by Lee Brimelow on 6/12/19.
// Copyright © 2019 Lee Brimelow. All rights reserved.
//
import SwiftUI
@alexito4
alexito4 / RemoteImage.swift
Last active August 19, 2020 15:32
Rough sketch of SwiftUI RemoteImage using AlamofireImage
import SwiftUI
import Combine
import AlamofireImage
let imageDownloader = ImageDownloader(
configuration: ImageDownloader.defaultURLSessionConfiguration(),
downloadPrioritization: .fifo,
maximumActiveDownloads: 4,
imageCache: AutoPurgingImageCache()
)
import Foundation
public struct SandwichError: Error, Equatable, CustomStringConvertible {
private enum SandwichErrorCode: Int {
case tooLittleSalami = 1
case tooLittleMustard
case noTomatoes
case noBread
}
@IanKeen
IanKeen / DictionaryDecoder.swift
Created March 1, 2019 18:43
DictionaryDecoder
import Foundation
class DictionaryDecoder {
init() { }
func decode<T: Decodable>(_ type: T.Type, from data: [String: Any]) throws -> T {
let decoder = _Decoder(codingPath: [], source: data)
return try T(from: decoder)
}
}
@pjobson
pjobson / plex_media_permissions_4_noobies.md
Last active April 21, 2024 21:37
Plex Media Permissions for Linux Noobies

Plex Media Permissions for Linux Noobies

There is no problem with being a noobie and I do not use the term to sligtht or disparage anyone.

This is a way to setup your permissions for running Plex in Linux. Different folks may use different methods.

The permissions concepts provided here apply to OSX, but the users and groups are controlled and modified differently, so much of this will not work properly. I think the command is dscl, but that could be out of date.

There are many ways to setup your permissions scheme in Linux, this methodology describes a way to do it, not everyone will like it, but it works for me, so whatever.

@insidegui
insidegui / PwnageVerifier.swift
Last active September 30, 2018 11:42
Uses the pwnedpasswords API to verify password integrity
/*
By default, this class requires https://github.com/idrougge/sha1-swift to work,
you can replace the default SHA1 implementation by setting the hash property to a function
that takes a String and returns an optional String (the SHA1 hex string of the input)
*/
/// Uses the pwnedpasswords API to verify password integrity
public final class PwnageVerifier {
/// The base URL for the pwnedpasswords service (a default is provided by the initializer)
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}