Skip to content

Instantly share code, notes, and snippets.

View ajvillegas's full-sized avatar

Alexis J. Villegas ajvillegas

View GitHub Profile
@lizheming
lizheming / svg-allowed-tags.json
Created June 29, 2019 08:09
SVG allowed tags
[
"br",
"div",
"span",
"font",
"b",
"a",
"altglyph",
"altglyphdef",
"altglyphitem",
@pbearne
pbearne / block.js
Last active March 15, 2024 11:42
code to force server-side Gutenberg block to reload on a change to a Tax
/**
* BLOCK: serverside block that changes on page tax
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './editor.scss';
import './style.scss';
@cferdinandi
cferdinandi / middle-man.js
Last active July 17, 2021 15:29
A middleman API boilerplate for Cloudflare Workers. https://workers.cloudflare.com/
addEventListener('fetch', function (event) {
event.respondWith(handleRequest(event.request));
});
// Allowed domain origins
var allowed = ['http://localhost:8000', 'https://your-website.com'];
/**
* Respond to the request
* @param {Request} request
@lennardv2
lennardv2 / 1. Building PHP-MAMP on Apple Silicon M1.md
Last active February 25, 2025 15:28
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

Update! This tutorial is outdated. Nowadays brew installes m1 binaries just fine. Also use valet: https://laravel.com/docs/9.x/valet. It's 10x easier.

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
@kadamwhite
kadamwhite / annotate-page
Last active March 31, 2026 17:30
Bookmarklet: Annotate or circle things on the webpage
javascript:(function()%7B%2F**%0A%20*%20Annotate%20a%20page%20with%20writeable%20labels.%0A%20*%0A%20*%20Script%20variant%20that%20doesn't%20reposition%20the%20circle%20(which%20is%20a%20rounded%0A%20*%20rectangle%20this%20time)%20when%20you%20release%20the%20mouse.%0A%20*%0A%20*%20This%20version%20(copy%20the%20bookmarklet%20code%20from%20the%20file%20above)%20will%20add%0A%20*%20a%20label%20field%20to%20each%20annotation%2C%20and%20you%20can%20right-click%20an%20annotation%0A%20*%20to%20remove%20it.%0A%20*%2F%0A(()%20%3D%3E%20%7B%0A%20%20%20%20const%20id%20%3D%20'bookmarklet-annotate'%3B%0A%20%20%20%20const%20blanket%20%3D%20document.getElementById(%20id%20)%20%7C%7C%20document.createElement('div')%3B%0A%20%20%20%20if%20(%20blanket.id%20%3D%3D%3D%20id%20)%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20Already%20in%20annotate%20mode%3A%20Remove%20blanket%20to%20exit%20annotate%20mode.%0A%20%20%20%20%20%20%20%20blanket.remove()%3B%0A%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%7D%0A%20%20%20%20%2F%2F%20Otherwis