Skip to content

Instantly share code, notes, and snippets.

View meduzen's full-sized avatar
🌍
<body> in Belgium, <head> worldwide.

Mehdi meduzen

🌍
<body> in Belgium, <head> worldwide.
View GitHub Profile
const SW_VERSION = '1.2.3' // update it when the app changes: invalidates `resourcesToCache`
const resourcesCacheKey = `cache-v${SW_VERSION}`
const microfrontendCacheKey = `mfe` // not sure versioning is needed
const resourcesToCache = [
'/',
'site.webmanifest',
'css/app.css',
@meduzen
meduzen / list.md
Last active October 8, 2024 16:40
Alternatives to Google Analytics
@meduzen
meduzen / README.md
Last active July 26, 2021 11:00
Get all files path in a PR, excluding the files marked as viewed or deleted
  1. Open your dev tools.
  2. Paste this in the console:
Array
  .from(document.querySelectorAll('.js-file'))
  .filter(el => !('fileUserViewed' in el.dataset) && el.dataset.fileDeleted == 'false')
  .map(el => el.querySelector('.file-header').dataset.path)
@meduzen
meduzen / remove-duplicates-from-array.js
Last active March 10, 2021 16:00
JavaScript Set explained
// Embedded in https://twitter.com/meduzen/status/1369679118992871428
// OMG, lot of duplicated entries!
const stepsNames = [
"step-basic",
"step-basic",
"step-basic",
"step-specification",
"step-specification",
"step-specification",
@meduzen
meduzen / timer.js
Last active November 24, 2023 12:56
Approach for using setInterval / setTimeout in a vue-x store
const MILLISECONDS_PER_MINUTES = 1000 * 60;
const state = {
now: (new Date()),
intervalTimer: null,
};
const mutations = {
now(state) {
state.now = new Date();
@meduzen
meduzen / unregister-service-workers.js
Created July 14, 2020 09:15
Run this in your browser console or in your app to clean all Service Workers.
if('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for(let registration of registrations) {
registration.unregister()
}
})
}
{
"label": "Français",
"keys": {
"answer_no": "Non",
"answer_region_no": "Je ne me suis rendu dans aucune des régions mentionnées ci-dessus",
"answer_unknown": "Je ne sais pas",
"answer_yes": "Oui",
"answers_table_headline": "Vos réponses",
"answers_table_hide_answers": "Cacher les réponses",
"answers_table_print": "Imprimer",
@meduzen
meduzen / laravel-medialibrary-ffmpeg-settings-for-macos-and-ubuntu.md
Created February 17, 2020 10:35
Having FFMpeg working on Ubutu or macOS for Spatie Media Library

Spatie’s Media Library requires FFmpeg in order to create video poster images.

Install FFmpeg

  • sudo apt update;
  • sudo apt install ffmpeg;
  • ffmpeg -version should output FFmpeg version.
@meduzen
meduzen / fosdem-2020-02-01.md
Last active January 31, 2020 22:35
FOSDEM 2020
@meduzen
meduzen / voice-over-ecriture-dite-inclusive.html
Last active June 30, 2024 15:52
Inclusive writing and HTML/CSS, in French.
<!-- « un neu concepteurice », says Voice Over -->
<p>Test 1 : nous recherchons un•e concepteur•rice & rédacteur•rice francophone.</p>
<!-- « une concepteurice », says Voice Over `(content: '•'` is ignored) -->
<p>Test 2 : nous recherchons un<span class="content-middot"></span>e concepteur<span class="content-middot"></span>rice & rédacteur<span class="content-middot"></span>rice francophone.</p>
<!-- `alt is ignored by macOS Voice Over -->
<p>Test 3 : nous recherchons <span alt="un concepteur et rédacteur, ou une conceptrice et rédactrice">un•e concepteur•rice & rédacteur•rice</span> francophone.</p>
<!-- `aria-label` or `aria-labelledby` is ignored by macOS Voice Over -->