Skip to content

Instantly share code, notes, and snippets.

@smigniot
smigniot / matrix.js
Created February 28, 2023 21:40
A Matrix rain effect
function _(tagname, attributes) {
var result = null;
if(attributes && attributes.xmlns) {
result = document.createElementNS(attributes.xmlns, tagname);
} else {
result = document.createElement(tagname || "div");
}
if(attributes) {
Object.keys(attributes).forEach(function(name) {
if("xmlns" == name) return;

Table of Contents WordPress Plugin

This WordPress plugin creates a table of contents based on the heading structure. It automatically adds anchor links for every heading.

Usage

Use the f1_toc() function to render the table of contents with markup. An optional paramater called limit can be used to only show headings up to a certain level. Example:

// Only show <H1> and <H2> headings in the table of contents
@mdonkers
mdonkers / server.py
Last active April 4, 2025 13:11
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@peksi
peksi / menu.twig
Last active February 8, 2021 10:51
Bootstrap dropdown navbar implementation for Wordpress Timber plugin.
{# Bootstrap dropdown navbar for Wordpress #}
<ul class="nav navbar-nav">
{% for item in menu %}
{% if (item.get_children) %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{item.title}} <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for subitem in item.get_children %}