Skip to content

Instantly share code, notes, and snippets.

View softquantum's full-sized avatar

Maxime softquantum

View GitHub Profile
@softquantum
softquantum / breadcrumbs.html
Created June 24, 2024 02:17
Django Breadcrumb template
{% load wagtailcore_tags %}
{% if ancestors %}
<nav class=" bg-gray-50" aria-label="Breadcrumb">
<div class="sq-container">
<ol role="list" class="flex items-center space-x-1 p-2 ">
{% for ancestor in ancestors %}
{% if forloop.first %}
<li>
<a href="{% pageurl ancestor %}" class="text-gray-400 hover:text-gray-500">
<!-- Heroicon name: mini/home -->
@softquantum
softquantum / navigation_tags.py
Created June 24, 2024 02:16
Django Template Tag for Breadcrumbs
@register.inclusion_tag("tags/breadcrumbs.html", takes_context=True)
def breadcrumbs(context):
self = context.get("self")
if self is None or self.depth <= 2:
# When on the home page, displaying breadcrumbs is irrelevant.
ancestors = ()
else:
ancestors = Page.objects.ancestor_of(self, inclusive=True).filter(depth__gt=1, locale=Locale.get_active())
return {
"ancestors": ancestors,
@softquantum
softquantum / topmenu.html
Created June 10, 2024 01:28
Top menu item for Pelican with menu items with title, link and children.
<div class="max-w-7xl mx-auto p-4">
<nav class="flex justify-between items-center">
<a class="inline-flex items-center no-underline" href="{{ SITEURL }}/">
<img class="h-6 sm:h-8 lg:h-12"
src="/theme/img/branding/sq-logo.svg"
alt="logo"/>
<p class="font-black sm:text-xl lg:text-3xl ml-3 leading-none">{{ SITENAME }}</p>
</a>
<div class="flex items-center">
{% for title, link, children in MENUITEMS %}
@softquantum
softquantum / MeiliSearch.md
Created November 6, 2023 01:32 — forked from eliyas5044/MeiliSearch.md
MeiliSearch installation and configuration.

Taken from: http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/

Setting up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL

[Django][1] is an efficient, versatile and dynamically evolving web application development framework. When Django initially gained popularity, the recommended setup for running Django applications was based around Apache with mod_wsgi. The art of running Django advanced and these days the recommended configuration is more efficient and resilient, but also more complex and includes such tools as: Nginx, Gunicorn, virtualenv, supervisord and PostgreSQL.

In this text I will explain how to combine all of these components into a Django server running on Linux.

JQL Syntax for the Impatient

There are a few JQL syntax bits to get you started:

  • AND --- allows you to add qualifiers to a list
  • != Thing --- target one thing
  • is in (List, Of, Things) --- target a bunch of things (Done, Closed, Resolved) typically
  • not in (List, of, Things) --- do not include a bunch of things
  • -1w --- relative time. You can also use -1d for day
  • "2015/3/15" --- specific dates
@softquantum
softquantum / gist:97cd60757a5ac77643a7c8336dd442c1
Created February 4, 2023 13:55 — forked from seLain/gist:8bdf12c7196f3fccafdf067dec2696b2
Fix the thing GitHub keeps saying “This branch is X commits ahead, Y commits behind”
ref stackoverflow:
https://stackoverflow.com/questions/41283955/github-keeps-saying-this-branch-is-x-commits-ahead-y-commits-behind
works by
1. git remote add upstream https://github/upstream/repo.git
2. git pull --rebase upstream master
2.1 git rebase --skip (if the conflicts are not true, skip the patches)
3. git push --force-with-lease origin master
If there are branches to fix
@softquantum
softquantum / iTerm2.md
Created December 12, 2022 07:35 — forked from soifou/iTerm2.md
iTerm2 Shortcuts

iTerm2 Shortcuts

Tab navigation

  • open new tab: Cmd + t
  • next tab: Cmd + Shift + ]
  • previous tab: Cmd + Shift + [

Pane navigation

@softquantum
softquantum / example-azure-pipeline.yml
Created July 21, 2021 03:23 — forked from killertilapia/example-azure-pipeline.yml
An example Azure YML script for running django tests in an Azure pipeline.
trigger:
batch: true
branches:
include:
- develop
jobs:
- job: 'run_tests'
pool:
vmImage: 'Ubuntu-20.04'
@softquantum
softquantum / cmsContentType_Usage.sql
Created March 11, 2018 11:08 — forked from leekelleher/cmsContentType_Usage.sql
Umbraco - database analysis - SQL Queries
-- Copied from Hendy https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/72814-creating-a-list-of-unused-doc-types#comment-233729
-- Find all unused docTypes
-- These results may contain docTypes that are masters of used ones, so need to exclude these too...
SELECT
A.nodeId as 'DocTypeId',
B.text AS 'Name',
A.alias AS 'Alias'
FROM
cmsContentType A LEFT JOIN