Skip to content

Instantly share code, notes, and snippets.

@dobaduc
dobaduc / aliyuncli-ecs.md
Last active September 4, 2018 12:36
Getting started with Aliyun ECS API

Installation

Check out the guideline here: https://github.com/aliyun/aliyun-cli ( using Google translator)

Install python pip if necessary

curl https://bootstrap.pypa.io/get-pip.py | sudo python

Install aliyuncli

@dobaduc
dobaduc / EasyLocalization.swift
Last active November 14, 2019 16:38
Tiny useful wrapper function of NSLocalizedString in Swift
//
// EasyLocalization.swift
//
// Created by Doba Duc on 9/1/15.
// Copyright (c) 2015 Doba Duc. All rights reserved.
//
/// Tiny useful wrapper function of NSLocalizedString in Swift
///
/// @param key Localizable key
@dobaduc
dobaduc / Logitboost.R
Last active October 6, 2015 16:40
Logitboost
#Set Directory
setwd("/root") #Set working directory
#Load packages
library(caret)
library(jsonlite)
##Functions
#Create training and test sets
splitdf <- function(dataframe, seed=NULL) {
@dobaduc
dobaduc / AutoKeyboardAdjustmentProtocol.swift
Last active October 5, 2015 02:09
Automatically adjust scroll view according to keyboard visibility
//
// AutoKeyboardAdjustmentProtocol.swift
// Ducky Duke
//
// Created by Doba Duc on 8/18/15.
// Copyright (c) 2015 Doba Duc. All rights reserved.
//
import UIKit
@dobaduc
dobaduc / UIFontExtension.swift
Last active June 7, 2018 11:21
Swift - Detect font traits examples (For Bold and Italic)
extension UIFont {
var isBold: Bool {
return (fontDescriptor().symbolicTraits.rawValue & UIFontDescriptorSymbolicTraits.TraitBold.rawValue) > 0
}
var isItalic: Bool {
return (fontDescriptor().symbolicTraits.rawValue & UIFontDescriptorSymbolicTraits.TraitItalic.rawValue) > 0
}
}
@dobaduc
dobaduc / NavigationBarOverlappingDemo2.swift
Last active November 13, 2015 16:51
Animate a view overlapping UINavigationBar ( Solution 2 - Move the view to key window then move back after a certain delay)
//
// NavigationBarOverlappingDemo2.swift
//
// Created by Duc DoBa on 9/8/15.
// Copyright (c) 2015 Duc Doba. All rights reserved.
//
// This example is created to answer to the following StackOverflow question:
// http://stackoverflow.com/questions/32446076/how-to-overlap-uinavigationbar-with-animation
import UIKit
@dobaduc
dobaduc / NavigationBarOverlappingDemo.swift
Last active June 6, 2018 12:33
Animate an UIView overlapping UINavigationBar ( Solution 1 - Using cloned view)
//
// NavigationBarOverlappingDemo.swift
//
// Created by Duc DoBa on 9/8/15.
// Copyright (c) 2015 Duc Doba. All rights reserved.
//
// This example is created to answer to the following StackOverflow question:
// http://stackoverflow.com/questions/32446076/how-to-overlap-uinavigationbar-with-animation
import UIKit