Skip to content

Instantly share code, notes, and snippets.

View sbhmajd's full-sized avatar

Majd Sabah sbhmajd

View GitHub Profile
@matsuda
matsuda / git-commit-count.sh
Last active August 31, 2022 13:46
git tips
#!/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
@matsuda
matsuda / String+AES.swift
Created November 18, 2019 10:45
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),
@matsuda
matsuda / UINavigationController+extensions.swift
Last active July 2, 2024 03:36
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() }
@mrpcalcantara
mrpcalcantara / SnapshotDiffableDataSource.swift
Last active April 5, 2023 20:24
Example on how to use the UITableViewDiffableDataSource
//
// SnapshotDiffableDataSource.swift
// testDiffableDataSource
//
// Created by Miguel Alcântara on 22/01/2020.
// Copyright © 2020 Miguel Alcântara. All rights reserved.
//
import UIKit
@swiftyfinch
swiftyfinch / PodTree.rb
Last active February 21, 2025 15:27
🌳 Tiny utility for visualising CocoaPods dependencies tree. https://swiftyfinch.github.io/en/2020-06-20-pod-tree/
#!/usr/bin/ruby
require 'set'
# Constants
OUTPUT_BULLET = "•"
OUTPUT_BULLET_COLORS = [9, 3, 2, 75, 99]
# Help information
HELP_COMMANDS = ["-h", "--help", "help"]
@fewlinesofcode
fewlinesofcode / PageIndicator.swift
Last active July 17, 2024 09:57
SwiftUI Page Indicator implementation
//
// PageIndicator.swift
//
// Created by Oleksandr Glagoliev on 6/24/20.
// Copyright © 2020 Oleksandr Glagoliev. All rights reserved.
//
import SwiftUI
// MARK: - Dot Indicator -