This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration | |
import java.time.Instant | |
object Fibonacci { | |
fun recursive(n: Long): Long = if (n < 2) n else recursive(n - 1) + recursive(n - 2) | |
tailrec fun recursiveTail(n: Long, a: Long, b: Long): Long | |
= if (n < 1) a else recursiveTail(n - 1, b, a + b) | |
fun iterative(n: Long): Long { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
//... | |
//... removed for brevity | |
bundle { | |
language { | |
enableSplit = false | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIVisualEffectView { | |
func fadeInEffect(_ style:UIBlurEffectStyle = .light, withDuration duration: TimeInterval = 1.0) { | |
if #available(iOS 10.0, *) { | |
let animator = UIViewPropertyAnimator(duration: duration, curve: .easeIn) { | |
self.effect = UIBlurEffect(style: style) | |
} | |
animator.startAnimation() | |
}else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//apply plugin: 'com.android.library' //uncomment this line for android libraries | |
//apply plugin: 'com.android.application' //uncomment this line for android applications | |
def renameArtifact(variant, defaultConfig) { | |
variant.outputs.each { output -> | |
def formattedDate = new Date().format('yyyyMMddHHmmss') | |
def fullName = output.outputFile.name | |
def projectName = fullName.substring(0, fullName.indexOf('-')) | |
output.outputFile = new File( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gunhansancar.android.fragments; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.TextView; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gunhansancar.changelanguageexample.helper; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.content.res.Configuration; | |
import android.content.res.Resources; | |
import android.os.Build; | |
import android.preference.PreferenceManager; |