This file contains hidden or 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 android.graphics.Typeface | |
import android.text.SpannableString | |
import android.text.TextUtils | |
import android.text.style.CharacterStyle | |
import android.text.style.StyleSpan | |
import android.widget.TextView | |
import java.text.Normalizer | |
import java.util.Locale | |
import java.util.regex.Pattern |
This file contains hidden or 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
prepareAnswers(); | |
setTimeout(resetQuestions, 1500); | |
setTimeout(solveQuestions, 3000); | |
function prepareAnswers() { | |
$.each($.find('.multiple-choice-question-element'), function(i, wrapper) { | |
wrapper = $(wrapper); | |
var button = wrapper.find('.save-answers'); | |
var choice = $(wrapper.find('.question-choice')[0]).find('input'); |
This file contains hidden or 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
// activity | |
private val onAppBarLiftListeners = HashSet<AppBarLiftListener>() | |
val appBar = findViewById<AppBarLayout>(R.id.appBar) | |
if (appBar != null) { | |
appBar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { _, verticalOffset -> | |
onAppBarLiftListeners.forEach { it.onAppBarLift(verticalOffset) } | |
}) | |
} |
This file contains hidden or 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 timber.log.Timber | |
/** | |
* Patch date picker or time picker to use custom months or am/pm | |
* From: https://stackoverflow.com/a/33599403/2897341 | |
* | |
* @param picker [android.widget.DatePicker] or [android.widget.TimePicker] | |
* @param values months or am/pm | |
*/ | |
fun localizePicker(picker: Any, values: Array<String>) { |
This file contains hidden or 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.util.Calendar | |
import java.util.Date | |
class CalendarRange(override val start: Calendar, override val endInclusive: Calendar, val field: Int = Calendar.DAY_OF_YEAR) : | |
ClosedRange<Calendar>, Iterable<Calendar> { | |
override fun iterator(): Iterator<Calendar> { | |
return CalendarIterator(start, endInclusive, field) | |
} | |
} |
This file contains hidden or 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
class AppViewModelFactory @Inject constructor( | |
private val creators: @JvmSuppressWildcards Map<Class<out ViewModel>, Provider<ViewModel>> | |
) : ViewModelProvider.Factory { | |
var onViewModelCreate: ((viewModel: ViewModel) -> Unit)? = null | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
var creator: Provider<out ViewModel>? = creators[modelClass] | |
if (creator == null) { | |
for ((key, value) in creators) { |
This file contains hidden or 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 tm.alashow.x.ui.base | |
import android.arch.lifecycle.ViewModel | |
import android.arch.lifecycle.ViewModelProvider | |
import android.arch.lifecycle.ViewModelProviders | |
import android.databinding.DataBindingUtil | |
import android.databinding.ViewDataBinding | |
import android.os.Bundle | |
import android.support.annotation.LayoutRes | |
import android.support.annotation.StringRes |
This file contains hidden or 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 tm.alashow.homework.datastructures.second.kt | |
import java.math.BigInteger | |
fun main(args: Array<String>) { | |
Fibonacci.init() | |
} | |
object Fibonacci { |
This file contains hidden or 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 tm.alashow.homework.datastructures.second; | |
import java.util.Locale; | |
import java.util.Scanner; | |
/** | |
* Created by alashov on 10/1/17. | |
*/ | |
public class Fibonacci { |
This file contains hidden or 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
# run in "root" folder (e.g /home/datmusic/api.datmusic.xyz/) | |
chown -R datmusic:www-data storage .env | |
find storage -type f -exec chmod 664 {} \; | |
find storage -type d -exec chmod 775 {} \; | |
chgrp -R www-data storage .env | |
chmod -R ug+rwx storage .env |