Skip to content

Instantly share code, notes, and snippets.

View cataska's full-sized avatar
😱
🥺😢😭

Wen-Chun Lin cataska

😱
🥺😢😭
  • Taipei, Taiwan
View GitHub Profile
@jackfirth
jackfirth / continuation-lessons.md
Last active August 9, 2024 02:59
Examples of how to build control flow structures with continuations

Lessons in Using Continuations

This gist contains examples of how to build different kinds of control flow structures in Racket using macros and continuations. Examples include:

  • Early exit from functions using a return statement.
  • Early exit from arbitrary expressions using a simple exception system.
  • Temporarily interrupting execution in order to check permissions.
import java.lang.Exception
/*
Extra notes regarding Forth as expected by testcases:
- words are case-insensitive, this interpreter normalizes all symbols to uppercase.
- static scoping: when a word is being defined, the enviroment is kept as it is (i.e. closure required).
- the word itself is not considered in the definition of that word
(i.e. a previous definition of the same word may be picked)
- primitive words and operations are subject to shadowing.
/*
1) Open https://popcat.click
2) Open console (F12)
3) Insert code & run
*/
var event = new KeyboardEvent('keydown', {
key: 'g',
ctrlKey: true
@ingramchen
ingramchen / sealed_example.kt
Last active February 23, 2023 03:36
Domain Model Layer Convention (Model 層級管理)

Model 層級管理

Domain Model 層的意義

一個傳統 Java Spring 的應用程式會分為三層 @Controller @Service @Repository,然後依據組織需求,再往下細分。 比方說 Service 層複雜的話,會增加 Gateway、Facade 層,或是我們組織獨有的 CoreService 層

另一個層級大部份 Java 組織會忽略的是 Domain Model 層,絕大多數 Java 開發者會開個 entity 或 model package,然後 將所有的 Entity 往裡面丟。然而該 Entity 只是一堆欄位和 getter/setter 的堆疊,也就是單純的 Table 的對應物件而已, 不具備任何 business logic