Skip to content

Instantly share code, notes, and snippets.

View JackAtOmenApps's full-sized avatar
💭
Happily typing away

Jack at Omen Apps JackAtOmenApps

💭
Happily typing away
View GitHub Profile
@JackAtOmenApps
JackAtOmenApps / multilayer_layout.py
Created January 8, 2024 20:53 — forked from cvanelteren/multilayer_layout.py
Flat multilayer layout networkx
import proplot as plt, cmasher as cmr, pandas as pd, numpy as np, os, sys, networkx as nx, warnings
def multilayer_layout(
G: nx.Graph,
subset_key="layer",
layout=nx.spring_layout,
separation: float = 10.0,
) -> dict:
# set positions
@JackAtOmenApps
JackAtOmenApps / geopackage_whole_project.py
Created June 6, 2021 03:26 — forked from danzig666/geopackage_whole_project.py
Save whole QGIS project to geopackage
# input: all layers
# save path: save_layerpath project property / current project majority path
# replaces all postgis datasources with gpkg!
##########################
from qgis.utils import iface
from qgis.core import *
from qgis.PyQt.QtWidgets import *
from PyQt5.QtCore import *
from processing.tools import dataobjects
@JackAtOmenApps
JackAtOmenApps / models.py
Created April 24, 2021 18:38
Django and HTMX Preferences Example
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
class MyUser(AbstractBaseUser):
receive_email_messages = models.BooleanField(
_("Receive Email Messages"),
default=False,
@JackAtOmenApps
JackAtOmenApps / django_choices.txt
Last active November 28, 2023 15:19
Example of the new django 3.0 TextChoices enumeration types
from django.db import models
class Animal(models.Model):
class AnimalType(models.TextChoices):
ANTELOPE = 'A', 'Antelope'
BAT = 'B', 'Bat'
COUGAR = 'C', 'Cougar'
animal_type = models.CharField(max_length=1, choices=AnimalType.choices, default=AnimalType.ANTELOPE)
@JackAtOmenApps
JackAtOmenApps / django_projects.csv
Created October 17, 2019 00:05
Django Projects
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
name,html_url,Description,Days since last push,"Repo age
In years","Views
Total",FBVs,CBVs,Models,Stars,Forks,Commits
addons-server,https://github.com/mozilla/addons-server,🕶 addons.mozilla.org Django app and API 🎉,2,5,181,151,30,89,597,405,44690
cfgov-refresh,https://github.com/cfpb/cfgov-refresh,Django project protecting American consumers,2,5,44,24,20,108,118,80,17453
pootle,https://github.com/translate/pootle,Online translation tool,183,7,91,40,51,36,1212,269,16308
horizon,https://github.com/openstack/horizon,OpenStack Dashboard (Horizon),2,7,754,400,354,0,1118,1141,15353
geonode,https://github.com/GeoNode/geonode,"GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.",2,9,164,130,34,58,803,740,14096
hydroshare,https://github.com/hydroshare/hydroshare,HydroShare is a collaborative website for better access to data and models in the hydrologic sciences. ,3,5,180,137,43,198,91,20,12062
onadata,https://github.com/onaio/onadata,"Collect, Analyze a
@JackAtOmenApps
JackAtOmenApps / article_confirm_delete.html
Last active September 1, 2022 15:25
This is a super basic example of using django-summernote to create a knowledgebase app in django (Make sure to pip install django-summernote)
{% extends "base.html" %}
{% load static %}
{% block title %}{% block head_title %}Knowledgebase - Delete {{ article.name }}{% endblock head_title %}{% endblock title %}
{% block content %}
<div class="container-fluid">
<div class="row ml-1 mr-1">
<div class="col-md-12">