Skip to content

Instantly share code, notes, and snippets.

View PHPirates's full-sized avatar

Thomas Schouten PHPirates

View GitHub Profile
@PHPirates
PHPirates / sample-bibtex.tex
Created July 29, 2018 09:16
Sample file for testing bibtex bibs.
\begin{filecontents}{main.bib}
@Book{knuth1990,
author = {Knuth, Donald E.},
title = {The {\TeX}book},
year = {1990},
isbn = {0-201-13447-0},
publisher = {Addison\,\textendash\,Wesley},
}
\end{filecontents}
@PHPirates
PHPirates / result.png
Last active May 20, 2018 13:55
Simple tikz block schemas
result.png
@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 / 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