Skip to content

Instantly share code, notes, and snippets.

View kshitijdeota's full-sized avatar

KD kshitijdeota

View GitHub Profile
@kshitijdeota
kshitijdeota / clean-up-arch-linux.md
Created November 6, 2024 08:15 — forked from rumansaleem/clean-up-arch-linux.md
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@kshitijdeota
kshitijdeota / jekyll-cookie-consent.html
Created October 25, 2023 19:44 — forked from Chuvisco88/jekyll-cookie-consent.html
An approach on how to add cookie consent to a jekyll page
@kshitijdeota
kshitijdeota / gist:48103da20d2782f9768f6ab1da945402
Created January 7, 2022 20:36 — forked from dukeofharen/gist:e2c60b4478408b53d743
WordPress like shortcode parser for PHP
<?php
//The content which should be parsed
$content = '<p>Hello, my name is John an my age is [calc-age day="4" month="10" year="1991"].</p>';
$content .= '<p>Hello, my name is Carol an my age is [calc-age day="26" month="11" year="1996"].</p>';
//The array with all the shortcode handlers. This is just a regular associative array with anonymous functions as values. A very cool new feature in PHP, just like callbacks in JavaScript or delegates in C#.
$shortcodes = array(
"calc-age" => function($data){
$content = "";
//Calculate the age
@kshitijdeota
kshitijdeota / not-found.js
Created November 8, 2018 15:10
Track 404 event with Google Analytics
<script>
// Create Tracker - Send to GA
ga('create', 'UA-11111111-11');
ga('send', {
hitType: 'event',
eventCategory: '404 Response',
eventAction: window.location.href,
eventLabel: document.referrer
});
</script>