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
/* | |
// example: | |
func getAuthToken() -> String { | |
return methodMonitoring { | |
return apiService.requestToken() | |
} | |
} | |
MONITORING: ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | |
MONITORING: ┃ Thread: <NSThread: 0x6000036ef280>{number = 1, name = main} |
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 android.support.test.espresso.IdlingRegistry | |
import android.support.test.espresso.IdlingResource | |
inline fun <T: IdlingResource?, R> T.use(block: (T) -> R): R { | |
var exception: Throwable? = null | |
try { | |
IdlingRegistry.getInstance().register(this) | |
return block(this) | |
} catch (e: Throwable) { | |
exception = e |
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
// usage | |
val adapter = ViewListAdapter(listOf(TextView::class, ImageView::class, Button::class)).apply { | |
listener = object : ViewListAdapter.Listener { | |
override fun onViewSelect(selectedViewInstance: View?) { | |
when(selectedViewInstance) { | |
is TextView -> selectedViewInstance.text = "textView" | |
is ImageView -> selectedViewInstance.setImageResource(android.R.drawable.ic_input_add) | |
is Button -> selectedViewInstance.text = "button" | |
} | |
} |
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
fun KClass<out View>.get(context: Context): View? = primaryConstructor?.call(context) |
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
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.vm.network "private_network", ip: "192.168.33.10" | |
config.vm.provision "shell", inline: <<-SHELL | |
# update | |
sudo yum update | |
# add docker repo | |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
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 dagger.Component; | |
import dagger.Module; | |
import dagger.Provides; | |
import javax.inject.Inject; | |
public class Main { | |
public static void main(String[] args) { | |
AnimalCry animalCry = new AnimalCry(); | |
animalCry.cry(); |
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
# pattern | |
## 3: NSDayCalendarUnit | |
## 17: NSYearForWeekOfYearCalendarUnit | |
NS(.{3,17})CalendarUnit | |
# replace | |
NSCalendarUnit$1 |
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
// Factory Method | |
public interface Human { | |
String getName(); | |
} | |
/// Tanaka Factory | |
sealed class TanakaImpl : Human { | |
public string getName() { | |
return "Tanaka"; | |
} |
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
// Factory Method | |
public interface Human { | |
String getName(); | |
} | |
/// Tanaka Factory | |
final class TanakaImpl implements Human { | |
@Override public String getName() { | |
return "Tanaka"; | |
} |
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
// Factory Method | |
public protocol Human { | |
func getName()->String; | |
} | |
/// Tanaka Factory | |
final class TanakaImpl : Human { | |
func getName() -> String { | |
return "Tanaka"; | |
} |