Skip to content

Instantly share code, notes, and snippets.

View jlainezs's full-sized avatar
💭
I may be slow to respond.

Pep Lainez jlainezs

💭
I may be slow to respond.
View GitHub Profile
@jlainezs
jlainezs / dbfield.php
Last active December 12, 2015 03:18
Joomla! DBFormFields are JFormField descendants which fetch data from the database. The inspiration come from the classic master-detail implementation which I've coded twice for a project of mine. As I don't like to repeat code I prefer to implement this JFormField descendant classes to improve the project maintenance.
<?php
/**
* Copyright (C) 2013 Pep Lainez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
@jlainezs
jlainezs / createcertificate.php
Last active February 10, 2023 15:22
Creates a certificate using OpenSSL with PHP. sing.php could be used to sign a text with the pkey generated with createCertificate. verify.java shows how to load the certificate from a resource and a verification sample of the text signed with sign.php
/**
* Creates an OpenSSL certificate
* @param $dn Array Associative array "key"=>"value"
* @param $duration int Number of days which the certificate is valid
* @throws Exception If there are any errors
* @return Array Associative array with the security elements: "cer"=>self signed certificate, "pem"=>private key, "file"=>path to the files
*
* @see http://www.php.net/manual/en/function.openssl-csr-new.php
* @author Pep Lainez
*/
@jlainezs
jlainezs / downloadfile.php
Created March 19, 2013 08:15
File downloader to use under Joomla.
<?php
/**
* File downloader
* @author Pep Lainez
*
*/
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.filesystem.file' );
/**
@jlainezs
jlainezs / JoomlaTemplates.xml
Created June 8, 2013 22:29
Those Eclipse Juno code templates helps to prepare a basic skeleton for classes derived from JController and JModel classes.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Eclipse Juno Joomla templates
=============================
Licensed under GNU/GPL 3.0
(C)2013 by Pep Lainez : jlainezs@econceptes.com
** Use at your own risk and under your responsability **
@jlainezs
jlainezs / bootstrap.php
Last active August 29, 2015 14:01
Unit test configuration for the administration side of a Joomla! component
<?php
error_reporting(E_ALL);
define('_JEXEC', 1);
define('JPATH_BASE','*** where is joomla installed ? ***');
define('JOOMLA_ADMIN', JPATH_BASE . 'administrator'); // want to test admin side
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['REQUEST_METHOD'] = 'GET';
@jlainezs
jlainezs / Bulk bound of product images
Created October 15, 2014 19:56
Virtuemart 2.0 snippets
/***
* Link product images for virtuemart 2.0
*
* Heads up:
* - Do a backup of your site
* - Images are stored on the virtuemart product images directory (e.g. images/stories/virtuemart/product)
* - Images are named sku.jpg, where sku is the SKU of a product
* - Run a media sync operation on the Virtuemart Media Manager
*
* Before running this script you should change the prefix (bxhu5) of the tables
@jlainezs
jlainezs / 20-xdebug.ini
Created September 17, 2016 13:40
PHP debug on Vagrant with PHPStorm
#
# Debug on Vagrant with PHPStorm
#
zend_extension=xdebug.so
xdebug.max_nesting_level=400
xdebug.remote_enable=on
xdebug.remote_connect_back=on
xdebug.remote_mode=req
xdebug.inikey=PHPSTORM
@jlainezs
jlainezs / provisionLamp7.0.sh
Created February 3, 2017 17:31
Provision a LAMP stack for ubuntu 14.04 with PHP 7.0 and MySQL
#!/usr/bin/env bash
# update default packages
apt-get update && apt-get -y upgrade
ROOTPASS="rootpass"
# MySQL
debconf-set-selections <<< "mysql-server mysql-server/root_password password $ROOTPASS"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $ROOTPASS"
apt-get -y install mysql-server mysql-client
@jlainezs
jlainezs / basicformfieldlist.php
Last active April 21, 2022 01:37
Joomla 3.X custom field which implements chained dropdown controls with ajax autocomplete capabilities.
<?php
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Pep Lainez <jlainezs@cloudconceptes.com>
* @copyright Copyright (C) 2018 CloudConceptes
* @license GNU/GPL https://www.gnu.org/licenses/gpl-3.0.html
*/
defined('JPATH_PLATFORM') or die;
{
"name": "electronbsvue",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",