- Meaningful images have text alternatives (
alt
for<img>
,aria-label
otherwise) - Decorative images are hidden (
alt=""
for<img>
,aria-hidden="true"
otherwise) - Images required to understand the content point to a description with the
aria-describedby
attribute - Images containing text (memes are a perfect example) have a text alternative
- If the image has a legend, it is in a
<figcaption>
tag - If the image is a CAPTCHA, there is a non graphical alternative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@contextlib.contextmanager | |
def assert_no_duplicated_queries( | |
max_number_of_duplicated_queries: int = 0, | |
max_number_of_duplications: int = 1, | |
) -> collections.abc.Generator[None, None, None]: | |
"""A context manager that verifies that no SQL statement is run twice | |
during the execution of the code in the context to prevent N+1 issues. | |
The max_number_of_duplicated_queries param can be set | |
to progressively fix a code ridded with N+1 issues. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Usage **/ | |
// const results = await getAllQueryPages( | |
// SomeModel.query("MY_PK", { | |
// index: GSI.GSI1.IndexName, | |
// }) | |
// ); | |
/** getAllQueryPages.ts **/ | |
import { DocumentClient } from "aws-sdk/lib/dynamodb/document_client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import middy from "@middy/core"; | |
import get from "lodash/get"; | |
import set from "lodash/set"; | |
import { gzipSync } from "zlib"; | |
import isString from "lodash/isString"; | |
import { hasProperty } from "@smallable/help-purchase-shared"; | |
export type GzipMiddlewareConfig = Record<string, never>; | |
type NormalizedResponse = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
from contextlib import contextmanager | |
from django.db import connection | |
class QueryLogger: | |
def __init__(self): | |
self.queries = [] |
C'est le choix le plus important. Il ne faut pas tordre un système existant qui ne convient pas, cela fera perdre beaucoup de temps en overrides et annulera le gain d'utiliser cette library.
Choix faciles
- Identité visuelle forte / image de marque ? => from scratch
- Pas de designer ? => design library