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
@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 / README.md
Last active August 31, 2020 11:17
Replace Nginx server name on Forge + Digital Ocean

Replace Nginx server name

This works on a Digital Ocean’s server managed by Laravel Forge. What this does:

  1. Power off the server by connecting through ssh and running sudo poweroff.
  2. Take a snapshot of the server in the Digital Ocean panel. If things goes wrong, it’ll help server restauration.
  3. Warning step:
@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 / ffmpeg.md
Created January 4, 2020 23:20
Notes about FFMPEG

Audio

ffmpeg -i smb-bump.wav -c:a flac -compression_level 8 -map_metadata -1 smb-bump.flac
  • -c:a flac for FLAC.
  • -compression_level 8: 0 is low compression (faster to decode), 12 is highest, but following this thread, you should never go above 8.
@meduzen
meduzen / service-workers-resources.md
Last active November 15, 2019 18:24
Service Workers resources
@meduzen
meduzen / media-query-orientation-square.md
Last active July 12, 2019 09:15
Querying a square viewport

Hi,

I’m playing a bit with the regular browser media queries and noticed that there’s no square value for orientation. And more surprisingly, the definition of portrait orientation includes the square orientation:

The orientation media feature is portrait when the value of the height media feature is greater than or equal to the value of the width media feature. […] Otherwise orientation is landscape.

So the only way to query a square viewport is by using the aspect-ratio media query:

@media (aspect-ratio: 1/1) {
 /* css declarations for a square visual output */
// IE & Edge do not support :focus-within, so they ignore the 3 selectors.
@media screen and (min-width:896px) {
.sub-nav:target,
.sub-nav__parent:focus-within .sub-nav,
.sub-nav__parent:hover .sub-nav {
opacity: 1;
visibility: visible;
}
}