Skip to content

Instantly share code, notes, and snippets.

View jimmyhoran's full-sized avatar
🛠️
Working on my own thing

Jimmy Horan jimmyhoran

🛠️
Working on my own thing
View GitHub Profile
@jimmyhoran
jimmyhoran / uuid.sh
Created April 17, 2023 23:38 — forked from dhoelle/uuid.sh
bash function to generate a random, lower-cased UUID in MacOS
uuid () {
local newuuid=${$(uuidgen):l}
echo -n ${newuuid} | pbcopy
echo "copied ${newuuid} to clipboard"
}
@jimmyhoran
jimmyhoran / .eslintrc.json
Last active January 3, 2023 08:27
ESLint rc config with rules for import sorting and grouping. Requires `npm i -D eslint-plugin-import` to be installed.
{
"extends": ["prettier", "plugin:prettier/recommended"],
"plugins": ["prettier", "import"],
"rules": {
"import/order": [
"error",
{
"groups": ["builtin", "external", "parent", "sibling", "index"],
"pathGroups": [
{
#!/bin/bash
find . -type f -size +100000k -exec ls -lh {} \;
[
{
"key": "ctrl+shift+u",
"command": "editor.action.transformToUppercase",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l",
"command": "editor.action.transformToLowercase",
"when": "editorTextFocus"
@jimmyhoran
jimmyhoran / README.md
Created September 28, 2021 07:17 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
@jimmyhoran
jimmyhoran / BlurView.swift
Created July 9, 2021 06:29
UIVisualEffectView for use in SwiftUI.
import SwiftUI
import UIKit
struct BlurView: UIViewRepresentable {
var style: UIBlurEffect.Style = .systemMaterial
func makeUIView(context: Context) -> UIVisualEffectView {
return UIVisualEffectView(effect: UIBlurEffect(style: style))
}
@jimmyhoran
jimmyhoran / View+CornerRadius.swift
Created July 9, 2021 06:21
SwiftUI `View` extension to set the corner radius for each individual corner i.e. top corners only.
import SwiftUI
import UIKit
extension View {
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
clipShape(RoundedCorner(radius: radius, corners: corners))
}
}
private struct RoundedCorner: Shape {
@jimmyhoran
jimmyhoran / pull-all-repos.sh
Created July 9, 2021 02:12
Loop through all repositories of a given directory and `git pull` the latest changes.
#!/bin/sh
#
# pull-all-repos.sh
set -euo pipefail
for d in */; do cd $d; git stash; (git pull &); cd ..; done
@jimmyhoran
jimmyhoran / SafeAccessToKeyWindow.swift
Last active July 1, 2021 08:49
Safe access to the `keyWindow` for iOS 13+ support of multiple UIScene
let keyWindow = UIApplication.shared.connectedScenes
.filter { $0.activationState == .foregroundActive }
.map { $0 as? UIWindowScene }
.compactMap { $0 }
.first?.windows
.filter { $0.isKeyWindow }
.first
// Usage e.g.
_ = keyWindow?.safeAreaInsets.bottom ?? 0
@jimmyhoran
jimmyhoran / lint-devices-file.sh
Last active May 14, 2021 03:33
Script to complete a basic check of the fastlane devices.txt file format, where it must use tabs.
#!/usr/bin/env bash
#
# lint-devices-file
# Usage example: ./scripts/ios/lint-devices-file fastlane/devices.txt
FILE=$1
TAB_COUNT=$(grep "$(printf '\t')" $FILE | wc -l)
NEW_LINE_COUNT=$(grep "$(printf '\n')" $FILE | wc -l)