Skip to content

Instantly share code, notes, and snippets.

View richy486's full-sized avatar
🐶
Experimenting

Richard Adem richy486

🐶
Experimenting
View GitHub Profile
@richy486
richy486 / IdentityTest.swift
Created January 18, 2022 21:33
Animate between container views with `matchedGeometryEffect`
import SwiftUI
import PlaygroundSupport
// https://www.hackingwithswift.com/quick-start/swiftui/how-to-synchronize-animations-from-one-view-to-another-with-matchedgeometryeffect
struct AdaptiveStack<Content: View>: View {
var content: () -> Content
@Binding var vertical: Bool
init(vertical: Binding<Bool>, @ViewBuilder content: @escaping () -> Content) {
_vertical = vertical
@richy486
richy486 / new_mac.md
Last active April 17, 2024 14:45
New Mac

New Mac

Finder

Show file extensions

Finder > Settings, then click Advanced. Select or deselect "Show all filename extensions"

Hidden files

toggle:

@richy486
richy486 / SwiftOptionSet.md
Last active December 2, 2018 02:56
Swift OptionSet binary operations
// Is this a good shorthand instead of using a switch?
enum State {
case running
case jumping
}
var currentState: State = .running
let stateView = currentState.transform {[
@richy486
richy486 / absoluteTrivialStateDerivative.swift
Created June 15, 2018 15:05
Absolute Trivial State Derivative
enum Action: Int {
case buttonDown
}
struct State {
var counter: Int = 0
}
struct View {
var height: Float
@richy486
richy486 / statusEmoji.txt
Last active December 21, 2017 22:23
🔨🤖 Status Emoji, For team updates
Design
🎨 Sketch files
🌊 UI Flow
🖍 Colors
😎 Style guide
🖼 Images
Code
🐦 Swift
🔨 Xcode
@richy486
richy486 / xcClean.sh
Last active November 22, 2019 18:28
Xcode clean up
#!/bin/bash
# Clean Xcode files
# @richy486 https://gist.github.com/richy486
# http://ajithrnayak.com/post/95441624221/xcode-users-can-free-up-space-on-your-mac
STATUS='\033[0;36m'
WARNING='\033[0;33m'
ERROR='\033[0;31m'
CMD='\033[0;92m'
NC='\033[0m' # No Color
@richy486
richy486 / A_SublimeSettings.md
Last active October 5, 2023 23:24
VSCode settings

VSCode settings

Stop the beeping

~/Library/KeyBindings/DefaultKeyBinding.dict

Key Bindings

~/Library/Application\ Support/Code/User/keybindings.json

Settings

@richy486
richy486 / UITextField+Rx+Extensions.swift
Created June 20, 2017 21:57
Rx filter for text fields, doesn't really work with other observers
//
// UITextField+Rx+Extensions.swift
// ddxp-kiosk
//
// Created by Richard Adem on 6/20/17.
// Copyright © 2017 Richard Adem. All rights reserved.
//
import RxSwift
import RxCocoa
@richy486
richy486 / undo a githug merge
Created February 28, 2017 21:05
how to undo a github merge to the wrong branch
if you merged 'someUpdate' branch into 'wrongBranch' branch
do this on 'wrongBranch'
$ git reset --soft HEAD^
$ git push -f origin HEAD^:wrongBranch
$ git push