Skip to content

Instantly share code, notes, and snippets.

View sbhmajd's full-sized avatar

Majd Sabah sbhmajd

View GitHub Profile
@sbhmajd
sbhmajd / GuardURLProtocol.swift
Created March 12, 2023 13:19 — forked from brunophilipe/GuardURLProtocol.swift
GuardURLProtocol class to monitor all connections initiated by app
//
// GuardURLProtocol.swift
// URLProtocol
//
// Created by Bruno Philipe on 16/2/17.
// Copyright © 2017 Bruno Philipe. All rights reserved.
//
// 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
@sbhmajd
sbhmajd / Fastfile
Created August 31, 2022 13:47 — forked from matsuda/Fastfile
指定されたブランチを取得するlane
###############################
# get latest release git branch
###############################
desc "get latest release git branch"
private_lane :git_latest_release_branch do
pattern = "release\/(.+)"
branches = git_find_branches(pattern: pattern)
reg = Regexp.new(pattern)
branches = branches.sort { |a, b|
#!/bin/sh
# ファイルの1年間のコミット数
git ls-files |
while read file ; do
commits=`git log --since=1.year --no-merges --oneline -- $file | wc -l`;
echo "$commits - $file";
done | sort -n
@sbhmajd
sbhmajd / String+AES.swift
Created August 31, 2022 13:46 — forked from matsuda/String+AES.swift
AES encryption in Swift
import CommonCrypto
// MARK: AES128 暗号、復号化
public extension String {
func aesEncrypt(key: String, iv: String) -> String? {
guard
let data = self.data(using: .utf8),
let key = key.data(using: .utf8),
let iv = iv.data(using: .utf8),
@sbhmajd
sbhmajd / UINavigationController+extensions.swift
Created August 31, 2022 13:43 — forked from matsuda/UINavigationController+extensions.swift
Completion handler for UINavigationController push or pop
/// https://stackoverflow.com/a/33767837
/// https://iganin.hatenablog.com/entry/2019/07/27/172911
extension UINavigationController {
public func pushViewController(
_ viewController: UIViewController,
animated: Bool,
completion: @escaping () -> Void) {
pushViewController(viewController, animated: animated)
guard animated, let coordinator = transitionCoordinator else {
DispatchQueue.main.async { completion() }
@sbhmajd
sbhmajd / Regex&Matcher-Playground.swift
Created August 31, 2022 13:27 — forked from JulianAlonso/Regex&Matcher-Playground.swift
Mapping URL (Deep linking) on iOS.
import Foundation
extension String {
//Know if self is only composed by numbers
var isNumber: Bool {
return !self.isEmpty && CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: self))
}
}
//Struct to check Regular Expresions