Skip to content

Instantly share code, notes, and snippets.

View geek1706's full-sized avatar
🏠
Working from home

Trung Nguyen geek1706

🏠
Working from home
View GitHub Profile
@geek1706
geek1706 / TabBarController.swift
Last active July 24, 2018 01:44
Remove title of tab bar items and centering images
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
// iOS 11: puts the titles to the right of image for horizontal size class regular. Only want offset when compact.
// iOS 9 & 10: always puts titles under the image. Always want offset.
var verticalOffset: CGFloat = 6.0
if #available(iOS 11.0, *), traitCollection.horizontalSizeClass == .regular {
verticalOffset = 0.0
}
@geek1706
geek1706 / UITableView+Extension.swift
Last active July 6, 2018 11:12
Reusable View Protocols for UITableView swift 4
protocol ReusableView: class {}
extension ReusableView where Self: UIView {
static var reuseIdentifier: String {
return String(describing: self)
}
}
protocol NibLoadableView: class {}
UIView.animate(withDuration: 0.3) {
self.arrowImageView.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), 1.0, 0.0, 0.0)
}
UIView.animate(withDuration: 0.3) {
self.arrowImageView.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), 0.0, 0.0, 0.0)
}
func print(_ items: Any...) {
#if DEBUG
Swift.print(items)
#else
repeat {} while 1 < 0
#endif
}
@geek1706
geek1706 / proxy_methods.m
Created June 17, 2018 03:02 — forked from marclove/proxy_methods.m
iOS 10.2 Appearance Proxy Methods
// iOS 10.2 APPEARANCE PROXY METHODS
// Generated thanks to Matt's gist: https://gist.github.com/mattt/5135521
// UIActivityIndicatorView
// ==========================
@property (nullable, readwrite, nonatomic, strong) UIColor *color NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
// UIBarButtonItem
// ==========================
(void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
- lay bai hat lien quan:
http://mp3.zing.vn/xhr/recommend?type=audio&id=ZW67OIA0
- lay du lieu thong qua key:
http://mp3.zing.vn/xhr/media/get-source?type=audio&key=kmJHTZHNCVaSmSuymyFHLH
http://mp3.zing.vn/html5xml/song-xml/kmJHTZHNCVaSmSuymyFHLH
- tim bai hat:
http://ac.mp3.zing.vn/complete?type=artist,song,key,code&num=500&query=Anh Thế Giới Và Em
@geek1706
geek1706 / sketch.sh
Created May 22, 2018 01:38
sketch without expiring trial
#!/bin/bash
date 0102030405
open /Applications/Sketch.app
ntpdate -u time.apple.com
@geek1706
geek1706 / git-commit-log-stats.md
Created May 17, 2018 01:31 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




https://source.unsplash.com/random/1024x1024
https://drive.google.com/uc?export=view&id=