@startuml Hexagonal Architecture Example
title Hexagonal Architecture Example
package App {
class ApplicationContext {
+ userRepository: UserRepository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Box, render, Text, useStdout } from "ink"; | |
| import { useCallback, useEffect, useState } from "react"; | |
| import { debounceTime, filter, firstValueFrom, fromEvent, map } from "rxjs"; | |
| export function useScreenSize() { | |
| const { stdout } = useStdout(); | |
| const getSize = useCallback(() => ({ height: stdout.rows, width: stdout.columns }), [stdout]); | |
| const [size, setSize] = useState(getSize); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .graph text { | |
| font-family: sans-serif; | |
| stroke: white; | |
| paint-order: stroke; | |
| stroke-width: 3; | |
| stroke-linecap: square; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| echo "🔧 Updating system..." | |
| pacman -Syuu --noconfirm | |
| echo "📦 Installing dependencies..." | |
| pacman -S --noconfirm --needed mingw-w64-x86_64-lua51 mingw-w64-x86_64-gcc git make unzip zip tar gzip p7zip curl wget |
Lua is known for being lightweight, embeddable, and flexible—and its approach to error handling is no different. Whether you're writing a game script, a plugin, or a CLI tool, understanding how Lua handles errors is essential for writing clean, maintainable code.
In this article, we'll explore:
- The basic mechanisms of error handling in Lua
- When to use
error()vs returningnil, err - Best practices for writing robust functions and libraries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { RpcClient } from "./rpc.ts" | |
| import type { RpcAPI } from "./router.ts" | |
| export const client = new RpcClient<RpcAPI>(); | |
| const foo = rpcClient.get("foo"); | |
| foo.getFoo().then(console.log) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { randomUUID } from "node:crypto"; | |
| import * as os from "os"; | |
| import Aigle from "aigle"; | |
| import { UtilityProcess, utilityProcess } from "electron"; | |
| import { compact, flatten, values } from "lodash"; | |
| import { z } from "zod"; | |
| import { trpc } from "../trpc"; | |
| type ServerEntry = { | |
| id: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // App.js | |
| import React from "react"; | |
| import { observer } from "mobx-react-lite"; | |
| import { counterStore } from "./store"; | |
| const App = observer(() => { | |
| return ( | |
| <div> | |
| <h1>{counterStore.count}</h1> | |
| <button onClick={() => counterStore.increment()}>Increment</button> |
The most recognized method to pinpoint a location. It uses:
- Latitude (lat): Specifies how far north or south a point is from the Equator.
- Longitude (lon): Details how far east or west a point is from the Prime Meridian.
Often employed in computer graphics and mathematics:
- 2D Cartesian:
- x: Represents the horizontal axis (often east-west direction).
- y: Represents the vertical axis (often north-south direction).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const schedule = require('node-schedule'); | |
| const { addMinutes, isValid, parseISO } = require('date-fns'); | |
| const bodyParser = require('body-parser'); | |
| const app = express(); | |
| app.use(bodyParser.json()); // for parsing application/json | |
| const port = 3000; |
NewerOlder