Skip to content

Instantly share code, notes, and snippets.

View VAndrJ's full-sized avatar

VAndrJ VAndrJ

  • Ukraine
  • 00:04 (UTC +02:00)
View GitHub Profile
@VAndrJ
VAndrJ / SpreadsheetView.swift
Created August 16, 2024 13:34 — forked from natpenguin/SpreadsheetView.swift
A view like spreadsheet in SwiftUI
import SwiftUI
struct SpreadsheetView<ColumnView: View, RowView: View, ContentView: View, Column: Hashable, Row: Hashable>: View {
init(
columns: [Column],
rows: [Row],
columnWidth: CGFloat,
columnHeight: CGFloat,
rowWidth: CGFloat,
rowHeight: CGFloat,
@VAndrJ
VAndrJ / gist:d1b96cfef253aa66b6b9ab151a659b00
Created April 2, 2023 09:44 — forked from CrookedNumber/gist:8964442
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@VAndrJ
VAndrJ / iOSLogMacros.m
Created August 8, 2019 07:33 — forked from heavenlyfodder/iOSLogMacros.m
Objective-C macros to aid in iOS app debug logging
// mmcneely: From http://stackoverflow.com/questions/969130/nslog-tips-and-tricks
// - DLog prints output to the console, but only if the DEBUG symbol is defined
// - ALog prints output to the console no matter what
// - ULog pops up window on the device (or simulator)
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
@VAndrJ
VAndrJ / FixedSafeAreaLayoutConstraint.swift
Created July 18, 2018 12:32 — forked from filletofish/FixedSafeAreaLayoutConstraint.swift
Constraint that can be updated with safe area but only once
import UIKit
/// Work around problem described here: https://stackoverflow.com/questions/47223680/safe-area-changes-in-parent-vc-when-presenting-modally-vc-in-landscape
/// When presenting screen with another orientation safe area changes on first screen
/// that affects constraints and all layout that depends on safe area.
/// To avoid this bug one should use UCFixedSafeAreaLayoutConstraint that can be updated with safe
/// area inset using `updateAllFixedSafeAreaConstraints(newSafeAreaInsets:)` in UIViewController
///
///
///
@VAndrJ
VAndrJ / ComposeView.swift
Created March 3, 2018 09:10 — forked from ahbou/ComposeView.swift
iPhone X InputAccessoryView Fix
//
// ComposeView.swift
import UIKit
class ComposeView: UIView {
// ........
// Other layout code and methods
// ........