Skip to content

Instantly share code, notes, and snippets.

@hongvuxuan
hongvuxuan / API.swift
Created July 24, 2018 16:54 — forked from jdmcd/API.swift
Alamofire + Codable
class API {
static let apiKey = "test"
static let baseUrl = ""
enum Endpoint {
case login
case register
var endpoint: String {
switch self {
@hongvuxuan
hongvuxuan / Gradient_border_button.md
Created July 19, 2018 11:50 — forked from nguyentruongky/Gradient_border_button.md
A library to create gradient border button

How to draw a gradient border button?

My Problem

Last week, my partner showed me his design for our application. Everything is great, easily implemented with some custom controls. But wait, something is not in my knowledge.

A button with gradient border. Never try it before. Up to now, I just created gradient background views 2 times in previous projects. Googled and found some good results.

@hongvuxuan
hongvuxuan / android_studio_shortcuts.md
Created April 17, 2018 01:44 — forked from stkent/android_studio_shortcuts.md
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@hongvuxuan
hongvuxuan / UITableView+beginRefreshing.swift
Created February 7, 2018 10:43 — forked from mttcrsp/UITableView+beginRefreshing.swift
Extension that allows programmatic pull to refresh
import UIKit
public extension UITableView {
public func beginRefreshing() {
// Make sure that a refresh control to be shown was actually set on the view
// controller and the it is not already animating. Otherwise there's nothing
// to refresh.
guard let refreshControl = refreshControl, !refreshControl.isRefreshing else {
return
@hongvuxuan
hongvuxuan / CustomTextField.swift
Created February 2, 2018 08:46 — forked from Gujci/CustomTextField.swift
Simple snippet how to disable actions in a UITextField
import UIKit
@IBDesignable
class CustomTextField: UITextField {
@IBInspectable var isPasteEnabled: Bool = true
@IBInspectable var isSelectEnabled: Bool = true
@IBInspectable var isSelectAllEnabled: Bool = true
@hongvuxuan
hongvuxuan / genymotionwithplay.txt
Created January 29, 2018 15:03 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@hongvuxuan
hongvuxuan / HATextField
Created January 22, 2018 03:25 — forked from litoarias/HATextField
UITextField with left icon for Swift 3
import UIKit
@IBDesignable
class HATextField: UITextField {
override func textRect(forBounds bounds: CGRect) -> CGRect {
return CGRect(x: bounds.origin.x + iconWidth*2, y: bounds.origin.y, width: bounds.width, height: bounds.height)
}
override func editingRect(forBounds bounds: CGRect) -> CGRect {
//
// UIBarButtonItem+Badge.swift
// PiGuardMobile
//
// Created by Stefano Vettor on 12/04/16.
// Copyright © 2016 Stefano Vettor. All rights reserved.
//
import UIKit
@hongvuxuan
hongvuxuan / Badge.swift
Created January 20, 2018 16:26 — forked from yonat/Badge.swift
Rounded UILabel and UIButton, Badged UIBarButtonItem
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
@hongvuxuan
hongvuxuan / UINavigationBarWithSubtitle.swift
Created January 15, 2018 16:28 — forked from nazywamsiepawel/UINavigationBarWithSubtitle.swift
UINavigationBar with subtitle / swift
func setTitle(title:String, subtitle:String) -> UIView {
let titleLabel = UILabel(frame: CGRect(x:0, y:-5, width:0, height:0))
titleLabel.backgroundColor = UIColor.clear
titleLabel.textColor = UIColor.gray
titleLabel.font = UIFont.boldSystemFont(ofSize: 17)
titleLabel.text = title
titleLabel.sizeToFit()