Skip to content

Instantly share code, notes, and snippets.

@DahmaniAdame
DahmaniAdame / css.css
Last active June 20, 2024 09:15
External CSS
h2 {
color: red!important;
}
@DahmaniAdame
DahmaniAdame / async-defer-module.md
Created May 21, 2024 20:22 — forked from jakub-g/async-defer-module.md
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@DahmaniAdame
DahmaniAdame / creame-optimize.php
Created February 11, 2024 17:01 — forked from pacotole/creame-optimize.php
WordPress must-use plugin with site optimizations
<?php
/*
Plugin Name: Creame Optimize
Plugin URI: https://crea.me/
Description: Optimizaciones de Creame para mejorar tu <em>site</em>.
Version: 2.1.4
Author: Creame
Author URI: https://crea.me/
License: MIT License
*/

%%tana%%

  • Cheat Sheet
    • ✨ Tana Expressions
      • Title #tana-expression
        • Description:: A title expression composes values from the node into a title.
        • Attributes:: Search for Tana "Title" Attributes
      • Search #tana-expression
        • Description:: The search expression consists of a flat list of match-clauses that must be true for a node to match the search.
        • Attributes:: Search for Search Attributes + Search for Search Field Values
  • 🧩 Tana Attributes
@DahmaniAdame
DahmaniAdame / medium.user.js
Created December 13, 2023 04:25 — forked from mathix420/medium.user.js
Bypass Medium Paywall - Working late 2023 - Greasy Fork, Violentmonkey, Tampermonkey
// ==UserScript==
// @name Medium Paywall Bypass
// @namespace Violentmonkey Scripts
// @run-at document-start
// @match *://*.medium.com/*
// @match *://medium.com/*
// @match *://*/*
// @grant none
// @version 1.3
// @updateURL https://gist.githubusercontent.com/mathix420/e0604ab0e916622972372711d2829555/raw/medium.user.js
@DahmaniAdame
DahmaniAdame / googleSheetsEndpoint.js
Created July 15, 2023 07:53 — forked from thisbit/googleSheetsEndpoint.js
Google Sheets as JSON, use this with Extensions > App Script in google sheets
function getSheetDataAsJSON() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getDataRange();
var values = range.getValues();
var headers = values[0];
var jsonData = [];
for (var i = 1; i < values.length; i++) {
var row = values[i];
var rowObj = {};
@DahmaniAdame
DahmaniAdame / cf_wp_worker.js
Created May 13, 2023 10:00 — forked from markomitranic/cf_wp_worker.js
CloudFlare edge worker for WP
// IMPORTANT: Either A Key/Value Namespace must be bound to this worker script
// using the variable name EDGE_CACHE. or the API parameters below should be
// configured. KV is recommended if possible since it can purge just the HTML
// instead of the full cache.
// API settings if KV isn't being used
const CLOUDFLARE_API = {
email: "", // From https://dash.cloudflare.com/profile
key: "", // Global API Key from https://dash.cloudflare.com/profile
zone: "" // "Zone ID" from the API section of the dashboard overview page https://dash.cloudflare.com/
for wpconfig in /var/www/*/wp-config.php; do \
echo; site=${wpconfig%\/wp-config.php}; site=${site#\/var\/www\/}; \
gp wp $site doctor check --all
echo
done
@DahmaniAdame
DahmaniAdame / r-debug.php
Created November 6, 2022 20:28 — forked from Rarst/r-debug.php
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@DahmaniAdame
DahmaniAdame / debug-hook-sequence.php
Created November 6, 2022 18:32 — forked from maheshwaghmare/debug-hook-sequence.php
Debug hook sequence in WordPress.
<?php
/**
* Debug WordPress hook sequence.
*
* > How it works?
* Add query parameter `debug` in URL e.g. https://<mysite>/?debug
* It'll show the list of Actions in sequence.
*
* @todo Change `prefix_` with your own prefix.
*