Skip to content

Instantly share code, notes, and snippets.

View krzysztofjeziorny's full-sized avatar

Krzysztof Jeziorny krzysztofjeziorny

View GitHub Profile

1. Download your Twitter archive

You can find this feature in Settings > Download Twitter Archive. It might take 24 hours to receive. Unzip the file and open the data folder in your terminal:

cd ~/Downloads/twitter-archive-zip-you-downloaded/data

(I have seen reports that this function may no longer be working, so this guide is mostly useful to those who were lucky enough to already have downloaded their archive.)

<form hx-post="/example" hx-ext="disable-submit">
  <button type="submit" class="hx-disable button-default">Save</button>
</form>
htmx.defineExtension('disable-submit', {
  onEvent: function (name, evt, data) {
 let elt = evt.detail.elt;
@davemerwin
davemerwin / DJANGO-HTMX Class Based View Request Grab to Change Templates
Last active June 15, 2024 18:07
An example of a Class Based View using django-htmx to determine what template to return
class AddImage(LoginRequiredMixin, CreateView):
"""
adds a image
"""
form_class = ImageForm
model = Image
def get_template_names(self):
if self.request.htmx:
@kongondo
kongondo / UpdateProcessWireFrontendContentUsingHtmxDemo.js
Last active February 13, 2025 11:07
Using htmx to Refresh ProcessWire Frontend Content
const UpdateProcessWireFrontendContentUsingHtmxDemo = {
initHTMXXRequestedWithXMLHttpRequest: function () {
document.body.addEventListener("htmx:configRequest", (event) => {
// @note: ADD THIS!!! if not using hx-include='token input'
// const csrf_token = UpdateProcessWireFrontendContentUsingHtmxDemo.getCSRFToken()
// event.detail.headers[csrf_token.name] = csrf_token.value
// add XMLHttpRequest to header to work with $config->ajax
event.detail.headers["X-Requested-With"] = "XMLHttpRequest"
})
},
@Andy-set-studio
Andy-set-studio / _vertically-align-label.scss
Last active September 8, 2021 01:30
Adds a pseudo-element to help vertically align text labels in buttons/block-like links without using magic numbers https://ishadeed.com/article/button-label-alignment/
/// VERTICALLY ALIGN LABEL
/// Adds a pseudo-element to help vertically align
/// text labels in buttons/block-like links without
/// using magic numbers
/// More: https://ishadeed.com/article/button-label-alignment/
@mixin vertically-align-label() {
&::before {
content: '';
display: inline-block;
vertical-align: middle;
@kristinriebe
kristinriebe / _wagtail-custom-document-urls.txt
Last active December 2, 2023 17:01
Wagtail - use a custom url (document slug) to serve documents via a custom serve_view
# I prefer to serve documents using a document slug (derived from the title of the document)
# instead of using the filename, especially since filenames can become quite ugly (appended random strings).
# E.g. a file named 'campus_map.pdf' with titel 'Campus Map' may be uploaded as 'campus_map_asRfsgt.pdf'
# by Wagtail and is then served as e.g. '/documents/24/campus_map_asRfsgt.pdf' (if WAGTAILDOCS_SERVE_METHOD = 'serve_view').
# However, it would look much nicer, if it was served as '/documents/24/campus_map/', which could
# also be a more persistent document url, i.e. it would not change if the document object was changed by
# replacing the file with a new version (e.g. 'campus_map_v2.pdf').
# I could also shorten the URL to '/documents/campus_map/', omitting the id. However, lookups by id are
# much faster and we would need to ensure that these urls are unique.
@davecoutts
davecoutts / unifi_ubuntu_2004.sh
Last active April 3, 2025 03:41
Install Ubiquiti Unifi Controller on Ubuntu 20.04
# Install Ubiquiti Unifi Controller on Ubuntu 20.04.
# As tested on a fresh install of ubuntu-20.04.1-live-server, August 22nd 2020.
# Thanks to https://gist.github.com/tmuncks for posting the updated install steps.
sudo apt update
sudo apt install --yes apt-transport-https
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
@la-mar
la-mar / toml.py
Created April 25, 2020 16:18
Extract project name, version number, and other metadata from a pyproject.toml file in the project root directory
import os
from typing import Dict, Optional
import tomlkit
def _get_project_meta(pyproj_path: str = "./pyproject.toml") -> Dict[str, str]:
if os.path.exists(pyproj_path):
with open(pyproj_path, "r") as pyproject:
file_contents = pyproject.read()
@achhunna
achhunna / Svg-icon.vue
Last active January 29, 2025 15:16
Import svg inline and modify element to create icon
<script>
function recursivelyRemoveFill(el) {
if (!el) {
return;
}
el.removeAttribute('fill');
[].forEach.call(el.children, child => {
recursivelyRemoveFill(child);
});
}
@pySilver
pySilver / admin.scss
Last active November 15, 2023 09:39
Integrates wagtail + wagtailmodeladmin + django-filter + django-autocomplete-light
/*
* ===================================================
* django-filter
* ===================================================
*/
.filter-form-header {
padding: 0;
h2 {
background-color: #fafafa;