Skip to content

Instantly share code, notes, and snippets.

View WhereJuly's full-sized avatar

WhereJuly WhereJuly

View GitHub Profile
@WhereJuly
WhereJuly / modelina-custom-properties-naming.ts
Last active October 24, 2025 10:02
AsyncAPI Modelina custom property names
'use strict';
import fs from 'node:fs/promises';
import path from 'node:path';
import { Parser, fromFile } from '@asyncapi/parser';
import { PropertyKeyContext, TypeScriptGenerator } from '@asyncapi/modelina';
/**
* Modelina by default transforms payload properties' names into `camelCase`. This custom sctript
* retirns the property names as-is keeping your `snake_case` naming in place.
@WhereJuly
WhereJuly / docker_wsl2.md
Created October 2, 2025 05:07 — forked from sz763/docker_wsl2.md
How to run tests with TestContainers in WSL2 without Docker Desktop

Install docker

in case you haven't docker installed, please follow this instruction https://docs.docker.com/engine/install/ubuntu/

Expose docker port

First way

Create daemon.json file in /etc/docker, with content:

{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}

Second way suggested by @maireadmccabe-fire

@WhereJuly
WhereJuly / example.ts
Last active February 20, 2024 14:39
fastify-http-proxy (fastify/reply-from) replyOptions.onResponse getting the original response body example
'use strict';
import fastify, { FastifyReply, FastifyRequest, RawReplyDefaultExpression, RawServerBase, RequestGenericInterface } from 'fastify';
import proxy from '@fastify/http-proxy';
const server = fastify();
server.register(proxy, {
upstream: 'http://proxied.tld',
prefix: '/proxied',
@WhereJuly
WhereJuly / 1) package.json
Last active August 23, 2023 07:24
Making node-tap working with TypeScript & `"type": "module"` in package.json (2023-08) (no artificial .js extensions for actual .ts fiiles)
{
"type": "module",
"test": "tap",
"devDependencies": {
"@esbuild-kit/esm-loader": "^2.5.5",
"@swc/core": "^1.3.77",
"@tsconfig/node18": "^18.2.0",
"@types/node": "^20.5.0",
"@types/tap": "^15.0.8",
"tap": "^16.3.8",
@WhereJuly
WhereJuly / composer.json
Last active April 2, 2023 00:23
Standalone Laravel 8.25 validation with genuine Laravel messages
// ...some entries
"require": {
"illuminate/validation": "^8.25",
"illuminate/translation": "^8.25"
}
// ...some more entries
@WhereJuly
WhereJuly / error.log
Created January 16, 2021 14:10
OpenCart v3.0.3.6 error log for Twig issue
// See the issue here https://github.com/opencart/opencart/issues/8103#
2021-01-16 13:57:24 - MOD: Modification Default
FILE: system/engine/action.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 69
FILE: system/engine/loader.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
// The issue solved with this config is `twig-loader` and Webpack process the image assets
// referenced in `.twig` templates the correct way.
// Namely as a build process result, the images are copied to `.dist` folder with hashed names,
// the `src` images' attributes in the output HTML file produced from the Twig templates
// are updated with the respective hashed names.
module.exports = {
runtimeCompiler: true,
outputDir: '.dist',
@WhereJuly
WhereJuly / gulpfile.js
Created May 26, 2020 10:44
Development environment live reload Gulp task for Adonis 4.1.0 full-stack project with Browsersync
// In fact can be used for every web project that needs live reload for dev environment.
// The accompanying guide is here:
// https://github.com/adonisjs/core/issues/1234#issuecomment-633937899
'use strict';
const gulp = require('gulp'),
browserSync = require('browser-sync').create();
const config = {
@WhereJuly
WhereJuly / BasicAPITest.spec.js
Last active September 14, 2020 05:23
Mocha test with `async/await` vs `done` approaches
'use strict';
const assert = require("assert");
const chai = require("chai");
const chaiHttp = require("chai-http");
const server = require("../src/app");
// See the coupled Express server snippet here
// https://gist.github.com/WhereJuly/7b275ec75380505aa9db9a384f0e4ab3
@WhereJuly
WhereJuly / app.js
Last active May 9, 2020 07:51
Basic Express server serving a simplest app with server object exported for tests
'use strict';
const app = require('express')();
app.get('/', (req, res) => {
res.status(200).json({ message: 'Connected!' });
});
// Turn on that server!
const server = app.listen(3000, () => {