Skip to content

Instantly share code, notes, and snippets.

@danjac
danjac / init.vim
Created May 13, 2020 13:46
nvim/vim config
syntax on
filetype plugin indent on
set nocompatible
set encoding=utf-8
set fileencodings=utf-8
" prevent shada loading
" set shada="NONE"
# We assume 2 top level dirs for backend (Django app) and frontend (VueJS app).
# This is for a development setup NOT PRODUCTION-SAFE
# Django app uses django-configurations
# Environment variables are stored locally in .env file (IGNORE IN REPO)
#### docker-compose.yml ####
version: '3.4'
x-env:
import re
CASE_RE = r'^Case-(?P<case_id>\d+)'
MERGE_RE = r'^(merge|merged) (?P<branch_name>[\w-]+)'
def prefix_commit_message(repo, **kwargs):
commitctx = repo.commitctx
"""
@danjac
danjac / docker-compose.yml
Created May 12, 2018 11:22
docker-compose for typical Django+VueJS+PostgreSQL project
version: '2'
services:
db:
image: postgres
redis:
image: redis

Gnome desktop perfect install

  • Adwaita Dark

    • Firefox config: about:config: widget.content.gtk-theme-override: Adwaita:light
  • Firefox

    • set minimal view Addons
from .layout import FormHelper, FormHelperMixin
class MyForm(FormHelperMixin, forms.ModelForm):
class FormHelperMeta:
# works like Meta, we just use to store property overrides
# doesn't need to inherit
# helper_class = MyCustomHelper
submit_text = "Submit!"
action = reverse('account:login')
@danjac
danjac / crispy-form.py
Last active June 23, 2017 16:07
Django crispy form example
from django import forms
from django.contrib.localflavor.gb.forms import GBPostcodeField
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, Submit
from crispy_forms.bootstrap import FormActions
from .models import Signup
input:not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']) {
-moz-appearance: none !important;
background-color: inherit;
color: inherit;
}
#downloads-indicator-counter {
color: white;
}
"""
Breadth-first search maze runner
maze_runner.py path-to-maze-file
Make sure your map has an entrance and exit on left & right side
respectively.
EXAMPLE:
###########
"""
https://en.wikipedia.org/wiki/Breadth-first_search
"""
import queue
def bfs(graph, root):
q = queue.Queue()