Skip to content

Instantly share code, notes, and snippets.

View natoinet's full-sized avatar

@ntoinet natoinet

View GitHub Profile
@marco-s
marco-s / ms-remove-empty-menu-link.php
Last active June 22, 2023 14:25
WordPress menu: remove href link for "empty" menu items
@cassus
cassus / admin.py
Last active September 28, 2022 18:15
Django admin action as row button
class MyAdmin(admin.ModelAdmin):
list_display = (..., 'actions_html')
def actions_html(self, obj):
return format_html('<button class="btn" type="button" onclick="activate_and_send_email({pk})">Activate and send email</button>', pk=obj.pk)
actions_html.allow_tags = True
actions_html.short_description = "Actions"
<?php
/**
* Plugin Name: NGINX FastCGI cache purge
* Version: 0.1
* Description: Flush NGINX FastCGI cache purge
* Author: The Shipyard Crew
* Author URI: https://theshipyard.se/
* Plugin URI: https://theshipyard.se/
* Text Domain: nginx-fastcgi-cache-purge
@subfuzion
subfuzion / curl.md
Last active June 12, 2024 20:17
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@jordifebrer
jordifebrer / oauth2.md
Last active October 24, 2023 07:59
Simplified OAuth 2 workflow for dummies (me!)

Simplified OAuth 2 workflow for dummies (me!)

User case

A user wants profile data from an app.

Workflow

  1. User makes a request to a client (website, mobile app, etc).
  2. Client (may) redirect the user to auth server login form.
  3. User logs into the auth server.
  4. Auth server validates previous credentials and returns an access token to the client.
@ashblue
ashblue / docker-compose.mongo.yml
Created January 6, 2018 23:31
Docker Compose example for MongoDB databases. Includes named volume support.
version: '3'
services:
mongodb:
image: mongo:3.6.1
container_name: uv-mongodb
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
ports:
- 27017:27017
@westonruter
westonruter / amp-google-tag-manager.php
Last active November 18, 2022 20:15
Plugin demonstrating how to inject GTM for the AMP plugin, in response to support forum topic: https://wordpress.org/support/topic/amp-with-google-tag-manager/
<?php
/**
* Plugin Name: AMP Google Tag Manager
*
* @package AMP_Google_Tag_Manager
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
* @wordpress-plugin