Skip to content

Instantly share code, notes, and snippets.

View Geri-Borbas's full-sized avatar
💡

Geri Borbás Geri-Borbas

💡
View GitHub Profile
@Geri-Borbas
Geri-Borbas / UIView+Extensions.swift
Created July 26, 2020 01:33
Search ancestral view hierarchy for a given `UIView` type.
extension UIView {
/// Search ancestral view hierarchy for the given view type.
func searchViewAnchestorsFor<ViewType: UIView>(
_ onViewFound: (ViewType) -> Void
) {
if let matchingView = self.superview as? ViewType {
onViewFound(matchingView)
} else {
superview?.searchViewAnchestorsFor(onViewFound)
@Geri-Borbas
Geri-Borbas / UIView+Extensions.swift
Created July 26, 2020 00:45
Print recursive `UIKit` view hierarchy information.
extension UIView {
func printViewHierarchyInformation(_ level: Int = 0) {
printViewInformation(level)
self.subviews.forEach { $0.printViewHierarchyInformation(level + 1) }
}
func printViewInformation(_ level: Int) {
let leadingWhitespace = String(repeating: " ", count: level)
let className = "\(Self.self)"
@Geri-Borbas
Geri-Borbas / SwiftUI_DSL_Dissection.swift
Created June 26, 2020 01:56
SwiftUI View struct experiments with explicit types to see DSL dissected.
import SwiftUI
let hello = "Hello"
let world = "world!"
struct ContentView_standard: View
{
@Geri-Borbas
Geri-Borbas / command.sh
Created March 13, 2020 15:51
Set DPI resolution (to 300) of every image in a folder (using ImageMagick).
for f in *; do convert -density 300 -units pixelsperinch "$f" "$f"; done
@Geri-Borbas
Geri-Borbas / Create DMG.md
Last active February 18, 2020 13:44
Create DMG installer from APP.
  1. Install node-appdmg.
  2. Run with the bare minimum specs below.
{
	"title" : "PRODUCT_NAME",
	"window" :
	{
		"size" :
 {
@Geri-Borbas
Geri-Borbas / DateCreated.sh
Created July 22, 2019 21:06
Rewrite image date created (macOS terminal).
touch -t YYYYMMDDhhmm ~/Path/To/Image.jpg
@Geri-Borbas
Geri-Borbas / pushToGameSparks.sh
Created November 16, 2018 20:59
Upload CloudCode scripts to GameSparks using REST API via command line.
#!/bin/sh
# Zip CloudCode folders
zip -r scripts.zip event modules response
# Send to GameSparks
curl \
--verbose \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
@Geri-Borbas
Geri-Borbas / StitchBranches.md
Last active November 8, 2018 09:06
Stitch branch trees.

Simple commits:

git replace --graft <TAIL_COMMIT_SHA> <TIP_COMMIT_SHA>

If tip is a merge commit:

git replace --graft <TAIL_COMMIT_SHA> <FIRST_PARENT_OF_TIP_MERGE_COMMIT_SHA> <SECOND_PARENT_OF_TIP_MERGE_COMMIT_SHA>

Then:

@Geri-Borbas
Geri-Borbas / CommitMessageSlice.sh
Created August 22, 2018 22:15
Get the first slice of the commit message string (using space as a delimiter).
git log -1 --pretty=%B | cut -d ' - ' -f 1
@Geri-Borbas
Geri-Borbas / RenameBranch.md
Created August 15, 2018 07:52
Rename branch local and remote.
git branch -m OLD_NAME NEW_NAME
git push origin :OLD_NAME NEW_NAME
git push --set-upstream origin NEW_NAME