Skip to content

Instantly share code, notes, and snippets.

View jordibruin's full-sized avatar

Jordi Bruin jordibruin

View GitHub Profile
# setup
# pip install cryptography pyjwt
# ref.
# http://gobiko.com/blog/token-based-authentication-http2-example-apns/
import jwt
import time
ALGORITHM = 'ES256'
//
// SamView.swift
// CloudKit-UI-test
//
// Created by Jordi Bruin on 03/07/2020.
// Copyright © 2020 Good Snooze. All rights reserved.
//
import SwiftUI
@jordibruin
jordibruin / ReviewTabView.swift
Created October 14, 2020 23:23
Simple App Store Review showcase in SwiftUI
struct ReviewTabView: View {
var reviews: [Review] = [
Review(title: "Great app", reviewer: "Maartje Derks", text: "This app really makes my life so much easier. Can't wait to use it."),
Review(title: "Great app", reviewer: "Maartje Derks", text: "This app really makes my life so much easier. Can't wait to use it."),
Review(title: "Great app", reviewer: "Maartje Derks", text: "This app really makes my life so much easier. Can't wait to use it."),
Review(title: "Great app", reviewer: "Maartje Derks", text: "This app really makes my life so much easier. Can't wait to use it."),
]
@State var selectedIndex = 0
@State var timer = Timer.publish(every: 4, on: .main, in: .common).autoconnect()
//
// ContentView.swift
// constraint test
//
// Created by Jordi Bruin on 01/04/2021.
//
import SwiftUI
// 1. Click the "Open Detail View" button
enum ThemeMode: CaseIterable {
case light
case dark
case system
var text: String {
switch self {
case .light:
return "Light"
case .dark:
class FloatingPanel: NSPanel {
init(contentRect: NSRect, backing: NSWindow.BackingStoreType, defer flag: Bool) {
// Not sure if .titled does affect anything here. Kept it because I think it might help with accessibility but I did not test that.
super.init(contentRect: contentRect, styleMask: [.nonactivatingPanel, .resizable, .closable, .fullSizeContentView], backing: backing, defer: flag)
// Set this if you want the panel to remember its size/position
// self.setFrameAutosaveName("a unique name")
// Allow the pannel to be on top of almost all other windows
JSON:
https://unpkg.com/[email protected]/emoji.json
class EmojiManager: ObservableObject {
@Published var emojis: [EmojiObject] = []
init() {
decodeJSON()
@jordibruin
jordibruin / CGSPrivate.h
Created April 24, 2022 09:54 — forked from rjw57/CGSPrivate.h
CGSPrivate.h - undocumented APIs for OSX. Re-licensed under MIT licence.
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* This file is a relicensed portion of DesktopManager and was originally released under
* the terms of the GNU General Public Licence. Original licence text follows the new terms.
* The contents of this file has been re-released by the original author under the following terms:
*
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
@jordibruin
jordibruin / gist:7d0c24d0268bd7aadc5a0203f33583ae
Created July 1, 2022 12:35
BookCover generator for Paper app
//
// ContentView.swift
// BookCover
//
// Created by Jordi Bruin on 01/07/2022.
//
import SwiftUI
struct ContentView: View {
import SwiftUI
@main
struct MenuBarApp: App {
@NSApplicationDelegateAdaptor(StatusBarDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()