Skip to content

Instantly share code, notes, and snippets.

View nhoizey's full-sized avatar
👋

Nicolas Hoizey nhoizey

👋
View GitHub Profile
@nhoizey
nhoizey / README.md
Last active October 8, 2024 12:58
Transform a `title` attribute into `figure`/`ficaption` tags

This is how I create images with caption in my Markdown content used in Eleventy.

This image:

![This is the alt text](path/to/the/image.jpg "This is the **title**")

Becomes this HTML:

This file has been truncated, but you can view the full file.
 …/nicolas-hoizey.photo   v22.5.0   main  23:06  npm run debug:start
> nho-photo@2.0.0 debug:start
> DEBUG=Eleventy* npm start
> nho-photo@2.0.0 start
> cross-env NODE_ENV=development npm-run-all --sequential clean build:js --parallel watch:*
This file has been truncated, but you can view the full file.
 …/nicolas-hoizey.photo   v22.5.0   main  23:06  npm run debug:start
> nho-photo@2.0.0 debug:start
> DEBUG=Eleventy* npm start
> nho-photo@2.0.0 start
> cross-env NODE_ENV=development npm-run-all --sequential clean build:js --parallel watch:*
This file has been truncated, but you can view the full file.
 …/nicolas-hoizey.photo   v22.5.0   main  23:06  npm run debug:start
> nho-photo@2.0.0 debug:start
> DEBUG=Eleventy* npm start
> nho-photo@2.0.0 start
> cross-env NODE_ENV=development npm-run-all --sequential clean build:js --parallel watch:*
/* ***********************************************
Styles for Mastodon
Adapted from different sources
- https://write.as/panais/styles-pour-mastodon-avec-stylus
- https://mastodon.social/@matuzo/109284559864791077
- https://mastodon.social/@matuzo/109284628517006156
- https://gist.github.com/justmarkup/e4f6d52bef604e170815aaf44f459fbc
*********************************************** */
/* Private messages */

Heaviest images on French government sites (.gouv.fr)

Google BigQuery request with HTTP Archive data

Here's the how to.

SELECT
  url,
 ROUND(respBodySize/1024) AS imgWeight,
@nhoizey
nhoizey / README.md
Last active October 28, 2021 09:27
Example data for searching multiple dimensions in Algolia
@nhoizey
nhoizey / flickr-remove-faves-bookmarklet.js
Last active October 3, 2020 21:00
Remove faves from gallery pages
javascript:(function(){((document)=>{document.querySelectorAll('.engagement-item.fave.faved').forEach(row=>{row.closest('.photo-list-gallery-photo-view').remove();});})(window.document);})();
@nhoizey
nhoizey / flickr-faves-views-ratio-bookmarklet.js
Last active May 29, 2020 10:33
Compute faves/views ratio on Flickr stats pages
javascript:(function()%7B((document)%20%3D%3E%20%7Bdocument.querySelectorAll('.row').forEach(row%20%3D%3E%20%7Blet%20views%20%3D%20parseInt(row.querySelector('td%3Anth-child(3)').innerText.replace('%2C'%2C%20'')%2C%2010)%3Blet%20faves%20%3D%20parseInt(row.querySelector('td%3Anth-child(4)').innerText.replace('%2C'%2C%20'')%2C%2010)%3Blet%20ratio%20%3D%20Math.round(10000%20*%20faves%20%2F%20views)%20%2F%20100%3Brow.querySelector('td%3Anth-child(4)').innerText%20%3D%20row.querySelector('td%3Anth-child(4)').innerText%20%2B%20'%20('%20%2B%20ratio%20%2B%20'%20%25)'%3B%7D)%3B%7D)(window.document)%7D)()
@nhoizey
nhoizey / markdown-from-jekyll-to-eleventy.js
Created March 11, 2020 16:48
Node.js script to move Markdown files from previous Jekyll to new Eleventy setup
#!/usr/bin/env node
// Move Markdown files from previous Jekyll to new Eleventy setup
// Jekyll: 2018/06/15-users-do-change-font-size/2018-06-15-users-do-change-font-size.md
// Eleventy: 2018/06/15/users-do-change-font-size/index.md (with date added as YFM)
const fs = require('fs');
const path = require('path');
const insertLine = require('insert-line');