Skip to content

Instantly share code, notes, and snippets.

@misostack
Last active October 25, 2022 03:43
Show Gist options
  • Save misostack/ca515d133b38fa6934d1a1344892a0a0 to your computer and use it in GitHub Desktop.
Save misostack/ca515d133b38fa6934d1a1344892a0a0 to your computer and use it in GitHub Desktop.
WEB CHEATSHEET

WEB CHEATSHEET

What is the maximum length of a url in different browsers?

https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers#:~:text=Short%20answer%20%2D%20de%20facto%20limit,of%20client%20and%20server%20software.

image

KB to string

https://stackoverflow.com/questions/1515884/using-javascript-to-truncate-text-to-a-certain-size-8-kb

image

function toBytesUTF8(chars) {
    return unescape(encodeURIComponent(chars));
}
function fromBytesUTF8(bytes) {
    return decodeURIComponent(escape(bytes));
}

function truncateByBytesUTF8(chars, n) {
    var bytes= toBytesUTF8(chars).substring(0, n);
    while (true) {
        try {
            return fromBytesUTF8(bytes);
        } catch(e) {};
        bytes= bytes.substring(0, bytes.length-1);
    }
}

image

Which size should you choose to create a text column in MYSQL?

https://chartio.com/resources/tutorials/understanding-strorage-sizes-for-mysql-text-data-types/#:~:text=TINYTEXT%3A%20255%20characters%20%2D%20255%20B,requires%20a%201%20byte%20overhead.

image

What are common Authorization Models?

https://casbin.org/docs/en/supported-models

image

RBAC

image image image image image image image image image image image

image image image image image

image image image image image image

@misostack
Copy link
Author

image

@misostack
Copy link
Author

misostack commented Jul 15, 2022

Setup 1 project REST Api với NestJS như thế nào cho chuẩn

Tổng quan Architecture

image

Ứng dụng

Xây dựng REST API cung cấp dữ liệu thời gian thực giá vàng

image

Tính năng cập nhật giá vàng

  1. Cập nhật giá vàng theo ngày : nhập thông thường
  2. Cập nhật giá vàng hàng loạt: import tập tin excel theo định dạng
  3. Cập nhật giá vàng tự động: thiết lập link liên kết lấy giá vàng, khoảng thời gian lấy

Tính năng hiển thị giá vàng

Dạng hiện thị : dạng bảng hoặc dạng biểu đồ

  1. Hiển thị giá vàng theo giờ
  2. Hiển thị giá vàng theo ngày
  3. Hiển thị giá vàng theo tuần
  4. Hiển thị giá vàng theo tháng
  5. Hiển thị giá vàng theo năm

Phân tích

image
image

Output

image

Lựa chọn database và cách lưu trữ

  1. MongoDB
  2. Nested Object

Coding

Database first

  1. Install mongoose package for NestJS
  2. Configure mongoose connection
  3. Create Model
  4. Generate dataseed
  5. Write tests for create, read, update, delete

image

@misostack
Copy link
Author

Setup firebase base cloud messaging

image

@misostack
Copy link
Author

Optimize and secure your images

Performance

  1. Size
  2. Quality
  3. Preload
  4. Lazy load
  5. Caching
  6. CDN
  7. SVG

SEO

  1. Alt
  2. Title
  3. Specific image's size : width, height
  4. FCP : first content paintful
  5. Adaptive and responsive images
  6. image/webp format
  7. Place holder

Security

  1. External images
  2. SVG
  3. CDN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment