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.text.InputFilter | |
import android.text.Spanned | |
class RangeInputFilter(private val min: Int, private val max: Int) : InputFilter { | |
override fun filter( | |
source: CharSequence, | |
start: Int, | |
end: Int, | |
dest: Spanned, | |
dstart: Int, |
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
-- Disable this flag to remove the glow particle around the flashlight's lens. | |
local enableGlow = true; | |
local glowParticle; | |
local lightTable = { | |
classname = "light_spot", | |
targetname = "light" .. thisEntity:entindex(), | |
enabled = 0, | |
brightness = "1.5", | |
range = "400", |
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 MarriageProblemSolver.Person | |
class MarriageProblemSolver { | |
class Person(val name: String) { | |
internal lateinit var preferences: List<Person> | |
internal var proposals = 0 | |
var match: Person? = null | |
internal set | |
// Do a lateinit to allow the circular dependency of people with their preferences of people. |
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 com.squareup.javapoet.AnnotationSpec; | |
import com.squareup.javapoet.ClassName; | |
import com.squareup.javapoet.CodeBlock; | |
import com.squareup.javapoet.TypeSpec; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
import java.util.TimeZone; | |
import javax.lang.model.SourceVersion; |
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
/* | |
* Copyright (C) 2018 Eric Cochran | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 com.squareup.moshi.Json; | |
import com.squareup.moshi.JsonAdapter; | |
import com.squareup.moshi.JsonReader; | |
import com.squareup.moshi.JsonWriter; | |
import java.io.IOException; | |
public final class EnumWithDefaultValueJsonAdapter<T extends Enum<T>> extends JsonAdapter<T> { | |
private final Class<T> enumType; | |
private final String[] nameStrings; | |
private final T[] constants; |
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.BindsInstance; | |
import dagger.Component; | |
import dagger.Subcomponent; | |
import javax.inject.Inject; | |
final class App { | |
private final Sub.Builder subBuilder; | |
private final AppDependency appDependency; | |
@Inject App(AppDependency appDependency, Sub.Builder subBuilder) { |
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
/* | |
* Copyright (C) 2017 Eric Cochran | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
class View { | |
Data data; | |
void setData(Data data) { | |
this.data = data; | |
setOnClickListener(v -> run(data)); | |
} | |
} | |
class View { | |
Data data; |
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.io.File; | |
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
import java.util.TimeZone; | |
import okio.BufferedSource; | |
import okio.ByteString; |
NewerOlder