Skip to content

Instantly share code, notes, and snippets.

@humorless
Last active November 25, 2025 06:56
Show Gist options
  • Select an option

  • Save humorless/17bba940c4d26c94f7fd0fd57b10f027 to your computer and use it in GitHub Desktop.

Select an option

Save humorless/17bba940c4d26c94f7fd0fd57b10f027 to your computer and use it in GitHub Desktop.

CSS 相關

  1. Tailwind 練習
  2. CSS in js/cljs
  3. CSS selector
  4. CSS pseudo class

Post 相關

RESTful form methods

  • 利用 form 裡的 hidden field 來做 put, patch, delete 的操作。
  • 必須搭配使用 global middleware (在 route 之前執行)

PRG = post-redirect-get

  1. RFC 7231
  2. redirect 303
  3. middleware flash 機制 (wrap-flash)

useful javascript

  1. document.querySelectorAll () ;; minimal JQuery
  2. 三個好用的 javascript 函數:alert, confirm, prompt

Design Principles

  • Validation Logic If we check in the frontend, make sure we also check in the backend (general principle: check things in the backend first, then we can consider frontend)

web patterns

  • PRG (post-redirect-get) = CQRS
  • session = state separation + state linkage + stateless env
  • DB, query-strings in request = context object pattern
  • CSRF token = Multi-Factor Verification
  • Repository Pattern = 比方說,使用 findById() 而不是直接下 SQL。

frontend patterns

  • Container/Presenter Pattern
    • frontend form lib
    • frontend widget lib
  • Unobtrusive JavaScript
  • Data-Driven Behavior Pattern
  • Use URL to represent State

common ring middleware

  • params
  • keyword-params
  • content-type
  • session
  • flash
  • wrap-log-request
  • wrap-content-security-policy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment