Skip to content

Instantly share code, notes, and snippets.

View sbhmajd's full-sized avatar

Majd Sabah sbhmajd

View GitHub Profile
@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 -
@swiftyfinch
swiftyfinch / PodTree.rb
Last active November 22, 2023 14:32
🌳 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"]
@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
@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() }
@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 / 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
#!/bin/sh
# https://gist.github.com/MarioIannotta/e27ac3ec067dc5b6f00c392d7527b10a
build_path="Builds/$(date '+%d-%m-%Y-%H-%M')"
target="YourFramework"
configuration="Your configuration eg: Release"
# clean up the build folder if already exists
rm -rf build_path
@matsuda
matsuda / Fastfile
Created May 8, 2019 10:37
指定されたブランチを取得する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|
@standinga
standinga / main.swift
Created November 18, 2018 00:16
Read MJPEG int CGImage using Swift4, URLSession, OSX
//
// main.swift
// MJPEGreader
//
// Created by michal on 17/11/2017.
// Copyright © 2018 michal. All rights reserved.
//
import Foundation
@rhodrid
rhodrid / com.jenkins.ci.plist
Created August 1, 2018 10:57
MacOS: Run Jenkins Slave as a Service
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jenkins.ci</string>
<key>UserName</key>
<string>jenkins</string>
<key>SessionCreate</key>
<true/>