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 / 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:
@Venryx
Venryx / RomajiConverter.ts
Last active August 23, 2025 16:21
Hiragana/Katakana to Romaji Converter (Typescript/Javascript)
// Raw chart text obtained by simple copy-paste from: https://en.wikipedia.org/wiki/Hepburn_romanization#Romanization_charts
const rawChartText = `
a i u e o
ka ki ku ke ko きゃ キャ kya きゅ キュ kyu きょ キョ kyo
sa shi su se so しゃ シャ sha しゅ シュ shu しょ ショ sho
ta chi tsu te to ちゃ チャ cha ちゅ チュ chu ちょ チョ cho
na ni nu ne no にゃ ニャ nya にゅ ニュ nyu にょ ニョ nyo
ha hi fu he ho ひゃ ヒャ hya ひゅ ヒュ hyu ひょ ヒョ hyo
ma mi mu me mo みゃ ミャ mya みゅ ミュ myu みょ ミョ myo
ya yu yo
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active October 19, 2025 03:29
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active October 21, 2025 10:53
Front-end frameworks popularity (React, Vue, Angular and Svelte)
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active August 28, 2025 15:49
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@jakub-g
jakub-g / double-fetch-triple-fetch.md
Last active April 13, 2024 12:22
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@jakub-g
jakub-g / async-defer-module.md
Last active October 9, 2025 12:15
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)

@lpranam
lpranam / squash.md
Last active August 3, 2025 10:49
How to squash commits

What is squashing?

Squashing is a process in which we squeeze multiple commits into one pretending it is only a single commit.

Basically squashing commits means we are rewriting the history of commits to make them look like single commit.

squash-diagram.jpg

Why squashing commits is necessary?

@jonathantneal
jonathantneal / recovery.sh
Last active November 10, 2023 01:01
Create or update macOS Big Sur (or Catalina, or Mojave) Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@meduzen
meduzen / bpost-tracking.js
Last active May 2, 2025 10:32
Run this in the browser console on https://track.bpost.cloud ; don’t forget to update the first 3 lines.
const trackingCode = '324567890'
const postCode = 1000
const language = 'EN' // 'FR', 'NL', 'EN'
let intervalId = null
let status = null
let deliveryWindow = null
const deliveredPicApi = 'https://track.bpost.cloud/track/asset'