Skip to content

Instantly share code, notes, and snippets.

View rotexdegba's full-sized avatar

Rotimi Ade rotexdegba

View GitHub Profile
@rotexdegba
rotexdegba / common-ubuntu-software-i-use.md
Last active September 28, 2017 20:31
A list of applications I normally use on my Ubuntu or Mint Desktop Machines.
@rotexdegba
rotexdegba / named-js-functions.js
Last active December 12, 2017 20:55
How to execute a JavaScript function when I have its name as a string
// see also https://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string
window.example = function () { alert('hello world'); };
//or
name = 'example';
window[name] = function () { alert('hello world'); };
//or
window[name] = new Function( 'alert("hello world")' );
@rotexdegba
rotexdegba / old-collection.php
Created May 13, 2018 06:59
Old Collection Class
<?php
/**
*
* A collection of Cfs_Model_Base_Record records.
* @package Cfs_Model
*
*/
class Cfs_Model_Base_Collection extends Solar_Sql_Model_Collection {
/**
@rotexdegba
rotexdegba / object-has-get-property.php
Created June 28, 2018 17:31
Object Property Detection and Object Property Value Retrieval
<?php
/**
*
* A robust way of retrieving the value of a a specified property in
* an instance of a class.
*
* Works with \stdClass objects created from arrays with numeric key(s)
* (the value of the propertie(s) with numeric key(s) in such \stdClass
* objects will be retrieved by this function).
*
@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>
@rotexdegba
rotexdegba / download-full-copy-of-website-via-wget.sh
Last active August 14, 2019 16:43
How to download a full copy of a website for offline reading via wget
wget --wait=20 --mirror --convert-links --page-requisites --no-parent -U Mozilla http://www.website.com/
# OR
wget --wait=20 --mirror --convert-links --adjust-extension --page-requisites --no-parent -U Mozilla http://www.website.com/
@rotexdegba
rotexdegba / dropdown-list-in-a-cell-phpexcel.php
Created November 21, 2013 18:25
How to add drop down list to a cell in PHPExcel
<?php
$objValidation = $objPHPExcel->getActiveSheet()->getCell("C$curr_row")->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');

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 / 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