Skip to content

Instantly share code, notes, and snippets.

@oalansari82
oalansari82 / iterm2-solarized.md
Created August 6, 2021 03:09 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@oalansari82
oalansari82 / swiftui-resize-image-and-maintain-aspect-ratio.swift
Created July 9, 2021 15:23 — forked from karigrooms/swiftui-resize-image-and-maintain-aspect-ratio.swift
ViewModifier for resizing images in SwiftUI. Resize an image to any size (square, circle, rectangle) while maintaining its aspect ratio.
import SwiftUI
/// Common aspect ratios
public enum AspectRatio: CGFloat {
case square = 1
case threeToFour = 0.75
case fourToThree = 1.75
}
/// Fit an image to a certain aspect ratio while maintaining its aspect ratio
@oalansari82
oalansari82 / AdaptsToSoftwareKeyboard.swift
Created June 6, 2020 20:43 — forked from scottmatthewman/AdaptsToSoftwareKeyboard.swift
An example of using Combine to automatically adapt a SwiftUI scrollable view to accommodate an iOS onscreen keyboard
import SwiftUI
import Combine
struct AdaptsToSoftwareKeyboard: ViewModifier {
@State var currentHeight: CGFloat = 0
func body(content: Content) -> some View {
content
.padding(.bottom, currentHeight)
.edgesIgnoringSafeArea(.bottom)