Skip to content

Instantly share code, notes, and snippets.

View ngnam's full-sized avatar

Nguyen Van Nam ngnam

View GitHub Profile
@ngnam
ngnam / devcontainer.json
Created October 15, 2025 03:15
.devcontainer/devcontainer.json
{
"name": "Digital Bank Backend (Spring Boot 3, Java 17, SQLite)",
// Dùng image chính thức của devcontainers có sẵn Java 17 + Gradle/Maven
"image": "mcr.microsoft.com/devcontainers/java:17",
// Thư mục làm việc trong container
"workspaceFolder": "/workspace",
// Mount source code vào container
# BE foundation prompt
- **Goal:** Establish consistent API contracts, error models, and environments for mobile FE integration.
- **API base:** /api/v1/
- **Error model:** RFC7807 Problem+JSON (`type`, `title`, `status`, `detail`, `instance`)
- **Auth:** Bearer JWT (RS256), `Authorization: Bearer <token>`
- **Tracing:** Include `X-Request-Id` echoing, FE should attach it per request.
- **Pagination:** Query `page`, `size`, `sort`; response `items`, `total`, `page`, `size`.
- **Rate limiting:** FE must handle 429 with backoff and user feedback.
- **Idempotency:** For POST transactions, FE must send `X-Idempotency-Key` (UUID v4).
@ngnam
ngnam / IIS Rewrite Cheat Sheet
Created September 18, 2023 08:22 — forked from developerdizzle/IIS Rewrite Cheat Sheet
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />
@ngnam
ngnam / IIS Rewrite Cheat Sheet
Created September 18, 2023 08:22 — forked from developerdizzle/IIS Rewrite Cheat Sheet
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />

Pull and run the SQL Server Linux container image

Choose your command shell PowerShell or Cmd

  1. Pull the SQL Server 2022 (16.x) Linux container image from the Microsoft Container Registry.

docker pull mcr.microsoft.com/mssql/server:2022-latest

  1. run linux container image
@ngnam
ngnam / Countdown.js
Created June 14, 2023 10:07 — forked from chriskonnertz/Countdown.js
Simple JavaScript Countdown Snippet
<div class="countdown" data-datetime="<?php echo time() ?>">
<span class="days">0</span> days
<span class="hours">0</span> hours
<span class="minutes">0</span> minutes
<span class="seconds">0</span> seconds
</div>
<script>
(function()
{
@ngnam
ngnam / Category.sql
Created December 19, 2022 04:37 — forked from ticean/Category.sql
A series of queries for selecting Magento entity EAV attributes, and their values. Lots of union here...
SET @entityid = '3';
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id = @entityid
UNION
@ngnam
ngnam / rest-api-cheatsheet.md
Created November 27, 2021 17:25 — forked from jahe/rest-api-cheatsheet.md
REST API Cheatsheet

REST API Cheatsheet

Source: https://www.youtube.com/watch?v=5WXYw4J4QOU

  • POST, GET, PUT, DELETE != CRUD
  • no verbs -> just nouns for Resources: /applications or /applications/123
  • Possible Responses: Collection of Resources (e.g. with Links) or One instance of a Resource
  • Keep your API course grained to be scaleble to future requirements
  • For Resources: Be as specific as possible: /customers vs. /newsletter-customers and /registered-customers
  • PUT for Create: Can be used when the Client has the ability to create an identifier for the Resource himself. But it has to contain a full replacement of the dataset: PUT /applications/123
@ngnam
ngnam / http-statuscodes.ts
Created May 19, 2021 11:20
http-statuscodes.ts
import { Injectable } from "@angular/core";
/**
* A collection of constants for HTTP status codes. Status Codes listed at http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
*/
@Injectable({ providedIn: 'root' })
export class StatusCodes {
//
// Summary:
// HTTP status code 100.