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
#!/bin/bash | |
set -o errexit | |
# Author: David Underhill | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
if [ $# -eq 0 ]; then | |
exit 0 |
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
name: Publish docs to Netlify | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Deploy docs | |
runs-on: ubuntu-latest |
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
<?php | |
//Quotes: Replace smart double quotes with straight double quotes. | |
//ANSI version for use with 8-bit regex engines and the Windows code page 1252. | |
preg_replace('[\x84\x93\x94]', '"', $text); | |
//Quotes: Replace smart double quotes with straight double quotes. | |
//Unicode version for use with Unicode regex engines. | |
preg_replace('[\u201C\u201D\u201E\u201F\u2033\u2036]', '"', $text); |
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
# myapp/management/commands/fix_alias_page_first_last_published.py | |
from django.core.management.base import BaseCommand | |
from django.db.models import Q | |
from wagtail.core.models import Page | |
class Command(BaseCommand): | |
def handle(self, **options): |
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
<?php | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
* | |
* Move your field or group of fields to the node form options vertical tabs. | |
*/ | |
function mymodule_form_node_form_alter(&$form, FormState $form_state, $form_id) { | |
$form['mygroup'] = [ |
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
from wagtail.search.backends.elasticsearch7 import ( | |
Elasticsearch7Mapping, | |
Elasticsearch7SearchBackend, | |
Elasticsearch7SearchQueryCompiler, | |
Elasticsearch7SearchResults, | |
) | |
from .index import RootFilterField | |
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
[tool.black] | |
line-length = 120 | |
target-version = ['py38'] | |
exclude = ''' | |
( | |
/( | |
\.eggs # exclude a few common directories in the | |
| \.git # root of the project | |
| \.mypy_cache | |
| \.tox |
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
/** | |
* Sets up routes and 404 any that match the 404 map | |
* @param {Request} request | |
*/ | |
async function handleRequest(request) { | |
let requestURL = new URL(request.url) | |
let path = requestURL.pathname | |
if (should404(path)) { | |
return new Response('Sorry, not found', { | |
status: 404 |
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
addEventListener("fetch", event => { | |
event.respondWith(fetchAndReplace(event.request)) | |
}) | |
async function fetchAndReplace(request) { | |
let modifiedHeaders = new Headers() | |
modifiedHeaders.set('Content-Type', 'text/html') | |
modifiedHeaders.append('Pragma', 'no-cache') |
NewerOlder