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 UIKit | |
| public protocol DiffableDatasource: AnyObject { | |
| typealias Snapshot = NSDiffableDataSourceSnapshot<Section, Item> | |
| typealias SnapshotProvider = () -> Snapshot | |
| associatedtype View | |
| associatedtype Datasource | |
| associatedtype Section: Hashable & Sendable | |
| associatedtype Item: Hashable & Sendable |
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
| # ----------------------------------------- | |
| # Create permanent environment variable | |
| # | |
| # $1 - variable name | |
| # $2 - variable definition | |
| # @requires: '~/.zshrc' or '~/.bashrc' | |
| # ----------------------------------------- | |
| function new_env_var { | |
| local detected_shell="$(ps -o comm= -p $$)" | |
| local rcfile=$(echo "${HOME}/.${detected_shell//-/}rc") |
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/zsh | |
| # Git branch cleanup script - removes local branches whose remotes were deleted | |
| # Usage: ./git_cleanup.sh [path-to-git-repo] | |
| set -e | |
| # Handle path parameter | |
| if [ $# -gt 1 ]; then | |
| echo "Usage: $0 [path-to-git-repo]" |
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
| English: A dog. | |
| Swedish: What? | |
| English: The dog. | |
| English: Two dogs. | |
| Swedish: Okay. We have: En hund, hunden, Två hundar, hundarna. |
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 DispatchQueue { | |
| private static var _onceTracker = [String]() | |
| func once(file: String = #file, function: String = #function, line: Int = #line, _ block:() -> Void) { | |
| let token = file + ":" + function + ":" + String(line) | |
| once(token: token, block) | |
| } | |
| /// Executes a block of code, associated with a unique token, only once. The code is thread safe and will | |
| /// only execute the code once even in the presence of multithreaded calls. |
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
| #logoutput: /var/log/socks.log | |
| logoutput: stderr | |
| # socks clients interface and port | |
| internal: eth0 port = 1080 | |
| # external interface and port | |
| external: eth0 | |
| #internal: x.x.x.x port = 1080 | |
| #external: x.x.x.x |
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 | |
| ### BEGIN INIT INFO | |
| # Provides: sockd | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Start the dante SOCKS server. | |
| # Description: SOCKS (v4 and v5) proxy server daemon (sockd). | |
| # This server allows clients to connect to it and |
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
| CGFloat hue = ( arc4random_uniform(256) / 256.0 ); // 0.0 to 1.0 | |
| CGFloat saturation = ( arc4random_uniform(128) / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
| CGFloat brightness = ( arc4random_uniform(128) / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
| UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; |
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 UIKit; | |
| typedef void (^KeyboardAdjustingBlock)(); | |
| @interface KeyboardAdjuster : NSObject | |
| @property (nonatomic, assign) BOOL activated; | |
| @property (nonatomic, nullable, weak) IBOutlet UIView *targetView; | |
| @property (nonatomic, nullable, weak) IBOutlet NSLayoutConstraint *targetConstraint; |
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
| # Xcode | |
| # | |
| # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | |
| ## Build generated | |
| build/ | |
| DerivedData/ | |
| ## Various settings | |
| *.pbxuser |
NewerOlder