Skip to content

Instantly share code, notes, and snippets.

View thanhit93's full-sized avatar
🎯
Focusing

Thanh Truong thanhit93

🎯
Focusing
View GitHub Profile
https://medium.com/geekculture/simple-pedometer-in-swift-482099cf7bbd
//
// DBHelper.swift
//
import Foundation
import SQLite3
class DBHelper
{
init()
package com.example;
import android.content.Context;
import android.graphics.*;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.widget.FrameLayout;
public class RoundedCornerLayout extends FrameLayout {
Widget _buildProgressBarPoint() {
return SizedBox(
height: 120,
child: StreamBuilder<int>(
stream: bloc.pointsBloc.stream,
initialData: 0,
builder: (context, snapshot) {
int points = snapshot.data;
return ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 50),
@thanhit93
thanhit93 / AVPlayer+IsPlaying.swift
Created March 31, 2021 17:43 — forked from melvinbeemer/AVPlayer+IsPlaying.swift
Check if AVPlayer is currently playing an item
import Foundation
import AVFoundation
extension AVPlayer {
var isPlaying: Bool {
if (self.rate != 0 && self.error == nil) {
return true
} else {
return false

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@thanhit93
thanhit93 / ViewController.Swift
Created August 28, 2020 15:44 — forked from cscouto/ViewController.Swift
SWIFT - Observe contentSize fro the tableView
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var heightTableView: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
tableView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
@thanhit93
thanhit93 / Simple-browser-WKWebView-UIKit.md
Created July 28, 2020 17:36 — forked from quangDecember/Simple-browser-WKWebView-UIKit.md
Creating Simple Web Browser with WKWebView & UINavigationController

WKWebView was first introduced on iOS 8. With Apple finally release a deadline for all apps to migrate away from UIWebView, this series and this post is here to help you explore the features of WKWebView. In this blog post you will create a simple web browser with some basic features such as displaying content, back and forward.

Setup Previews for your project

One of the most interesting things coming out with Xcode 11 is SwiftUI's PreviewProvider, which provides a way to preview the UI during development instantly on multiple devices, multiple settings at the same time.

To preview UIViewController and UIView, you need to download previewing code from NSHipster

Since we are making this browser with a navigation bar, our main UIViewController needs to be embedded inside a UINavigationController. Therefore the previewing code would be like this:

@thanhit93
thanhit93 / AutoCompleteTextField
Last active July 11, 2020 16:25
AutoCompleteTextField in swift 4.2
//
// AutoCompleteTextField.swift
// ABC_Project
//
// Created by Trương Thành on 7/11/20.
// Copyright © 2020 education. All rights reserved.
//
import Foundation
import UIKit
@thanhit93
thanhit93 / terminal
Created April 7, 2019 12:54 — forked from FreddyPoly/terminal
[REACT NATIVE] Get SHA1
Debug SHA1 (root of project)
keytool -J-Duser.language=en -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Release SHA1 (/android/app/)
keytool -J-Duser.language=en -list -v -keystore mystore.keystore