- Clone the repo.
- Use
git rebase -i --root
- vim will open. Select the commits you want to modify by changing
pick
toedit
. If you would like to change all the commits, perform the following replace::%s/^pick/edit/g
. This command changes all instances of "pick" at the start of lines to "edit". - You will now be shown all the selected commits one by one. Each commit message will be displayed. You have two options:
- If you would like to keep the commit author details the same, do a
git rebase --continue
. - If you would like to change it to a different name/email, do
git commit --amend --reset-author
. If--reset-author
is specified, it will use the details from your git config. (If you need to specify an alternate name/email, you can do so with--author="John Doe <john@example.com>"
. If you would like to change the time to a previous date, you can do so with--date "2 days ago"
.)
- If you would like to keep the commit author details the same, do a
- Do the same for all the commits and finish the rebase.
- Perform
git push -f origin master
to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSNotification.Name { | |
public static let deviceDidShakeNotification = NSNotification.Name("MyDeviceDidShakeNotification") | |
} | |
extension UIWindow { | |
open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { | |
super.motionEnded(motion, with: event) | |
NotificationCenter.default.post(name: .deviceDidShakeNotification, object: event) | |
} | |
} | |
extension View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum AsyncError: Error { | |
case finishedWithoutValue | |
} | |
extension AnyPublisher { | |
func async() async throws -> Output { | |
try await withCheckedThrowingContinuation { continuation in | |
var cancellable: AnyCancellable? | |
var finishedWithoutValue = true | |
cancellable = first() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UDPListener.swift | |
// | |
// Created by Michael Robert Ellis on 12/16/21. | |
// | |
import Foundation | |
import Network | |
import Combine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: The SwiftUI-Lab | |
// This code is part of the tutorial: https://swiftui-lab.com/swiftui-animations-part4/ | |
import SwiftUI | |
// Sample usage | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
GifImage(url: URL(string: "https://media.giphy.com/media/YAlhwn67KT76E/giphy.gif?cid=790b7611b26260b2ad23535a70e343e67443ff80ef623844&rid=giphy.gif&ct=g")!) | |
.padding(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AnyPublisher where Failure: Error { | |
struct Subscriber { | |
fileprivate let send: (Output) -> Void | |
fileprivate let complete: (Subscribers.Completion<Failure>) -> Void | |
func send(_ value: Output) { self.send(value) } | |
func send(completion: Subscribers.Completion<Failure>) { self.complete(completion) } | |
} | |
init(_ closure: (Subscriber) -> AnyCancellable) { |
On Mac, SwiftUI's .onHover
closure is not always called on mouse exit, particularly with high cursor velocity. A grid of targets or with finer target shapes will often have multiple targets falsely active after the mouse has moved on.
It is easy to run back to AppKit's safety. Below is a SwiftUI-like modifier for reliable mouse-tracking. You can easily adapt it for other mouse tracking needs.
import SwiftUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct HalfShape: Shape { | |
let left: Bool | |
func path(in rect: CGRect) -> Path { | |
return Path { path in | |
let width = rect.width | |
let height = rect.height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2019–20 Adam Sharp and thoughtbot, inc. | |
// | |
// 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: | |
// | |
// The above copyright notice and this permission notice shall be included in |
NewerOlder