Skip to content

Instantly share code, notes, and snippets.

rotexdegba /
Last active Oct 14, 2020
Installing Rails and Redmine in Ubuntu 16.04 LTS / Linux Mint 18
# Make sure you have already installed apache and mysql;
# see
# for instructions.
# install rails
sudo apt install rails
# install comman dependencies
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev make libmysqlclient-dev imagemagick \
rotexdegba /
Created Jun 18, 2019
A list of changes in PHP 7.0+ all on one page

New Stuff in PHP 7.0

  1. Scalar type definitions: they come in two flavours: coercive (default) and strict. The following types for parameters can now be enforced (either coercively or strictly): strings (string), integers (int), floating-point numbers (float), and booleans (bool). They augment the other types introduced in PHP 5: class names, interfaces, array and callable.
    • Typed pass-by-reference Parameters gotcha: Declared types of reference parameters are checked on function entry, but not when the function returns, so after the function had returned, the argument's type may have changed. For example:
    function array_baz(array &$param)
    	$param = 1;
rotexdegba / linux-disk-usage.php
Last active Apr 20, 2020
Linux Disk Usage PHP Script
View linux-disk-usage.php
include_once './vendor/autoload.php';
use jc21\CliTable;
use jc21\CliTableManipulator;
// 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 / rector.yaml
Last active Jan 21, 2020
A yaml file containing base Rector configuration setting to be used by the Rector tool on all my php projects
View rector.yaml
# rector.yaml
# - { resource: 'vendor/rector/rector/config/set/code-quality/code-quality.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php52.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php53.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php54.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php55.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php56.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php70.yaml' }
# - { resource: 'vendor/rector/rector/config/set/php/php71.yaml' }
rotexdegba /
Last active Dec 8, 2019
How to enable new sites in apache2 on ubuntu 16.04 / Mint 18

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf

<VirtualHost *:80>
	ServerAlias *
    DocumentRoot /var/www/html/promis-2.0/public

	ErrorLog /var/www/html/promis-2.0/logs/apache-error.log
rotexdegba / dropdown-list-in-a-cell-phpexcel.php
Created Nov 21, 2013
How to add drop down list to a cell in PHPExcel
View dropdown-list-in-a-cell-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->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
rotexdegba /
Last active Aug 14, 2019
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
# OR
wget --wait=20 --mirror --convert-links --adjust-extension --page-requisites --no-parent -U Mozilla
rotexdegba / html5-input-type-number-2-decimal-places.html
Last active Jul 8, 2019
Html5 Input field for currency to 2 decimal places
View html5-input-type-number-2-decimal-places.html
<!DOCTYPE html>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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 / center-jquery-dialog.php
Last active Oct 3, 2018
Centering a JQuery Dialog
View center-jquery-dialog.php
<script type="text/javascript">
function() {
// a workaround for a flaw in the demo system (, ignore!
//jQuery( "#dialog:ui-dialog" ).dialog( "destroy" );
jQuery( "#dialog-form" ).dialog({
autoOpen: false,
height: 600,
You can’t perform that action at this time.