7 Reasons Why Clicking This Title Will Prove Why You Clicked This Title
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
interface AdapterUpdatable<TYPE> { | |
companion object { | |
private const val DEFAULT_UPDATE_CURRENT_LIST = false | |
} | |
val list: MutableList<TYPE> | |
fun update( | |
newList: List<TYPE>, | |
updateCurrentList: Boolean = DEFAULT_UPDATE_CURRENT_LIST, |
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
// + info: https://arduino-esp8266.readthedocs.io/en/2.4.2/esp8266wifi/readme.html | |
#include <ESP8266WiFi.h> | |
const char* SSID = "SSID"; | |
const char* PASSWORD = "PASSWORD"; | |
void setup() { | |
Serial.begin(115200); | |
delay(100); | |
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
#include <ESP8266WiFi.h> | |
#include <WiFiClientSecure.h> | |
#include <ArduinoJson.h> | |
const char* SSID = "SSID"; | |
const char* PASSWORD = "PASSWORD"; | |
const String API_KEY = "API_KEY"; | |
const char* SYMBOL = "BTC"; |
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
#include <U8g2lib.h> | |
// constructor | |
U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ 4, /* data=*/ 5); | |
// fake data | |
const String SYMBOL = "Bitcoin"; | |
const String QUOTE = "USD"; | |
const float PRICE = 20000.12345; | |
const float PERCENT_1h = -1.12345; |
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
@RunWith(Parameterized::class) | |
class KotlinTest(val paramOne: Int, val paramTwo: String) { | |
companion object { | |
@JvmStatic | |
@Parameterized.Parameters | |
fun data() : Collection<Array<Any>> { | |
return listOf( | |
arrayOf(1, "I"), // First test: (paramOne = 1, paramTwo = "I") | |
arrayOf(1999, "MCMXCIX") // Second test: (paramOne = 1999, paramTwo = "MCMXCIX") |
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
# ALIAS | |
# ============= | |
alias ..='cd ..' | |
case `uname` in | |
Darwin) | |
alias flushdns='sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed' | |
alias ls='ls -GpF' # Mac OSX specific | |
alias ll='ls -alGpF' # Mac OSX specific | |
;; |
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
val world = "World" | |
val spannedText = SpannableString("Hello $world!") | |
spannedText | |
.spanWith(world) { | |
what = BackgroundColorSpan(Color.RED) | |
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | |
} | |
.spanWith(world) { | |
what = StyleSpan(Typeface.BOLD) | |
flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE |
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
abstract class BindableAdapter<TYPE : MultiType>(private val list: MutableList<TYPE>) : RecyclerView.Adapter<BindableViewHolder<TYPE>>() { | |
override fun onBindViewHolder( | |
holder: BindableViewHolder<TYPE>, | |
position: Int | |
) = holder.bind(list[position]) | |
override fun getItemViewType(position: Int): Int = list[position].type | |
override fun getItemCount(): Int = list.size | |
} |