Assume a template syntax where you can use {x}, {{x}}, and {{{x}}}. How can we leverage regular expressions for this?
Example snippet:
{b} c {{d}} e {{{f}}} g
| 'use strict'; | |
| import { createServer } from 'node:http'; | |
| /* | |
| * Usage: | |
| * node server.js | |
| * | |
| * This will pick a random available port on your local machine. You can steer the port and host using environment variables: | |
| * PORT=8080 HOST=localhost node server.js |
| // Using AWS Cognito via TypeScript | |
| import { AdminCreateUserCommand, AdminDeleteUserCommand, CognitoIdentityProviderClient } from '@aws-sdk/client-cognito-identity-provider'; | |
| const addresses = [ | |
| // valid | |
| '[email protected]', | |
| '[email protected]', | |
| '"name..name"@example.com', | |
| 'name@localhost', |
| /* eslint-disable max-classes-per-file */ | |
| /* | |
| * An experiment about how we can structure this codebase | |
| */ | |
| /* | |
| * Request handling infrastructure | |
| */ |
| import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'; | |
| export class ApiGatewayCorrelationContextMiddleware implements IMiddleware<APIGatewayProxyEvent, APIGatewayProxyResult> { | |
| public async process(event: APIGatewayProxyEvent, next: Handler<APIGatewayProxyEvent, APIGatewayProxyResult>): Promise<APIGatewayProxyResult> { | |
| return next(event); | |
| } | |
| } | |
| class SomeMiddleware implements IMiddleware<APIGatewayProxyEvent, APIGatewayProxyResult> { | |
| public async process(event: APIGatewayProxyEvent, next: EventHandler<APIGatewayProxyEvent, APIGatewayProxyResult>): Promise<APIGatewayProxyResult> { |
| import { Context } from 'aws-lambda'; /* npm install @types/aws-lambda */ | |
| export interface IMiddleware<E, R> { | |
| process(event: E, context: Context, next: IHandler<E, R>): Promise<R>; | |
| } | |
| export interface IHandler<E, R> { | |
| handle(event: E, context: Context): Promise<R>; | |
| } | |
I wanted to combine some old fashioned MP3 files and I did not want to download a separate application. Only thing necessary when combining MP3 files is stripping the ID3 tags - if present.
php -f join_mp3.php {destination} [{source}]Edit: Turned out I has some multidisc mixtapes with .cue files lying around as well. So I wrote a joiner script for that as well:
php -f join_cue.php {destination} [{source}:{duration_of_source}]| # Installing Unreal Tournament GOTY on MacOS Catalina and up | |
| - Buy game on GoG via https://www.gog.com/game/unreal_tournament_goty | |
| - Download archive set up - Not the download the GoG installer, but download the Unreal Tournament installer (302MB). | |
| - Unpack with `innoextract` (`brew install innoextract`) - Move installer to folder first for scoping. | |
| - Install [UnrealTournamentPatches](https://github.com/OldUnreal/UnrealTournamentPatches/releases) - don't forget to drag the executable to Applications | |
| - In Finder, go to Applications, right click `UnrealTournament` and click `Show package contents` | |
| - Inside the package contents navigate to `Contents` > `MacOS` | |
| - Copy the folders `Maps`, `Music`, `Sounds` and `Textures` from the unpacked Unreal Tournament installer and paste them in the `Contents` > `MacOS` folder. | |
| - Profit! |
| // This is very, very heavily inspired by the [video](https://www.youtube.com/watch?v=8OK8_tHeCIA) and | |
| // [code](https://github.com/OneLoneCoder/videos/blob/master/OneLoneCoder_Tetris.cpp) of One Lonely Code. | |
| // Big thanks to him. | |
| import { stdout, stdin } from 'process'; | |
| import { WriteStream } from 'tty'; | |
| const keypress = require('keypress'); | |
| class PlayingField { | |
| private readonly width: number; |
| <?php | |
| // In the current solution we have three separate interfaces. This allows for a clean separation of functionality: | |
| interface QueryExecutorInterface | |
| { | |
| public function execute(QueryInterface $query): array; | |
| } | |
| interface QueryMetadataServiceInterface |