Skip to content

Instantly share code, notes, and snippets.

View xieweiAlex's full-sized avatar
🎯
Focusing

Alex Xie xieweiAlex

🎯
Focusing
View GitHub Profile
@xieweiAlex
xieweiAlex / gist:842a3549d9ae5e324b651a0bb5a1168f
Created February 24, 2019 23:17
IDE ignore specific warning
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OverriddenTypeMismatch"
@property (nonatomic, strong) UIView <xxxx> *view;
#pragma clang diagnostic pop
@xieweiAlex
xieweiAlex / ag-doc.md
Created March 20, 2019 19:11
ag: the silver search
  • -g PRINT FILENAMES match PATTERN
  • -G ONLY SEARCH files whose name match PATTERN
  • -l Only print the names of files containing matches
    • ag -G .m 'AGInstallGuideWebViewController'
  • -v exclude pattern
  • Examples:
    • ag --group ""http" --ignore "*.md|AGLinkConstants.h"
@xieweiAlex
xieweiAlex / Swift.String.extension
Last active May 18, 2019 00:14
Swift String extension for subString
``` Swift
extension String {
func index(from: Int) -> Index {
return self.index(startIndex, offsetBy: from)
}
func substring(from: Int) -> String {
let fromIndex = index(from: from)
return substring(from: fromIndex)
}
@xieweiAlex
xieweiAlex / String.alphanumeric
Created August 12, 2019 15:53
Check string is alphanumeric
extension String {
var isAlphanumeric: Bool {
return !isEmpty && range(of: "[^a-zA-Z0-9]", options: .regularExpression) == nil
}
}
set autoupdategist
set noautofocus
set nocncpcompletion
set smoothscroll
set hud
set noregex
set noinsertmappings
set typelinkhints
set defaultnewtabpage