Skip to content

Instantly share code, notes, and snippets.

View Jomy10's full-sized avatar

Jonas Everaert Jomy10

View GitHub Profile
@Jomy10
Jomy10 / HandleAboutMac.java
Last active January 15, 2022 18:49
This class lets you customise the about menu for Mac users (Java/JavaFX)
// When you call new HandleAboutMac(), it will set the action on what has to be done when a Mac user selects the about menu
// in [your app name] > about [your app name]
public class HandleAboutMac {
public HandleAboutMac() {
com.apple.eawt.Application application = com.apple.eawt.Application.getApplication();
application.setAboutHandler(new AboutHandler() {
@Override
public void handleAbout(AppEvent.AboutEvent aboutEvent) {
// This is where your code goes for what has to be done when a Mac user selects the about menu
// For example:
@Jomy10
Jomy10 / ImageShareSheet.swift
Last active November 11, 2021 21:16
SwiftUI Image Share Sheet
import Foundation
import SwiftUI
/// A view for sharing an image. The user can add the image to their cameraroll, share it via iMessage, etc.
struct ImageShareSheet: UIViewControllerRepresentable {
/// The images to share
let images: [UIImage]
func makeUIViewController(context: Context) -> some UIViewController {
let activityViewController = UIActivityViewController(activityItems: images, applicationActivities: nil)
@Jomy10
Jomy10 / rust_in_swift.md
Last active May 2, 2024 05:59
Calling Rust library from Swift code (creating executable)

Calling a Rust library from Swift

This gist shows a quick overview of calling Rust in a Swift project, with Swift Package Manager configured.

Let's go ahead and create a folder containing all our sources:

mkdir swift-rs && cd $_
@Jomy10
Jomy10 / # Lightbox in SwiftUI.md
Last active March 1, 2024 07:36
Lightbox in SwiftUI

Lightbox in SwiftUI

This gist shows a wrapper around Lightbox, a convenient and easy to use image viewer for iOS, for SwiftUI.

This gist contains 2 files:

@Jomy10
Jomy10 / #Useful-Swift-Packages.md
Last active February 2, 2022 15:58
Useful Swift packages

Useful Swift Packages

This is a list of packages that I have used throughout my own projects. Most packages that have something to do with UI are for SwiftUI and if not I'll leave an explanation of how to use them within SwiftUI.

UI

Messages

  • AlertToast
    • Has a beutiful collection of toast messages. Including animated checkmarks, etc. Very easy to use and well documented.

Images

@Jomy10
Jomy10 / nodes.swift
Created April 13, 2022 15:36
Graph Search Algorithms in 100 Seconds - And Beyond with Swiftt
#!/usr/bin/env swift
// This is a Swift implementation of Fireship's "Graph Search Algorithms in 100 seconds - And beyond with JS" video
// You can find it here: https://www.youtube.com/watch?v=cWNEl4HE2OE
let airports = "PHX BKK OKC JFK LAX MEX HEL LAP LIM".split(separator: " ")
let routes = [
["PHX", "LAX"],
["PHX", "JFK"],
@Jomy10
Jomy10 / 0 - README.md
Last active May 2, 2022 17:20
Move any event to a player in RPG Maker

Player follower

This plugin for RPG Maker MV (should work for MZ as well) moves any event marked with to the player.

Installation

Copy playerFollower.js to project folder > js > plugins and then select the plugin in the plugin menu.

Usage

@Jomy10
Jomy10 / Create_RPG_Maker_MV_Plugins.md
Created May 9, 2022 15:47
Create RPG Maker MV Plugins

Creating RPG Maker MV Plugins

(incomplete tutorial)

Your first plugin

/*:
* @author Me
* @plugindesc This plugin outputs hello world
*
@Jomy10
Jomy10 / DMSToDegree.vb
Created December 17, 2022 16:57
VBA Script to convert a coordinate to longitude and latitude in Excel (DMS to degrees)
'Parse a coordinate to an array of numbers containing hours, minutes, seconds (still represented as strings)
Private Function ParseCoOne(Co As String) As String()
Dim parsed(3) As String
Dim tmp() As String
tmp = Split(Co, "°")
parsed(0) = tmp(0)
tmp = Split(tmp(1), "'")
parsed(1) = tmp(0)
@Jomy10
Jomy10 / RWLock.swift
Last active May 29, 2023 15:46
A read-write lock implementation for Swift
//
// RWLock.swift
//
// MIT License
//
// Copyright (c) 2023 Jonas Everaert
//
// 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 without restriction, including without limitation the rights