Skip to content

Instantly share code, notes, and snippets.

@victor-homyakov
victor-homyakov / detect-unused-css-selectors.js
Last active February 17, 2023 18:36
Detect unused CSS selectors. Show possible CSS duplicates. Monitor realtime CSS usage.
/* eslint-disable no-var,no-console */
// detect unused CSS selectors
(function() {
var parsedRules = parseCssRules();
console.log('Parsed CSS rules:', parsedRules);
detectDuplicateSelectors(parsedRules);
var selectorsToTrack = getSelectorsToTrack(parsedRules);
window.selectorStats = { unused: [], added: [], removed: [] };
console.log('Tracking style usage (inspect window.selectorStats for details)...');
@GAS85
GAS85 / apache_ssl.md
Last active March 14, 2024 16:40
Apache 2.4.18+ with Letsencrypt on Ubuntu 20.04 - SSL config for A+ on SSLLabs.com

Prerequisites

  • Ubuntu 20.04 (18.04, 16.04 works the same)
  • Apache 2.4.18 or higher
  • OpenSSL 1.0.2g-1ubuntu4.10 or higher
  • e.g. LetsEncrypt certificate
OS: Ubuntu 20.04 Apache/2.4.18 1.0.2g-1ubuntu4.10 +
@shgysk8zer0
shgysk8zer0 / README.md
Created February 10, 2017 06:28
Generate random images in PHP

Generate random images in PHP

sample

Why?

  • Because you can
  • Because you have time to spare
  • Maybe you think they look cool or want to save them for wallpapers or something
  • Maybe it reminds you of that one time... You know which time I'm talking about

Requirements

@amboutwe
amboutwe / yoast_seo_sitemap_add_custom_type.php
Last active April 16, 2024 11:21
Filters and example code for Yoast SEO sitemaps
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Create Custom Yoast Sitemap
* Credit: Unknown
* Last Tested: Unknown
*********
* HOW TO USE
* Replace TYPE with your custom type
*/
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active April 23, 2024 23:58 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@hroling
hroling / gist:85f36e86d48285f08161
Last active March 28, 2021 02:42
Apache 2.4 SSL config for A+ on SSLLabs.com
OLD stuff. This was not enough for an A+ anymore.
@andsens
andsens / dump.sh
Last active October 24, 2023 07:04
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@adammiller
adammiller / douglasPeucker.js
Created February 14, 2011 16:54
Javascript implementation of the Douglas Peucker path simplification algorithm
var simplifyPath = function( points, tolerance ) {
// helper classes
var Vector = function( x, y ) {
this.x = x;
this.y = y;
};
var Line = function( p1, p2 ) {
this.p1 = p1;