This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage - bash extract-scheme-url.sh AppName.ipa | |
# if app has spaces inside name - bash extract-scheme-url.sh Uber\ Eats\ 6.69.10002.ipa | |
# https://medium.com/@contact.jmeyers/how-to-find-and-use-ios-url-schemes-for-shortcuts-986c2540c788 | |
RESET=`tput sgr0` | |
RED=`tput setaf 1` | |
GREEN=`tput setaf 2` | |
if [ "$1" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Swift linting" | |
START_DATE=$(date +"%s") | |
SWIFT_LINT="${PODS_ROOT}/SwiftLint/swiftlint" | |
SWIFT_LINT_CONFIG="${PODS_ROOT}/../.swiftlint.yml" | |
# Run SwiftLint for given filename | |
run_swiftlint() { | |
local filename="${1}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for branch in `git branch -r --merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; done | sort -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum AppTheme: Int { | |
case light | |
case dark | |
} | |
class SettingsService { | |
var appTheme: AppTheme { | |
get { | |
if let rawValue: AppTheme.RawValue = UserDefaults.standard[#function], let theme = AppTheme(rawValue: rawValue) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UserDefaults { | |
subscript<T>(key: String) -> T? { | |
get { | |
return value(forKey: key) as? T | |
} | |
set { | |
set(newValue, forKey: key) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UserDefaults { | |
subscript<T: RawRepresentable>(key: String) -> T? { | |
get { | |
if let rawValue = value(forKey: key) as? T.RawValue { | |
return T(rawValue: rawValue) | |
} | |
return nil | |
} | |
set { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Path to swiftlint | |
SWIFT_LINT=/usr/local/bin/swiftlint | |
#if $SWIFT_LINT >/dev/null 2>&1; then | |
if [[ -e "${SWIFT_LINT}" ]]; then | |
count=0 | |
for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do | |
export SCRIPT_INPUT_FILE_$count=$file_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIInterfaceOrientation)orientationByTransforming:(CGAffineTransform)transform fromOrientation:(UIInterfaceOrientation)c | |
{ | |
CGFloat angle = atan2f(transform.b, transform.a); | |
NSInteger multiplier = (NSInteger)roundf(angle / M_PI_2); | |
UIInterfaceOrientation orientation = self.interfaceOrientation; | |
if (multiplier < 0) { | |
// clockwise rotation | |
while (multiplier++ < 0) { | |
switch (orientation) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#ifdef DEBUG | |
#define NSLog(args...) ExtendNSLog(__FILE__,__LINE__,__PRETTY_FUNCTION__,args); | |
#else | |
#define NSLog(x...) | |
#endif | |
void ExtendNSLog(const char *file, int lineNumber, const char *functionName, NSString *format, ...); |
NewerOlder