Skip to content

Instantly share code, notes, and snippets.

View thibaudcolas's full-sized avatar
😀

Thibaud Colas thibaudcolas

😀
View GitHub Profile
@thibaudcolas
thibaudcolas / dsf-turnout.md
Created November 19, 2024 22:16
DSF elections voter turnout

Over recent elections the data is readiliy available for

Elections Total voters Votes over first 7 days Total votes % 7 days % total
2025 DSF Board 374 76 204 20% 55%
2024 DSF Board 287 93 132 32% 46%
5.x Steering Council 268 74 74 28% 28%
2023 DSF Board 244 58 91 24% 37%
@thibaudcolas
thibaudcolas / models.py
Last active October 30, 2024 13:40
Wagtail snippet to have fields that are only required as part of publishing, rather than when saving drafts.
# Example code to demonstrate how this works in practice
@publish_requires("date_published", block_schedule=True)
class BlogPage(Page):
# […]
date_published = models.DateField("Date article published", blank=True, null=True)
@thibaudcolas
thibaudcolas / proposed-alt-flow.md
Last active July 16, 2024 06:39
Alt text generation flow chart in Wagtail

Alt text generation flow chart in Wagtail

As-is alt flow

Top-down

flowchart TD
    Start[🖼️ Image in the CMS] --> B{Vanilla image model\n alt text\n implementation?}
    B -- Yes --> G
@thibaudcolas
thibaudcolas / readability-formulas.md
Last active July 12, 2024 11:20
Readability formulas recap

Taken from

Perusal of readability with focus on web content understandability

Pawan Kumar Ojha, Abid Ismail, Kuppusamy Kundumani Srinivasan, Journal of King Saud University - Computer and Information Sciences, Volume 33, Issue 1, 2021, Pages 1-10, ISSN 1319-1578,

DOI: https://doi.org/10.1016/j.jksuci.2018.03.007

| Attributes | FRE | Dale-Chall readability | FKGL | Gunning Fog Index | SMOG | ARI | FRY | Forcast | PSK | SPACHE | CLI | BRI | LI× | Raygor Estimate Graph | Djoko Formula | New Fog Count | Pisarek’s Index | Fernandez Huerta Index | Kandal and Moles Index | Al-Heeti Grade Level | Lexile |

@thibaudcolas
thibaudcolas / README.md
Last active July 2, 2024 16:45
Real-world example of Wagtail structured content importing

For wagtail-content-import. Uses mammoth to convert .docx to HTML, rather than python-docx.

Settings:

WAGTAILCONTENTIMPORT_DOCX_PARSER = "content_import_parsers.DocxHTMLParser"

Mapper to a page’s body StreamBlock:

@thibaudcolas
thibaudcolas / code-search.md
Last active June 10, 2024 08:47
Local code search across repositories

Local code search

Sample scripts to fetch recently-used repositories in bulk from GitHub and GitLab.

With basic filtering of specific repositories, and of specific files within repositories.

Search

Use your local copy of the code with ag The Silver Searcher, ripgrep, or your IDE.

@thibaudcolas
thibaudcolas / browser-features-support.md
Created May 28, 2024 13:18
Django browser feature usage per version
effort
2h

Tasks

  • [ ]
@thibaudcolas
thibaudcolas / [...slug].tsx
Created May 7, 2024 21:09
Next.js + GraphQL + Wagtail dynamic page type routing
import { gql } from 'graphql-tag';
// Generic `page` query, by site and URL path (unique per site).
export const pageQuery = gql`
query ($urlPath: String, $siteId: ID, $previewToken: String) {
site(id: $siteId) {
id
page(urlPath: $urlPath, token: $previewToken) {
...getBaseContentPageFields
}
@thibaudcolas
thibaudcolas / package-maintainers-dsf-wg.md
Last active April 11, 2024 09:36
Draft: Package maintainers DSF working group charter

Package Maintainers Working Group

Scope of responsibilities

This group supports package maintainers in the Django ecosystem. Packages are an important part of the experience of using Django, and their maintainers can benefit from different forms of support than Django contributors and users.

The goals of the group are:

  • To facilitate discussions and share knowledge about common issues or tasks in package maintenance.
@thibaudcolas
thibaudcolas / outlines.md
Last active April 9, 2024 23:54
HTTP Archive accessibility chapter outlines

HTTP Archive accessibility chapter outlines

Side by side

Chapter outlines as a spreadsheet

| 2022 | 2021 | 2020 | 2019 | | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------