Skip to content

Instantly share code, notes, and snippets.

Cüneyt AYYILDIZ Swisyn

Block or report user

Report or block Swisyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Swisyn
Swisyn / DetailsFragment.kt
Created May 13, 2020 — forked from osipxd/DetailsFragment.kt
Partial view state rendering with LiveData transformations
View DetailsFragment.kt
class DetailsFragment : BaseFragment(R.layout.fragment_details) {
lateinit val viewModel: DetailsViewModel
// ...
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onVewCreated(view, savedInstanceState)
// Assumed that viewModel initialized here
@Swisyn
Swisyn / setLocale.kt
Created May 13, 2020 — forked from osipxd/setLocale.kt
Set locale in Android application
View setLocale.kt
import android.app.Activity
import android.app.Application
import android.content.ComponentCallbacks
import android.content.Context
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import java.util.Locale
private const val LANGUAGE_RU = "ru"
@Swisyn
Swisyn / EventsQueue.kt
Created May 13, 2020 — forked from osipxd/EventsQueue.kt
ViewModel and LiveData extensions
View EventsQueue.kt
import androidx.annotation.MainThread
import androidx.lifecycle.MutableLiveData
import java.util.LinkedList
import java.util.Queue
/**
* Класс-очередь для обработки временных событий, не являющихся частью View
* Например, показ SnackBar с сообщением или ошибкой.
*/
class EventsQueue : MutableLiveData<Queue<Event>>() {
@Swisyn
Swisyn / ViewModelFactory.kt
Created May 13, 2020 — forked from osipxd/ViewModelFactory.kt
Dagger ViewModel Multibinding
View ViewModelFactory.kt
class ViewModelFactory @Inject constructor(
private val providers: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
val provider = providers[modelClass]
?: providers.asIterable().find { modelClass.isAssignableFrom(it.key) }?.value
?: error("Unknown ViewModel class $modelClass")
return try {
@Swisyn
Swisyn / ViewBinding.kt
Created May 13, 2020 — forked from osipxd/ViewBinding.kt
View binding extensions + delegate
View ViewBinding.kt
/**
* Инфлейт ViewBinding заданного типа [T].
*
* В качестве родителя используется [ViewGroup], по умолчанию view прикрепляется к корню родителя.
* **ВАЖНО!** Для инфлейта вьюх с `merge` в корне нужно использовать только этот метод.
*/
inline fun <reified T : ViewBinding> ViewGroup.inflateViewBinding(
context: Context = this.context,
attachToRoot: Boolean = true
): T {
View iOSActivityRingSwiftUI.swift
import SwiftUI
import PlaygroundSupport
extension Double {
func toRadians() -> Double {
return self * Double.pi / 180
}
func toCGFloat() -> CGFloat {
return CGFloat(self)
View disable-auto-android-file-transfer.md
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
@Swisyn
Swisyn / main.py
Created Mar 4, 2019 — forked from mottet-dev/main.py
InstagramBot - Full
View main.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class InstagramBot():
def __init__(self, email, password):
self.browserProfile = webdriver.ChromeOptions()
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
self.browser = webdriver.Chrome('chromedriver.exe', chrome_options=self.browserProfile)
self.email = email
View CustomizableButton_2.java
package com.abizareyhan;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.support.v7.widget.AppCompatButton;
import android.util.AttributeSet;
import com.abizareyhan.reyplayground.R;
public class CustomizableButton extends AppCompatButton {
@Swisyn
Swisyn / GoogleTranslate.workflow
Created Dec 6, 2018 — forked from buddax2/GoogleTranslate.workflow
Google Translate Automator Service
View GoogleTranslate.workflow
on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=uk&text=" & urldecode(input as string)
return output
end run
on urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode
You can’t perform that action at this time.