Skip to content

Instantly share code, notes, and snippets.

View rotexdegba's full-sized avatar

Rotimi Ade rotexdegba

View GitHub Profile
@rotexdegba
rotexdegba / podman-tutorial.md
Created February 26, 2024 20:34
Podman Tutorial

Podman Tutorials


@rotexdegba
rotexdegba / rmdirRecursive.php
Created January 28, 2023 23:15
Recursive Directory Deletion PHP
<?php
function rmdirRecursive(string $dir) {
$iter = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$it = new RecursiveIteratorIterator($iter, RecursiveIteratorIterator::CHILD_FIRST);
foreach($it as $file) {
if ($file->isDir()) {
@rotexdegba
rotexdegba / remove-old-snaps.sh
Created January 28, 2023 03:36
Remove old snap apps from any linux distro with snapd enabled
#!/bin/bash
#Removes old revisions of snaps
#CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
@rotexdegba
rotexdegba / div-with-multiple-background-images.js
Last active August 24, 2022 20:13
Use JQuery to enable multiple background images for a div with the images being displayed at a specified interval
// Tested with jQuery v3.3.1
$( document ).ready(function() {
var doVisualUpdates = true;
document.addEventListener('visibilitychange', function(){
doVisualUpdates = !document.hidden;
});
// code below changes the background every 10 seconds for the div with id back-overlay-slider
@rotexdegba
rotexdegba / dev-server-router.php
Created February 1, 2021 17:05
Router script for the builtin PHP webserver to handle urls ending in dot something
<?php
// This script is intended to fix the php built-in server issue with urls that
// contain a .something at the end. The built-in server tries to always treat
// such urls as static assets when sometimes they are routes meant to be
// forwarded to the index.php. See below for more info:
//
// https://bugs.php.net/bug.php?id=61286
// https://github.com/slimphp/Slim/issues/359
// https://gonzalo123.com/2012/10/15/how-to-rewrite-urls-with-php-5-4s-built-in-web-server/
// https://gist.github.com/aenglander/8e2f83c4526fccdcdead

Make sure you have installed debugbar via composer.

Copy this script to the root folder of you application and run it from there.

In your template file, which will usually be located in ./src/layout-templates, add the code below inside the head section of the template:

  <link rel="stylesheet" type="text/css" href="<?= s3MVC_MakeLink('/css/debugbar-css-assets.css'); ?>">
 
@rotexdegba
rotexdegba / dump-debugbar-public-assets.php
Last active January 28, 2021 19:57
Script for dumping debugbar css & js assets into the public folder of apps powered by https://github.com/rotexsoft/slim3-skeleton-mvc-app
<?php
// For use in apps built with https://github.com/rotexsoft/slim3-skeleton-mvc-app
// Copy script to the root folder of the project and run from there.
// Works with "maximebf/debugbar" version "^1.16
// This script copies the fonts folder from the debugbar composer vendor folder
// to the ./public/fonts folder. It also dumps all the css and js assets
// needed by debugbar into ./public/css/debugbar-css-assets.css and
// ./public/js/debugbar-js-assets.js respectively
@rotexdegba
rotexdegba / linux-disk-usage.php
Last active April 21, 2021 22:13
Linux Disk Usage PHP Script
<?php
include_once './vendor/autoload.php';
use jc21\CliTable;
use jc21\CliTableManipulator;
// HOW TO USE:
// copy script ( linux-disk-usage.php ) to a folder on your system and cd to that folder
// composer require jc21/clitable
// php linux-disk-usage.php
@rotexdegba
rotexdegba / html5-input-type-number-2-decimal-places.html
Last active July 8, 2019 20:00
Html5 Input field for currency to 2 decimal places
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form method="post" id="add-edit-form" class="add-edit-form" enctype="multipart/form-data" action="http://localhost:8887/listing-types/edit/2">
<label for="name">Name<span style="color: red;"> *</span></label>