Skip to content

Instantly share code, notes, and snippets.

@TolyanDimov
TolyanDimov / SLUG.md
Created February 27, 2024 16:20 — forked from lucasmezencio/SLUG.md
Creating URL slugs properly in PHP (including transliteration for UTF-8)

Creating URL slugs properly in PHP (including transliteration for UTF-8)

The point to use a slug (semantic URL) besides of improve the SEO of your articles is to prevent that the user, at the creation of for example an article, it uses special characters that aren't allowed in a URL, appropiate the usage etc. What target usage means, is context dependent.

In this article, you'll learn how to slugify a string in PHP properly, including (or not) support (conversion) for cyrilic and special latin characters.

Slugify in PHP

The following function exposes a simple way to convert text into a valid slug:

@TolyanDimov
TolyanDimov / whatsapp-full-screen.user.js
Last active March 19, 2024 14:53
Enable full-screen mode for WhatsApp Web on larger screens
// ==UserScript==
// @name whatsapp-full-screen
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Enable full-screen mode for WhatsApp Web on larger screens
// @author tolyandimov
// @match https://web.whatsapp.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=whatsapp.com
// @grant none
// ==/UserScript==
@TolyanDimov
TolyanDimov / 55-bytes-of-css.md
Created October 18, 2022 10:12 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@TolyanDimov
TolyanDimov / settings.json
Last active January 9, 2021 10:30
Post​CSS Sorting Config
"postcssSorting.config": {
"order": [
"custom-properties",
{
"type": "at-rule",
"name": "mixin"
},
"declarations",
"at-rules",
"rules"
<?php
/**
* Plugin Name: WPMOD
* Description: CPT
* Version: +100500
*/
/**
*
* general