Skip to content

Instantly share code, notes, and snippets.

View krzysztofjeziorny's full-sized avatar

Krzysztof Jeziorny krzysztofjeziorny

View GitHub Profile
// Take a parameter from the URL ie. /?myparam=value
created() {
let uri = window.location.search.substring(1)
let params = new URLSearchParams(uri)
if (params.get("myparam") !== null) {
console.log(`My URL parameter: ` + params.get("myparam"))
this.something = params.get("myparam")
this.myFunction()
}
}
// https://nickymeuleman.netlify.app/blog/css-animated-wrapping-underline
// https://codepen.io/jh3y/pen/gOPjBPM
:root {
--underline-width: 5px;
--underline-block-width: 2rem;
--underline-color: hsla(7, 72%, 49%, 0.363);
--underline-color-hover: transparent;
--underline-transition-in: 0.75;
--underline-transition-out: 0.5;
@krzysztofjeziorny
krzysztofjeziorny / forms.py
Last active September 9, 2020 18:57
custom django form widgets (toggle)
# forms.py
from django import forms
from . import widgets
class CustomWidgetForm(forms.Form):
working = forms.BooleanField(
required=False,
widget=widgets.ToggleWidget(
@krzysztofjeziorny
krzysztofjeziorny / accordion_block.html
Created May 23, 2021 10:54
Wagtail CMS StreamField collapsing block with Bootstrap accordion
{% load wagtailcore_tags %}
<div id="accordion-{{ forloop.counter }}" role="tablist" aria-multiselectable="false" class="card-collapse">
{% for block in self %}
<div class="card card-plain">
<div class="card-header" role="tab" id="heading-{{ forloop.counter }}">
<a data-toggle="collapse" data-parent="#accordion-{{ forloop.parentloop.counter }}" href="#collapse-{{ forloop.parentloop.counter }}-{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse-{{ forloop.parentloop.counter }}-{{ forloop.counter }}">
{% include_block block.value.question %}
<i class="fa fa-chevron-down"></i>
</a>
@krzysztofjeziorny
krzysztofjeziorny / _icons.scss
Last active October 23, 2022 17:27
gulp workflow for building SVG sprites; bonus: placing symbols in a Django template with a custom tag
.icon {
display: inline-block;
vertical-align: middle;
width: 1rem;
height: 1rem;
stroke: currentcolor;
fill: none;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
@krzysztofjeziorny
krzysztofjeziorny / base.html
Last active December 5, 2023 16:51
Wagtail URL 'shortener' redirecting from /item/id to the page's address
<!-- add to <head> to prevent duplicate content issues in search engine optimization -->
<link rel="canonical" href="{{ page.full_url }}">