Skip to content

Instantly share code, notes, and snippets.

View jfversluis's full-sized avatar

Gerald Versluis jfversluis

View GitHub Profile
@jfversluis
jfversluis / xcrun_simctl_cheatsheet.md
Created March 28, 2024 09:55 — forked from patriknyblad/xcrun_simctl_cheatsheet.md
iOS Simulator Terminal Commands `$ xcrun simctl`

Managing iOS Simulators

List all simulators created

$ xcrun simctl list --json

Delete old and unavailable simulators

$ xcrun simctl delete unavailable
@jfversluis
jfversluis / FCMService.cs
Created May 23, 2022 13:40 — forked from svedmark/FCMService.cs
Minimal FCM Push Messaging for .NET MAUI (RC3)
using Android.App;
using Android.Content;
using AndroidX.Core.App;
using Firebase.Messaging;
namespace FCMApp.Android;
[Service(Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class FCMService : FirebaseMessagingService
@jfversluis
jfversluis / MainPage.cs
Created February 13, 2023 13:03
Toggle fullscreen, minimize and maximize buttons in .NET MAUI Windows through event handlers
#if WINDOWS
private Microsoft.UI.Windowing.AppWindow GetAppWindow(MauiWinUIWindow window)
{
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
return appWindow;
}
#endif
@jfversluis
jfversluis / HtmlLabel.xaml
Created August 30, 2019 08:55
Showing HTML in a Xamarin.Forms label with a HTML encoded string
<Label TextType="Html">
<Label.Text>
&lt;h1&gt;Hello World!&lt;/h1&gt;&lt;br/&gt;SecondLine
</Label.Text>
</Label>
@jfversluis
jfversluis / MauiProgram.cs
Created March 8, 2023 18:44
Use the new Windows App SDK Backdrop API in .NET MAUI
using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
#if WINDOWS
using Microsoft.UI.Xaml.Media;
#endif
namespace MauiApp1;
public static class MauiProgram
{
@jfversluis
jfversluis / MauiProgram.cs
Created February 13, 2023 12:45
Set .NET MAUI Window as fullscreen on Windows
#if WINDOWS
builder.ConfigureLifecycleEvents(events =>
{
// Make sure to add "using Microsoft.Maui.LifecycleEvents;" in the top of the file
events.AddWindows(windowsLifecycleBuilder =>
{
windowsLifecycleBuilder.OnWindowCreated(window =>
{
window.ExtendsContentIntoTitleBar = false;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
@jfversluis
jfversluis / Entitlements.plist
Created October 25, 2022 07:28
EmptyEntitlementsPlist
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
@jfversluis
jfversluis / gpg-signing.md
Created May 17, 2022 10:59 — forked from xavierfoucrier/gpg-signing.md
GPG signing with Git and Github Desktop

Hi Github users,

You can now signed your commits on Github using at least Git 2.18.0 and Github Desktop 1.6.1.

  1. Generate a GPG key and add it to Github: https://help.github.com/articles/generating-a-new-gpg-key (if you don't want to type a passphrase on every commit, you need to press "Enter" when the console will prompt you to type a passphrase)

  2. Configure Git properly by editing the .gitconfig file using the command line git config --global --edit in a terminal, then replace YOUR_GITHUB_EMAIL, YOUR_SIGNING_KEY and GPG_BINARY_PATH with your data

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.1.0-pre.3.0
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
PS C:\Users\joverslu\source\repos\MauiApp14> dotnet publish -f:net6.0-ios -c:Release /p:ServerAddress=192.168.1.77 /p:ServerUser=jfversluis /p:TcpPort=58181 /p:ArchiveOnBuild=true /p:_DotNetRootRemoteDirectory=/Users/jfversluis/Library/Caches/Xamarin/XMA/SDKs/dotnet/
Microsoft (R) Build Engine version 17.1.0-preview-21572-15+513f59ce4 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
@jfversluis
jfversluis / FriendlyUrlHelper.cs
Last active September 22, 2021 07:15
Helper class to generate a slug
// Totally ripped from how Stackoverflow does it: https://stackoverflow.com/questions/25259/how-does-stack-overflow-generate-its-seo-friendly-urls/25486
public static class FriendlyUrlHelper
{
public static string GetFriendlyTitle(string title, bool remapToAscii = false, int maxlength = 80)
{
if (title == null)
{
return string.Empty;
}