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
// Define the amount of ice to trigger the collector deactivation | |
const int iceThreshold = 100000; | |
// Quick-access variables to avoid reinstantiation | |
IMyGridTerminalSystem grid; | |
List<IMyCollector> collectors; | |
List<IMyTerminalBlock> containers; | |
public Program() | |
{ |
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
; Ender 3 Custom Start G-code | |
M140 S{material_bed_temperature} ; start preheating the bed WITHOUT wait to what is set in Cura | |
M104 S{material_print_temperature} T0 ; start preheating hotend WITHOUT wait to what is set in Cura | |
G92 E0 ; Reset Extruder | |
G28 ; Home all axes | |
M190 S{material_bed_temperature} ; start heating the bed to what is set in Cura and WAIT | |
M109 S{material_print_temperature} T0 ; start heating hotend to what is set in Cura and WAIT | |
; ALL BY DEFAULT BELOW THIS | |
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed | |
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position |
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 IOException(val error: Any?) : Exception() | |
/** | |
* Flattens this IO's Either into IO itself, wrapping the untyped-Left side on a custom exception. | |
* | |
* Note: This is a workaround until IO<E, A> is available | |
*/ | |
fun <A, B> IO<Either<A, B>>.flattenEither(): IO<B> = | |
this.flatMap { | |
it.fold(ifLeft = { |
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
@JvmName("thenErrorObservable") | |
fun <T> OngoingStubbing<Observable<T>>.thenError(throwable: Throwable) { | |
thenReturn(Observable.error(throwable)) | |
} | |
fun OngoingStubbing<Completable>.thenComplete() { | |
thenReturn(Completable.complete()) | |
} | |
@JvmName("thenErrorCompletable") |
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
object Versions { | |
val kotlin = "1.2.21" | |
val appCompat = "27.0.2" | |
val constraintLayout = "1.0.2" | |
val kodein: String = "4.1.0" | |
val knex: String = "1.0" | |
val assertk: String = "0.9" | |
val mockitoKotlin: String = "1.5.0" | |
val koinAndroid: String = "0.8.2" | |
} |
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
public class UriUtil { | |
private final Context context; | |
private static final byte[] GIF89A_HEADER = {0x47, 0x49, 0x46, 0x38, 0x39, 0x61}; | |
@Inject | |
public UriUtil(Context context) { | |
this.context = context; | |
} | |
public boolean isGif(Uri input) { |
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
def publish = project.tasks.create("copyApkToCustomDir") | |
android.applicationVariants.all { variant -> | |
variant.outputs.all { output -> | |
def task = project.tasks.create("copy${variant.name}Apk", Copy) | |
task.from(output.outputFile) | |
task.into("$project.buildDir/outputs/apk/") | |
println "Done" | |
task.dependsOn variant.assemble |
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 io.reactivex.CompletableObserver | |
import io.reactivex.MaybeObserver | |
import io.reactivex.Observer | |
import io.reactivex.SingleObserver | |
import io.reactivex.disposables.Disposable | |
import io.reactivex.exceptions.CompositeException | |
import io.reactivex.exceptions.Exceptions | |
import io.reactivex.functions.Action | |
import io.reactivex.functions.Consumer | |
import io.reactivex.internal.functions.Functions |
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 <T> Single<T>.doCompletableOnSuccess(function: (T) -> Completable): Single<T> = | |
flatMap { function(it).andThen(Single.just(it)) } | |
fun <T> Maybe<T>.doCompletableOnSuccess(function: (T) -> Completable): Maybe<T> = | |
flatMap { function(it).andThen(Maybe.just(it)) } |
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
Completable.complete() | |
.subscribe( | |
Action { throw exception }, | |
Consumer { /* wont be called */ } | |
) | |
Observable.just(str) | |
.subscribe( | |
Consumer { throw exception }, |
NewerOlder