Skip to content

Instantly share code, notes, and snippets.

View imxieyi's full-sized avatar

Yi Xie imxieyi

View GitHub Profile
@JunyuKuang
JunyuKuang / OverrideCatalystScaleFactor.swift
Last active April 9, 2025 18:12
Disable 77% scaling for Mac Catalyst apps. (Swift)
let overrideCatalystScaleFactor: Void = {
guard let sceneViewClass = NSClassFromString("UINSSceneView") as? NSObject.Type else {
return
}
if sceneViewClass.instancesRespond(to: NSSelectorFromString("scaleFactor")) {
// old
swizzleInstanceMethod(
class: sceneViewClass,
originalSelector: NSSelectorFromString("scaleFactor"),
swizzledSelector: #selector(swizzle_scaleFactor)
@darrarski
darrarski / CustomIntensityVisualEffectView.swift
Last active January 22, 2026 10:52
UIVisualEffectView subclass that allows to customise effect intensity
// MIT License
//
// Copyright (c) 2017 Dariusz Rybicki Darrarski
//
// 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
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@drguildo
drguildo / PasswordDialog
Last active June 22, 2024 13:18
JavaFX doesn't have a password dialog, so I wrote one.
package io.sjm.diary;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.PasswordField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
@hacha
hacha / Binding.cs
Created February 25, 2014 12:01
UnityのNativePluginで、Unity側のC#スクリプトからbyte配列を渡したり、プラグイン側からbyte配列を受け取る方法
using UnityEngine;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System;
public class Binding {
[DllImport("__Internal")]
private static extern bool Test(byte[] ptrSrc, int srcLength, ref IntPtr ptrDest, ref int destLength);