View poetry-1.1.4.rb
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
class Poetry < Formula | |
include Language::Python::Virtualenv | |
desc "Python package management tool" | |
homepage "https://python-poetry.org/" | |
url "https://files.pythonhosted.org/packages/e0/c8/09e126761651e291ab54db1b1d6983c64a1cf67b8b25ce9c806db23e16ab/poetry-1.1.15.tar.gz" | |
sha256 "a373848fd205f31b2f6bee6b87a201ea1e09ca573a2f40d0991539f564cedffd" | |
license "MIT" | |
head "https://github.com/python-poetry/poetry.git", branch: "master" |
View git-push.zsh
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
gp() { | |
current_branch=$(git rev-parse --abbrev-ref HEAD) | |
if echo "$current_branch" | grep -qE '^(master|main|devel)$'; then | |
read "answer?You're about to push to a MAIN branch, are you sure? [y/N] " | |
if ! echo "$answer" | grep -qE '^y'; then | |
echo "aborting..." | |
return | |
fi | |
fi | |
git push origin HEAD |
View kubernetes_pod_status_from_spec.rb
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
def pod_status_from_spec(spec) | |
# translated from: https://github.com/kubernetes/kubernetes/blob/a9f6b93b62a98598913180c640ab044c85a6718b/pkg/printers/internalversion/printers.go#L695-L781 | |
# related issue: https://github.com/kubernetes/kubernetes/issues/22839 | |
metadata = spec.fetch("metadata") | |
pod_status = spec.fetch("status") | |
reason = pod_status.fetch("phase") | |
restarts = 0 | |
if pod_status["reason"] | |
# unsure about this, the go code is opaque |
View form4.py
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
class PirateForm(ModelForm): | |
class Meta: | |
model = Pirate | |
fields = ("name", "is_captain") | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self.cleanup_missing_keys(kwargs.get("data")) | |
def cleanup_missing_keys(self, data): |
View form3.html
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
{% if user.name == "Alice" %} | |
<input type=hidden name=is_captain value=false> | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> | |
{% else %} | |
{{ object.is_captain|yesno:"Yes,No" }} <i>(must be admin to edit)</i> | |
{% endif %} |
View form_condition.html
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
... | |
{% if form.can_edit_captain_field() %} | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> | |
{% else %} | |
... |
View form_with_comment.html
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
{# Keep this condition in sync with PirateForm #} | |
{% if user.name == "Alice" %} | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> | |
{% else %} |
View form1.html
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
<p> | |
{{ form.name.errors }} | |
<label for=id_name>Name:</label> | |
{{ form.name }} | |
</p> | |
<p> | |
{{ form.is_captain.errors }} | |
<label for=id_is_captain>Is Captain?:</label> | |
{% if user.name == "Alice" %} | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> |
View form0.html
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
<p> | |
{{ form.name.errors }} | |
<label for=id_name>Name:</label> | |
{{ form.name }} | |
</p> | |
<p> | |
{{ form.is_captain.errors }} | |
<label for=id_is_captain>Is Captain?:</label> | |
{% if user %} | |
<input type=checkbox name=is_captain id=id_is_captain {% if object.is_captain %}checked{% endif %}> |
View form0.py
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
class PirateForm(ModelForm): | |
class Meta: | |
model = Pirate | |
fields = ("name", "is_captain") | |
def __init__(self, *args, **kwargs): | |
user = kwargs.pop("user", None) | |
super().__init__(*args, **kwargs) | |
if not user: |
NewerOlder