Skip to content

Instantly share code, notes, and snippets.

View cies's full-sized avatar

Cies Breijs cies

View GitHub Profile
@cies
cies / gradle_snippet.kt
Created May 31, 2023 10:02
Make Gradle print its task plan
// This prints the dependencies of each task in the current execution graph
gradle.taskGraph.whenReady(
closureOf<TaskExecutionGraph> {
println("About to run ${allTasks.size} tasks: (use `-i` to see why tasks are skipped, use `--rerun-tasks` to prevent UP-TO-DATE checks)")
allTasks.forEachIndexed { i, task ->
val dependenciesString =
if (task.dependsOn.isEmpty()) {
""
} else {
task.dependsOn.joinToString(", ", " (depends on ", ")") { dependency ->
@cies
cies / reversed-subtraction.rb
Created November 9, 2022 07:38
Research patterns in "reverse substracting" numbers from themselves
#!/usr/bin/env ruby
# Bit of code to research patterns in "reverse substracting" numbers from themselves. Observations:
# * Mostly they reduce to zero; this can be by several routes:
# * Quick
# * 9's route (also: 99, 909, 999, 9009, 9999, 90009, 99099, 99999, etc.)
# * 54-45 route (also: 54945, 549945, 5499945, 54999945, etc.)
# * End up in a loop, which is always by route of a 2 sets of "magic numbers":
# * 2187, 21987, 219987, 2199987, 21999987, etc.

Vereisten voor de Elm cursus

Korte link naar deze pagina: bit.ly/3kL1FIT

Ieder heeft een van de volgende twee setups nodig:

  • Met Elm en IntelliJ geinstalleerd (zie hier de installatie instructies):
    • IntelliJ met myproject open waar het plus min voorbeeld in staat
  • een terminal met elm repl (kun je stukjes testen)
@cies
cies / elm-course.md
Last active March 5, 2021 12:57
Prepare for the Elm Course

Install Elm and IntelliJ

For the course we will use the programming language Elm.

It is possible to use an online Elm environment name Ellie: in that case there is nothing for you to install.

But you can also install Elm and a code editor (IntelliJ) with the Elm plugin. This has some advantages:

  • You do not depend on the internet working

Simple games ideas for trying out Elm

For some of these game you will need "random numbers".

Here's the official guide on doing random in Elm. To get the example to work in Ellie you need to add a module definition on top (the compile error will guide you in the right direction) and add the Random package from the "Package" menu (see package icon) on the left.

The game ideas:

  • Write function that translates a text to Pig Latin and back.
@cies
cies / intro-to-elm.md
Last active March 5, 2021 11:01
A beginner's introduction to Elm (0.19.1)

Elm: Elegant browser programs

Elm is a programming language that compiles to JavaScript (the main language understood by web browsers).

Contrary to some other programming languages (like C, C++, Java or Rust), Elm is not "general purpose", it is designed specifically to create web applications.

What makes Elm unique:

  • Easy to get started, as it...
@cies
cies / exceptions.md
Last active November 8, 2019 09:03
Exceptions in general and in Java/Kotlin/TS in particular

Exceptions in general and in Java in particular

The use of exceptions for anything but unrecoverable errors is greatly contested in programming. In this article we try to shed some light on this matter. But before we start digging deeper, here some considerations:

  • Unrecoverable is not very well defined. Sometimes it makes sense for software to crash: print some final log lines, try to do some cleanups and abort. Sometimes it does not: when we are in some code that simply needs to fail hard at that particular task/job/request (and surely log the "bug hinting error") but remain in service. Unrecoverable could also mean: cannot continue without a retry.

  • There is a common phrase "exceptions should be used for exceptional conditions; things you don't expect to happen" which does not add much to the discussion. What is truly exceptional is about as vague as truly unrecoverable.

  • Some languages, notably Java (but not Kotlin!), allow for "checked" exceptions. In Java these checked exceptions (inheriting fr

@cies
cies / exceptions.md
Created November 7, 2019 13:55
xceptions in general and in Java/Kotlin/TS in particular

Exceptions in general and in Java in particular

The use of exceptions for anything but unrecoverable errors is greatly contested in programming. In this article we try to shed some light on this matter. But before we start digging deeper, here some considerations:

  • Unrecoverable is not very well defined. Sometimes it makes sense for software to crash: print some final log lines, try to do some cleanups and abort. Sometimes it does not: when we are in some code that simply needs to fail hard at that particular task/job/request (and surely log the "bug hinting error") but remain in service. Unrecoverable could also mean: cannot continue without a retry.

  • There is a common phrase "exceptions should be used for exceptional conditions; things you don't expect to happen" which does not add much to the discussion. What is truly exceptional is about as vague as truly unrecoverable.

  • Some languages, notably Java (but not Kotlin!), allow for "checked" exceptions. In Java these checked exceptions (inheriting fr

/* On Linux this file should be in:
~/.mozilla/firefox/$USER_ID.default/chrome/userChrome.css
To be used with the awesome Tree Style Tabs addon.
*/
/* Hide horizontal tabs at the top of the window */
@-moz-document url("chrome://browser/content/browser.xul") {
#TabsToolbar {
visibility: collapse !important;
@cies
cies / belasting_app_op_ubuntu.md
Created June 14, 2018 10:41
Het installeren van de Belastingdienst applicatie(s) op een recente (2018) Ubuntu versie

Deze gist om mijn ervaring/oplossing te delen met het installeren van de Belastingdienst applicatie la2018ux op een recente Ubuntu. Wellicht dat dit ook werkt op Debian, geen idee.

Allereerst: samen on de Belastingdienst dat ze die app(s) alleen in 32-bit leveren, terwijl 64-bit al 10 jaar meer gangbaar is dan 32-bit. Ik raad iedereen aan om hier over te klagen (vraag of ze er een aantekening van maken en het doorgeven), dan gaan ze wellicht ooit voor ons marginaal kleine clubje zorgen! Maar ik verwacht dat ze een web app eerder afhebben, dan een 64-bit build.

Ik heb de .deb gedownload. Er stond iets verkeerd ingesteld waardoor mijn browser de inhoud van de .deb probeerde weer te geven. Ik heb de link gekopieerd en met wget dat ding gedownload.

Toen eerste poging:

sudo dpkg -i la2018_1.10_i386.deb