Skip to content

Instantly share code, notes, and snippets.

View dnedrow's full-sized avatar

David Nedrow dnedrow

View GitHub Profile
@dnedrow
dnedrow / Fastlane-spaceship-itc_team.md
Created June 22, 2023 16:48
Get ITC_TEAM_ID value from AppStore Connect using Fastlane

You may need to know the ITC_TEAM_ID, particularly when setting up automatic deployments to TestFlight in your CI/CD pipeline.

One way to do this is to use a Fastlane Spaceship playground.

I assume if you're reading this, you already have Fastlane installed.

To start a playground, run the following command in a terminal session:

fastlane spaceship
@dnedrow
dnedrow / remove-subs.md
Created April 19, 2023 20:33
How to remove git submodules completely
  1. Remove any references to the submodule in your project
  2. Delete the relevant section from the .gitmodules file
  3. Stage the .gitmodules changes: git add .gitmodules
  4. Delete the submodule reference in .git/config
  5. Run git rm --cached path_to_submodule
  6. Run rm -rf .git/modules/path_to_submodule
  7. Run rm -rf path_to_submodule
  8. Finally, git commit -m "Removed submodule "
@dnedrow
dnedrow / palindrome.swift
Created February 1, 2023 01:45
Check for palindrome in Swift (case sensitive)
func palindrome(inputString: String) -> Bool {
return inputString == String(inputString.reversed())
}
@dnedrow
dnedrow / century.swift
Created February 1, 2023 01:39
Simple way to get century in Swift
func century(year: Int) -> Int {
return (year%100)==0 ? (year / 100) : (year / 100 + 1)
}
@dnedrow
dnedrow / devops_jira.py
Last active August 5, 2022 20:37
This script calculates the average lead and cycle times for cards closed in a single month using the Python Jira library.
# David Nedrow <dnedrow AT me.com>
#
# This script calculates the average lead and cycle times for cards closed in a single month.
# You will need to adjust the query in the code to suit your needs.
# This script was written for a very specific purpose. I provide it in the hopes that it
# may serve as an example of working with the Python Jira library
#
# You will need to `pip install dateutils jira pytz`
#
# Four environment variables must be set
@dnedrow
dnedrow / PercentageToDP.ts
Last active June 2, 2022 19:04
React Native routines for calculating percent of screen size in device independent pixels
// Functions found at: https://medium.com/building-with-react-native/how-to-develop-responsive-uis-with-react-native-1x03-a448097c9503
import ExtraDimensions from 'react-native-extra-dimensions-android';
import DeviceInfo from 'react-native-device-info';
import {Dimensions, PixelRatio, Platform} from "react-native";
export const windowHeight =
Platform.OS === 'ios' ? Dimensions.get('window').height : ExtraDimensions.get('REAL_WINDOW_HEIGHT');
export const windowWidth =
@dnedrow
dnedrow / addsubmodules.sh
Created May 19, 2022 23:18
This script will add all submodules from just a .gitmodules file
#!/bin/sh
# This script will add all submodules from just a .gitmodules file
#
# This script copied from https://www.willhallonline.co.uk/blog/2019-03-05-scripting-adding-gitmodules/
# One addition is the '--force' directive on 'submodule add'.
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
@dnedrow
dnedrow / delete_git_submodule.md
Created April 4, 2022 18:40 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@dnedrow
dnedrow / InterfaceDelegationBy.kt
Last active March 24, 2022 18:35
Delegating interfaces in Kotlin using 'by'
// Found at https://kotlinlang.slack.com/archives/C0B8MA7FA/p1648113947290379
interface FeatureFlagProvider
interface LoginMethodProvider
interface FooProvider
class FeatureManager(
featureFlagProvider: FeatureFlagProvider,
loginMethodProvider: LoginMethodProvider,
fooProvider: FooProvider,
@dnedrow
dnedrow / move-xcode.sh
Last active February 28, 2022 17:54
Bash script to rename (move) Xcode to a name with the version number appended. Useful for things like JAMF Xcode installs.
#!/bin/bash
# Moves Xcode.app to Xcode-nn.nn.nn.app (ned3679)
#
# usage: /bin/bash move-xcode.sh [Xcode version]
#
# The optional parameter to the script checks to see if the installed version
# of Xcode matches the version to be installed.
#
# Exit codes