This file contains hidden or 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
# Generate push certificates. | |
# Usage: generate_push_certificate <app-bundle-id> <user-email> <cert-password> | |
generate_push_certificate() { | |
app=$1 | |
user=$2 | |
password=$3 | |
fastlane pem -a "$app" -u "$user" -p "$password" | |
convert_push_certificate_to_keychain_format "production_${app}_ios.p12" "$password" | |
} |
This file contains hidden or 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 | |
show_help() { | |
echo "" | |
echo " $(basename "$0") - Send push notification to an iOS device." | |
echo "" | |
echo " Usage:" | |
echo " $(basename "$0") [options] <app-bundle-id> <cert-file.p12> <cert-password> <push-token>" | |
echo "" | |
echo " Options:" |
This file contains hidden or 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 SwiftUI | |
/// AsyncImage that fits its image into a frame, shows spinner while loading, and an error if it occurs | |
struct ResizableAsyncImage: View { | |
let url: URL? | |
let imageContentMode: ContentMode | |
let maxWidth: CGFloat? | |
let maxHeight: CGFloat? | |
var body: some View { |
This file contains hidden or 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
desc "Change a value in xcodeproj file." | |
desc "Usage: fastlane change_build_value xcodeproj:<file-name> name:<build-setting> from:<old-value> to:<new-value>" | |
lane :change_build_value do |options| | |
xcodeproj = options[:xcodeproj] | |
name = options[:name] | |
from = options[:from] | |
to = options[:to] | |
optional_quotes = '"\\{0,1\\}' | |
replacement_expression = "s/#{name} = #{optional_quotes}#{from}#{optional_quotes};/#{name} = #{to};/g" |
This file contains hidden or 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 | |
/// Property wrapper for `UserDefaults.standard` backed value | |
@propertyWrapper | |
struct UserDefault<Value: UserDefaultsValue> { | |
let key: String | |
let defaultValue: Value | |
let container: UserDefaults |
This file contains hidden or 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 | |
# courtesy of https://github.com/ytdl-org/youtube-dl/issues/23573#issuecomment-631115716 | |
url="${1%%\?*}" | |
jar=$(mktemp) | |
mp4=$(curl -s -c "$jar" "$url" | grep video/mp4 | grep -o 'https:[^"]*') | |
file=$(echo "$mp4" | grep -o "[^/? ]*\.mp4") | |
echo "Downloading $file" |
This file contains hidden or 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
// | |
// ContentView.swift | |
// Stacketude | |
// | |
// Created by Yonat Sharon on 06/01/2020. | |
// Copyright © 2020 Yonat Sharon. All rights reserved. | |
// | |
import SwiftUI |
This file contains hidden or 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 SwiftUI | |
extension Binding { | |
/// Execute block when value is changed. | |
/// | |
/// Example: | |
/// | |
/// Slider(value: $amount.didSet { print($0) }, in: 0...10) | |
func didSet(execute: @escaping (Value) ->Void) -> Binding { | |
return Binding( |
This file contains hidden or 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 String { | |
/** | |
Perl style substring | |
- parameter offset: Negative offset starts that far back from the end of the string | |
- parameter length: Negative length leaves that many characters off the end of the string. Omit to return everything through the end of the string. | |
*/ | |
func substr(offset: Int, length: Int = 0) -> String { | |
let start = offset < 0 ? endIndex.advancedBy(offset, limit: startIndex) : startIndex.advancedBy(offset, limit: endIndex) | |
let end = length > 0 ? start.advancedBy(length, limit: endIndex) : endIndex.advancedBy(length, limit: startIndex) |
NewerOlder