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
// I re-typed what I saw in reference 3 below, | |
// went to Liked videos page on YouTube[1] while logged in, | |
// pasted that into browser dev tools console (Google Chrome Version 97.0.4692.99 (Official Build) (x86_64)), | |
// pressed enter, and it seemed to do its thing, for the most part | |
// (when I refreshed the page, there was still 1 video remaining). | |
// [1] as of 2022-01-23 that’s at https://www.youtube.com/playlist?list=LL | |
// context: https://twitter.com/QiaochuYuan/status/1485164256970510340 | |
// references: |
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 "🔍 Start dead code analysis" | |
result="$(periphery scan --config .periphery.yml)" | |
current_dir=$(pwd) | |
result_stripped_of_absolute_path_prefix=$(echo "$result" | sed "s|$current_dir/||g") | |
filtered_out_result=$(echo "$result_stripped_of_absolute_path_prefix" | awk '/:[0-9]+:[0-9]+:/{ print }') | |
sorted_result=$(echo "$filtered_out_result" | sort) |
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 | |
if ! command -v periphery &> /dev/null; then | |
echo "❌ Periphery is not installed. Please install periphery before running this script." | |
else | |
cd .. # change the current directory | |
check_unused_codes_script="${SRCROOT}/../check-unused-codes.sh" | |
sorted_result=$("$check_unused_codes_script") |
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
# Run SwiftLint | |
#https://github.com/realm/SwiftLint/issues/413#issuecomment-184077062 | |
START_DATE=$(date +"%s") | |
SWIFTLINT="${PODS_ROOT}/SwiftLint/swiftlint" | |
# Run SwiftLint for given filename | |
run_swiftlint() { | |
local filename="${SRCROOT}/../${1}" | |
if [[ "${filename##*.}" == "swift" ]]; 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
import UIKit | |
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
Reachability.shared.startNetworkReachabilityObserver() | |
return true | |
} |
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
// | |
// UITextViewPlaceholder.swift | |
// TextViewPlaceholder | |
// | |
// Copyright (c) 2017 Tijme Gommers <[email protected]> | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
# Run SwiftLint | |
#https://github.com/realm/SwiftLint/issues/413#issuecomment-184077062 | |
START_DATE=$(date +"%s") | |
SWIFT_LINT=/usr/local/bin/swiftlint | |
# Run SwiftLint for given filename | |
run_swiftlint() { | |
local filename="${1}" | |
if [[ "${filename##*.}" == "swift" ]]; 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
func migrateUserDefaultsToAppGroups() { | |
// User Defaults - Old | |
let userDefaults = NSUserDefaults.standardUserDefaults() | |
// App Groups Default - New | |
let groupDefaults = NSUserDefaults(suiteName: "group.myGroup") | |
// Key to track if we migrated | |
let didMigrateToAppGroups = "DidMigrateToAppGroups" |
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 Date { | |
var timeAgo: String { | |
get { | |
let relativeDateFormatter = RelativeDateTimeFormatter() | |
//change these to get different formats | |
relativeDateFormatter.dateTimeStyle = .named | |
relativeDateFormatter.unitsStyle = .full | |
//you can know your loacal identifier here https://gist.github.com/jacobbubu/1836273 | |
relativeDateFormatter.locale = Locale(identifier: "ar_EG") | |
let relativeDate = relativeDateFormatter.localizedString(for: self, relativeTo: Date()) |
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 | |
extension Optional where Wrapped: Collection { | |
public var isNilOrEmpty: Bool { | |
switch self { | |
case .none: | |
return true | |
case .some(let collection): | |
return collection.isEmpty | |
} |
NewerOlder