An interactive multi-line chart.
Note, I borrowed a bit of code from Duopixel's excellent code sample here.
Upgraded to D3v5.
{% macro field_label(field) -%} | |
<label class="form-label" for="{{ field.id }}"> | |
{{ field.label.text }} {% if field.flags.required %}*{% endif %} | |
</label> | |
{%- endmacro %} | |
{% macro field(field, group_class=None, space_field_class="") -%} | |
<div class="form-group{% if group_class %} {{ group_class}}{% endif %}"> | |
{{ field_label(field) }} | |
{% if field.errors %} |
.git | |
__pycache__ | |
app/static |
# Doesn't work anymore | |
docker run -it —-rm —-privileged multiarch/qemu-user-static —-credential yes —-persistent yes | |
docker run -it —-rm s390x/ubuntu bash | |
# works | |
sudo pacman -S qemu qemu-extras | |
curl -O https://people.debian.org/~aurel32/qemu/powerpc/debian_wheezy_powerpc_standard.qcow2 | |
qemu-system-ppc -hda debian_wheezy_powerpc_standard.qcow2 |
An interactive multi-line chart.
Note, I borrowed a bit of code from Duopixel's excellent code sample here.
Upgraded to D3v5.
"""Maps a request to a tenant using the first part of the hostname. | |
For example: | |
foo.example.com:8000 -> foo | |
bar.baz.example.com -> bar | |
This is a simple example; you should probably verify tenant names | |
are valid against a whitelist before returning them, since the returned | |
tenant name will be issued in a `SET search_path TO` SQL query. |
class IssueAdminForm(forms.ModelForm): | |
class Meta: | |
model = app_models.Issue | |
fields = ['title', 'labels'] | |
widgets = { | |
'labels': app_forms.ArrayFieldSelectMultiple( | |
choices=app_models.Issue.LABEL_CHOICES), | |
} | |
class IssueAdmin(admin.ModelAdmin): |
from django.utils.datastructures import MultiValueDict | |
class ArrayFieldSelectMultiple(forms.SelectMultiple): | |
"""This is a Form Widget for use with a Postgres ArrayField. It implements | |
a multi-select interface that can be given a set of `choices`. | |
You can provide a `delimiter` keyword argument to specify the delimeter used. | |
""" | |
def __init__(self, *args, **kwargs): | |
# Accept a `delimiter` argument, and grab it (defaulting to a comma) |
class Issue(models.Model): | |
LABEL_CHOICES = ( | |
('bug', "Bug"), | |
('feature', "Feature"), | |
('blocker', "Release blocker"), | |
) | |
title = models.CharField(max_length=256) | |
labels = ArrayField( | |
models.CharField(max_length=32, choices=LABEL_CHOICES), | |
default=[], blank=True) |
class Issue(models.Model): | |
title = models.CharField(max_length=256) | |
class Label(models.Model): | |
issue = models.ForeignKey(Issue, related_name='labels') | |
NAME_CHOICES = ( | |
('bug', "Bug"), | |
('feature', "Feature"), | |
('blocker', "Release blocker"), | |
) |
(defun rename-this-buffer-and-file () | |
"Renames current buffer and file it is visiting." | |
(interactive) | |
(let ((name (buffer-name)) | |
(filename (buffer-file-name))) | |
(if (not (and filename (file-exists-p filename))) | |
(error "Buffer '%s' is not visiting a file!" name) | |
(let ((new-name (read-file-name "New name: " filename))) | |
(cond ((get-buffer new-name) | |
(error "A buffer named '%s' already exists!" new-name)) |