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 info.nukoneko.util; | |
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.StringRes; | |
import android.text.SpannableString; | |
import android.text.Spanned; | |
import android.text.method.LinkMovementMethod; | |
import android.text.style.ClickableSpan; | |
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
import java.lang.reflect.InvocationTargetException; | |
/** | |
* Created on 2016/01/22. | |
*/ | |
public class Example { | |
public static void main(String[] args){ | |
BaseClass baseClass = new BaseClass(); | |
ExtendClass extendClass = new ExtendClass(); |
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"; | |
} |
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
# 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
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
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
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
// 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" | |
} | |
} |
OlderNewer