Skip to content

Instantly share code, notes, and snippets.

View laymonage's full-sized avatar
👋
looking for friends from around the world, hmu!

S​age Abdullah laymonage

👋
looking for friends from around the world, hmu!
View GitHub Profile
@laymonage
laymonage / legacy-rules.md
Last active February 5, 2026 17:42
eslint-config-wagtail migration

Rules

For each item in this table, do:

  • Check the documentation page from the package that defines the rule (there's a link)
  • If it's enabled by default via recommended rules that we're already using, mark "Copied" as ❌ and add a note about it being enabled by default
  • If it's not enabled by default, review if it makes sense for us to adopt it (based on usefulness and relevance with modern practices)
  • If it makes sense, copy the rule to index.js and mark "Copied" as ✅. Try to retain the "Config" value, but if any config value already matches the default for that rule, then leave it be
  • If the "Config" says "see Config", don't bother following the link for the config and just enable the rule, but add a note about this like "review config"
  • If it doesn't make sense to enable this, mark "Copied" as ❌ and add a note on why it's not enabled
print("""
@@
@@@
@@@@
@%-@@
@@-.@@
@@+..@@
@%- #@
@*. +@
@*. :@@
@laymonage
laymonage / check_template_override.py
Last active January 9, 2025 17:04
Check if a Django template has been overridden.
from functools import lru_cache
from pathlib import Path
from django.template import TemplateDoesNotExist
from django.template.loader import select_template
@lru_cache
def check_template_override(template_name, expected_location, base_path=None):
"""
@laymonage
laymonage / checksSummary.graphql
Created November 8, 2024 21:10
GitHub checks summary
query {
repository(owner: "django", name: "django") {
pullRequest(number: 18780) {
statusCheckRollup {
state
contexts(first: 100) {
totalCount
checkRunCountsByState {
count
state
@laymonage
laymonage / django-gsoc.md
Last active October 5, 2024 16:46
Django GSoC History

Django GSoC history

2006 (as Django)

  • Merquery - Text Indexing & Search Engine Abstraction Layer for Python by Brian Beck, mentored by Jacob Kaplan-Moss
  • Schema Evolution by Derek Anderson, mentored by Kenneth Gonsalves
  • Per Object Permissions by Christopher A. Long, mentored by Ian Holsman
@laymonage
laymonage / blocks.py
Created July 24, 2024 10:07
Wagtail upload-only document chooser
from .views import upload_only_document_chooser_viewset
UploadOnlyDocumentChooserBlock = upload_only_document_chooser_viewset.get_block_class(
name="UploadOnlyDocumentChooserBlock", module_path="myapp.blocks"
)
@laymonage
laymonage / Giscus.tsx
Last active July 4, 2021 16:11
giscus React component, install https://www.npmjs.com/package/iframe-resizer-react first
import { useEffect, useState } from 'react';
import IframeResizer from 'iframe-resizer-react';
const GISCUS_SESSION_KEY = 'giscus-session';
const GISCUS_ORIGIN = 'https://giscus.app';
const ERROR_SUGGESTION = `Please consider reporting this error at https://github.com/laymonage/giscus/issues/new.`;
function formatError(message: string) {
return `[giscus] An error occurred. Error message: "${message}".`;
}
@laymonage
laymonage / 01_create_user.sql
Created July 4, 2020 09:25
Oracle Database Docker image Django test setup
CREATE USER django IDENTIFIED BY django;
GRANT DBA TO django;
QUIT
@laymonage
laymonage / 01_create_user.sql
Last active July 4, 2020 09:04
Oracle Database Docker image Django test setup
CREATE USER django IDENTIFIED BY django;
GRANT DBA TO django;
QUIT
@laymonage
laymonage / LessWith6Factors.java
Last active June 19, 2020 10:46
Pintu Engineering Logic Test #3
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
public class LessWith6Factors {
private static int pRow;
private static int pCol;