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 / 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];
override func draw(_ rect: CGRect) {
UIColor.white.setFill()
let minX: CGFloat = 0
let maxX = rect.width
let maxY = rect.height
let midX = rect.midX
let circleRadius: CGFloat = 45
let roundingRadius: CGFloat = 6