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 / RomanNumerals.swift
Last active April 23, 2019 03:04 — forked from kumo/RomanNumerals.swift
A simple roman numerals converter in Swift
import Foundation
func toRoman(number: Int) -> String {
guard number < 1000 else { fatalError("Number must be less than 1000") }
let romanValues = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
let arabicValues = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
var romanValue = ""
@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 / 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.




@geek1706
geek1706 / mysql-docker.sh
Created May 13, 2018 05:57 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@geek1706
geek1706 / git_submodules.md
Created April 18, 2018 02:49 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@geek1706
geek1706 / workaround.m
Created May 15, 2017 07:59 — forked from steipete/workaround.m
If you're implementing child view controllers and want automaticallyAdjustsScrollViewInsets to work...
// This ensures that the automaticallyAdjustsScrollViewInsets magic works
// On our newly added view controller as well.
// This triggers _layoutViewController which then triggers
// _computeAndApplyScrollContentInsetDeltaForViewController:
// which finally updates our content inset of the scroll view (if any)
// rdar://19053416
[self.navigationController.view setNeedsLayout];