Skip to content

Instantly share code, notes, and snippets.

@Shinolr
Shinolr / AppGuide.swift
Last active April 30, 2019 11:57
Check app version, whether should load user guide
protocol AppGuide {
func shouldLoadAppGuide() -> Bool
}
extension AppGuide {
func shouldLoadAppGuide() -> Bool {
guard let versionString = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String else {
return false
}
guard let currentVersion = Int(versionString) else {
@Shinolr
Shinolr / SameNameWithXibFile.swift
Last active March 12, 2019 04:13
Xib file reusable
class SameNameWithXibFile: UIView, XibReusable {
var contentView: UIView!
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
xibSetup()
}
override init(frame: CGRect) {
super.init(frame: frame)
@Shinolr
Shinolr / CardBannerFlowLayout.swift
Created March 12, 2019 03:48
具有分页效果的滚动 card banner
class CardBannerFlowLayout: UICollectionViewFlowLayout {
var padding: CGFloat = 20
var cardSize: CGSize {
return CGSize(width: screen_width - 2 * padding, height: 168)
}
let cardSpacing: CGFloat = 10.0
var initialNonCardLength: CGFloat {
return padding + cardSpacing
}
@0xjac
0xjac / private_fork.md
Last active May 25, 2024 23:35
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@0xc010d
0xc010d / NSString+Mod97Check.h
Last active April 9, 2021 13:57
Objective-C implementation of mod97 IBAN checking algorithm
#import <Foundation/Foundation.h>
@interface NSString (Mod97Check)
- (BOOL)passesMod97Check; // Returns result of mod 97 checking algorithm. Might be used to check IBAN.
// Expects string to contain digits and/or upper-/lowercase letters; space and all the rest symbols are not acceptable.
@end