Skip to content

Instantly share code, notes, and snippets.

View alz-ahm's full-sized avatar
😎
coding...

A.A. alz-ahm

😎
coding...
View GitHub Profile
@alz-ahm
alz-ahm / RunDjangoAndNginxOnCentOS.md
Last active October 19, 2021 11:30
Running Django and Nginx on CentOS 7

How to run Django and Nginx on CentOS 7

I used this steps to install django on centOs for more than 10 times and it worked for me but it may not contain all the details you may need in your project.

Configure connections

nmtui

  • Edit a connection
  • fill connection information:
    • set IPv4 to Manual
    • set IPv4 address (172.16.20.xxx)
    • set Gateway to 172.16.20.2
class ClassA {
var classB: ClassB
constructor(classB: ClassB){
this.classB = classB
}
}
class ClassB {
var classC: ClassC
constructor(classC: ClassC){
class ClassA {
var classB: ClassB
}
class ClassB {
var classC: ClassC
}
class ClassC {
}
class ClassA {
var classB: ClassB
fun someMethodOrConstructor() {
classB = ClassB()
classB.doSomthing()
}
}
class ClassA {
var classB: ClassB
@Inject constructor(classB: ClassB){
this.classB = classB
}
}
class ClassB {
var classC: ClassC
@Inject constructor(classC: ClassC){
class OurThirdPartyGuy {
fun provideClassC(){
return ClassC() //just creating an instance of the object and return it.
}
fun provideClassB(classC: ClassC){
return ClassB(classC)
}
fun provideClassA(classB: ClassB){
fun provideClassC(){
return AssumeClassC()
}
@alz-ahm
alz-ahm / View-Handling_Logic-Wrong.kt
Last active March 15, 2019 09:59
View-View-Model-Communication
//This is wrong!!
myView.visibility = if(user.isAdmin()) View.VISIBLE else View.GONE
//This is right!!
mySubmitBtn.setOnClickListener {
viewModel.submitData()
}
//This is right!!
viewModel.adminAccessVisibility.observe(this, Observer {
myView.visibility = it
})