Skip to content

Instantly share code, notes, and snippets.

View uruly's full-sized avatar
☂️

Reo uruly

☂️
View GitHub Profile
// Author: SwiftUI-Lab (www.swiftui-lab.com)
// Description: This code is part of the "Advanced SwiftUI Animations - Part 5"
// Article: https://swiftui-lab.com/swiftui-animations-part5/
import SwiftUI
struct ContentView: View {
var body: some View {
DigitalRain()
}
@chipjarred
chipjarred / CGKeyCode_Extension.swift
Last active February 19, 2024 02:59
Querying macOS if a key is pressed
import CoreGraphics
extension CGKeyCode
{
/*
* From Events.h in Carbon.framework
* Summary:
* Virtual keycodes
*
* Discussion:
@chriszielinski
chriszielinski / Image+Trim.swift
Last active December 26, 2023 03:27
[Swift 5] NSImage/UIImage Crop/Trim Transparency
// Image+Trim.swift
//
// Copyright © 2020 Christopher Zielinski.
// https://gist.github.com/chriszielinski/aec9a2f2ba54745dc715dd55f5718177
//
// 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
@dragon788
dragon788 / win10_binary_fission.md
Last active April 19, 2024 09:26
Making the Windows 10 "chubby" install.wim compatible with a FAT32 USB so a UEFI bootable USB can be created from Linux/macOS/ChromeOS

MAGIC aka Making Anything Gruelingly "Impossible" Coherent

Whatever operating system you are using to create the USB, you will need to have a Windows 10 ISO, either from Microsoft or your system manufacturer and have a USB drive 8GB or larger (or one with at least 5GB of free space and using the FAT32 filesystem, but using a fresh and empty one is best).

TL;DR

#macOS/Linux
# First try the `bootiso` program, it has options for splitting the WIM for you!
# https://jsamr.github.io/bootiso/
# You need to already have 7zip aka `p7zip` on macOS and Linux, and `wimlib` macOS via `brew` or `wimtools` on Linux
@lexrus
lexrus / RxTextFieldDelegateProxy.swift
Created February 14, 2018 03:33
RxSwift extension for textFieldShouldReturn of UITextFieldDelegate
//
// RxTextFieldDelegateProxy.swift
//
// Created by Lex Tang on 2/14/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxSwift
import RxCocoa
@mttcrsp
mttcrsp / UITableView+beginRefreshing.swift
Last active February 21, 2021 00:00
Extension that allows programmatic pull to refresh
import UIKit
public extension UITableView {
public func beginRefreshing() {
// Make sure that a refresh control to be shown was actually set on the view
// controller and the it is not already animating. Otherwise there's nothing
// to refresh.
guard let refreshControl = refreshControl, !refreshControl.isRefreshing else {
return
@gamako
gamako / UIViewController+ScrollWhenShowKeyboard.swift
Last active October 4, 2019 09:13
UITextViewやUITextFieldがキーボードで隠れないようにスクロールする処理を、RxSwift, RxCocoaを使って1メソッドでセットできるようにしました
//
// UIViewController+ScrollWhenShowKeyboard.swift
//
//
import UIKit
import RxSwift
import RxCocoa
extension UIViewController {
@raphaelhanneken
raphaelhanneken / NSImageExtensions.swift
Last active August 24, 2023 01:04
NSImage extensions for easy resizing, cropping and saving png images.
//
// NSImageExtensions.swift
//
import Cocoa
extension NSImage {
/// The height of the image.
var height: CGFloat {