Skip to content

Instantly share code, notes, and snippets.

View NorseDreki's full-sized avatar
🐲

Alex Dmitriev NorseDreki

🐲
View GitHub Profile
@dodyg
dodyg / gist:5823184
Last active October 20, 2024 12:25
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@ceharris
ceharris / README.md
Last active December 16, 2015 20:39
An example of the (non-)effect of Thread.interrupt on a fairly typical long-running task.

I think that Thread.interrupt() sounds more intrusive than it really is. Thread interruption in Java is entirely advisory. Generally a task does not need to go to any effort to avoid being interrupted. Rather, it usually takes some real effort to properly observe the interrupt status in order to exit when interrupted, if such is desired. Short of putting in the effort to observe the thread's interrupt status, I think you'll find that arbitrary tasks are quite resilient in the face of interrupts.

A task can check the thread's interrupt status at any time by calling Thread.isInterrupted(). If you wish to make a runnable task interruptible, your code must occasionally check the interrupt status and exit the run() method if the task has been interrupted. If you don't want your task to be interrupted, simply ignore the thread's interrupt status.

JDK methods that examine the thread's interrupt status are consistently declared to throw InterruptedException, so they are easily identified. I/O calls w

@SzymonPobiega
SzymonPobiega / gist:5220595
Last active March 30, 2025 21:48
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht