Skip to content

Instantly share code, notes, and snippets.

View florentmorin's full-sized avatar
🏠
Working from home

Florent Morin florentmorin

🏠
Working from home
View GitHub Profile
@florentmorin
florentmorin / MyApp.swift
Created February 14, 2024 11:07
Track scenes state on SwiftUI with visionOS
import SwiftUI
/// Main Window content
private struct MainView: View {
@Environment(\.appState) private var appState
@Environment(\.openWindow) private var openWindow
var body: some View {
NavigationStack {
VStack {
@florentmorin
florentmorin / ContentView.swift
Created June 2, 2021 09:57
A SwiftUI Burger menu
//
// ContentView.swift
// SwiftUIBurgerMenu
//
// Created by Florent Morin on 02/06/2021.
//
import SwiftUI
import Foundation
@florentmorin
florentmorin / DarwinNotificationCenter.swift
Last active November 29, 2022 21:51 — forked from AvdLee/DarwinNotificationCenter.swift
A notification center for Darwin Notifications. MIT License applies.
//
// DarwinNotificationCenter.swift
//
// Copyright © 2017 WeTransfer. All rights reserved.
//
// Source: https://gist.github.com/florentmorin/35b15837cd4fb2a2a0630dbdf41d09aa
// Original: https://gist.github.com/AvdLee/07de0b0fe7dbc351541ab817b9eb6c1c
import Foundation
@florentmorin
florentmorin / DOSE-VACCIN-SCRIPTABLE.md
Last active April 9, 2021 11:14
Script « Vite ma dose de vaccin » pour Scriptable

Installation

  1. Télécharger l'app gratuite Scriptable.
  2. Coller le code de vaccin.js dans un nouveau script Scriptable
  3. Configurer le script (instructions dans le code)

Configurer le widget

  1. Ajouter un widget Scriptable
  2. Configurer le widget en sélectionnant votre script
@florentmorin
florentmorin / UserProtocol.swift
Last active October 16, 2020 18:47
`URLProtocol` sample code
struct User: Encodable {
let firstName: String
let lastName: String
let admin: Bool
}
final class UserProtocol: URLProtocol {
override class func canInit(with request: URLRequest) -> Bool {
return true // Customize here
@florentmorin
florentmorin / darkmode.css
Last active April 13, 2020 21:42
Mode sombre et accessibilité
h1 {
color: black;
}
@media (prefers-color-scheme: dark) {
h1 {
color: white;
}
}
@florentmorin
florentmorin / TopMostViewController.swift
Created June 30, 2019 11:05
Top Most View Controller in UIKit
import UIKit
extension UIViewController {
/// Top most view controller in view hierarchy
var topMostViewController: UIViewController {
// No presented view controller? Current controller is the most view controller
guard let presentedViewController = self.presentedViewController else {
return self
@florentmorin
florentmorin / ContentView.swift
Last active April 13, 2024 17:15
A small hack to make `MFMailComposeViewController` and `MFMessageComposeViewController` working fine with SwiftUI
//
// ContentView.swift
// MailDemo
//
// Created by Florent Morin on 29/06/2019.
// Copyright © 2019 Morin Innovation. All rights reserved.
//
// Medium link: https://medium.com/@florentmorin/messageui-swiftui-and-uikit-integration-82d91159b0bd
// Sample source code: https://github.com/florentmorin/SwiftUIAndMessageUI
@florentmorin
florentmorin / README.md
Last active February 11, 2018 13:47
Simple exemple d'empreinte SHA-256

Signature via hachage SHA-256

Le fichier test.txt est le fichier signé.

Le fichier test.txt.sha256 est sa signature.

Le script calculate_checksum.sh permet de générer la signature.

@florentmorin
florentmorin / requete.http
Created February 11, 2018 13:33
Requête HTTP Basique
GET /monsite.html HTTP/1.1
Host: www.monsite.com
Connection: Close