Skip to content

Instantly share code, notes, and snippets.

View rdeutz's full-sized avatar

Robert Deutz rdeutz

  • Robert Deutz Business Solution
  • Germany
  • 16:41 (UTC +01:00)
View GitHub Profile
@rdeutz
rdeutz / gist:45ebe915403c0c16d5cc67b5f77a0c2f
Created August 13, 2018 14:21
Start docker-tools container
Start the container
docker run -it --rm -v $(pwd):/opt -w /opt joomlaprojects/docker-tools bash
Any command you execute from now on is runnig in the container
git clone --single-branch -b 4.0-dev https://github.com/joomla/joomla-cms.git
cd joomla-cms
composer install
npm i
@rdeutz
rdeutz / latest.php
Last active April 18, 2018 20:54
Latest joomla 3 release file
<?php
// Fetch the current 3.x version from the downloads site API
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://downloads.joomla.org/api/v1/latest/cms');
$result = curl_exec($ch);
curl_close($ch);
if ($result === false)
{
echo 'Could not fetch version data, please check your connection.' . PHP_EOL;
@rdeutz
rdeutz / delete.groovy
Last active July 29, 2017 18:11
Delete Job Queue in Jenkins
/*** BEGIN META {
"name" : "Clear build queue",
"comment" : "If you accidently trigger a lot of unneeded builds, it is useful to be able to <b>cancel</b> them all",
"parameters" : [],
"core": "1.300",
"authors" : [
{ name : "Niels Harremoes" }
]
} END META**/
import hudson.model.*

Keybase proof

I hereby claim:

  • I am rdeutz on github.
  • I am rdeutz (https://keybase.io/rdeutz) on keybase.
  • I have a public key ASCGfR7x0I8e4nLmK6oFgLDB3TdLc98ehwuZnqoXSsp9mgo

To claim this, I am signing this object:

<?php
// ISO-3166-1
$data = array(
4 => array('name' => 'Afghanistan','numeric-codes' => 4,'alpha-2-codes' => 'AF','alpha-3-codes' => 'AFG'),
248 => array('name' => 'Åland Islands','numeric-codes' => 248,'alpha-2-codes' => 'AX','alpha-3-codes' => 'ALA'),
8 => array('name' => 'Albania','numeric-codes' => 8,'alpha-2-codes' => 'AL','alpha-3-codes' => 'ALB'),
12 => array('name' => 'Algeria','numeric-codes' => 12,'alpha-2-codes' => 'DZ','alpha-3-codes' => 'DZA'),
16 => array('name' => 'American Samoa','numeric-codes' => 16,'alpha-2-codes' => 'AS','alpha-3-codes' => 'ASM'),
@rdeutz
rdeutz / gist:dd6f7e4597f288a4628c
Created July 17, 2015 14:09
Joomla CLI script for fixing **something**
<?php
/**
* Cleanup Script
*
* @package ABITDIRTY
* @author Robert Deutz <[email protected]>
*
* @copyright 2015 Robert Deutz
* @license GNU General Public License version 2 or later
**/
@rdeutz
rdeutz / remove-scripts
Last active August 29, 2015 14:15
removing scripts from the head
// that is bad hack, I am accessing a by convention as private maked class variable.
// But you can not set the head to an empty array so that is the only way to allow to remove all scripts
// I am adding one script, this should have all the scripts merged into one file
// KEEP IN MIND THAT'S WORKING NOW (VERSION 3.3.6) BUT THAT DOES NOT MEAN IT WILL WORK ALWAYS
$tpath = $this->baseurl.'/templates/'.$this->template;
$scripts = $doc->_scripts;
$doc->_scripts = array();
@rdeutz
rdeutz / gist:9252368
Created February 27, 2014 15:31
FOF: Don't overwrite values in the db when fields are not within the form
class whatModelever extends FOFModel
{
.....
/**
* This method runs before the $data is saved to the $table. Return false to
* stop saving.
*
* @param array &$data The data to save
@rdeutz
rdeutz / gist:9109236
Created February 20, 2014 08:34
TypeHint replacement
public function getRowData(JTable $table)
{
....
}
replacing with:
public function getRowData($table)
{
if (!(get_class($table) == 'JTable' || is_subclass_of($table, 'JTable')))
@rdeutz
rdeutz / gist:9058277
Last active February 23, 2016 15:00
Show a number of modules form a larger number of modules randomly
<?php
$modlist=array('modpos01','modpos02','modpos03','modpos04','modpos05');
$allMods=count($modlist);
$show=array();
$elephantInCairo=0;
while(count($show) < 4 && $elephantInCairo < 100)
{
$c = rand (0 , $allMods-1);
if (!in_array($modlist[$c], $show))