Skip to content

Instantly share code, notes, and snippets.

View PHPirates's full-sized avatar

Thomas Schouten PHPirates

View GitHub Profile
@PHPirates
PHPirates / StuffContainer.kt
Last active March 7, 2018 19:11
Example of use of replaceWith in Kotlin
class StuffContainer(val context: Context?) {
private val prefs = android.preference.PreferenceManager.getDefaultSharedPreferences(context)
/** This is stuff. */
var stuff: Boolean
get() = prefs.getBoolean("stuffkey", false)
set(value) {
prefs.edit().putBoolean("stuffkey", value).apply()
}
@PHPirates
PHPirates / result.png
Last active May 20, 2018 13:55
Simple tikz block schemas
result.png
@PHPirates
PHPirates / IntegerEuclidsToLaTeX.kt
Last active January 11, 2018 15:47
Adapted IntegerEuclids to print LaTeX
import java.math.BigInteger
/**
* The extended euclidian algorithm for two numbers (BigIntegers included). Also prints a LaTeX tabular of all the steps.
*
* Looks for `ax + by = gcd(a, b)` where `a` and `b` are the input variables.
* [gcd] contains the gcd, [x] and [y] contain `x` and `y` as seen in the previous expression.
*
* @author Ruben Schellekens
* @author Thomas Schouten
@PHPirates
PHPirates / Knitr.R
Last active September 6, 2018 15:46
Script to let Knitr generate LaTeX from R code
# author: Sten Wessel
# Instructions:
# Put this file on the same level as your LaTeX file
# Put your R scripts in a folder scripts/
# [IntelliJ] If you want to run your R scripts, make a run configuration as with working directory the folder this file is in
# In your R script, make comments like "## ---- part.a ----" to define sections
# In this file, edit the definition of R script content (the HOMEWORK.1 list)
# In the preamble in your LaTeX file, add the following:
#