Skip to content

Instantly share code, notes, and snippets.

@dev-armando
dev-armando / example.sftp.config.json
Created October 14, 2021 05:54
Example of sftp configuration in Sublime Text 3 editor
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "ftp",
"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": false,
@dev-armando
dev-armando / DistancePosition.php
Created November 2, 2021 03:25
Para calcular la distancia entre 2 puntos en Laravel
<?php
namespace App\Traits;
trait DistancePosition
{
// $lat1, $lon1, $lat2, $lon2
private function CalcDistance( $params, $unit="K") {
extract($params);
@dev-armando
dev-armando / url-amigable.php
Created November 2, 2021 04:33
Funcion para crear urls amigables para PHP
<?php
function urls_amigables($url) {
$url = strtolower($url);
$find = array('á', 'é', 'í', 'ó', 'ú', 'ñ');
$repl = array('a', 'e', 'i', 'o', 'u', 'n');
$url = str_replace ($find, $repl, $url);
$find = array(' ', '&', '\r\n', '\n', '+');
@dev-armando
dev-armando / uploadImg.php
Created November 2, 2021 04:50
Funcion para subir una imagen
<?php
function upload_image($destination_dir, $name_media_field, $intfecha){
$tmp_name = $_FILES[$name_media_field]['tmp_name'];
if (is_dir($destination_dir) && is_uploaded_file($tmp_name)) {
$img_file = strtolower(str_replace(" ", "", $_FILES[$name_media_field]['name']));
$img_type = $_FILES[$name_media_field]['type'];
if (((strpos($img_type, "gif") || strpos($img_type, "jpeg") || strpos($img_type, "jpg")) || strpos($img_type, "png"))) {
if (move_uploaded_file($tmp_name, $destination_dir . '/' . $intfecha . $img_file)) return true;
}
@dev-armando
dev-armando / fromBase64ToImg.php
Created November 2, 2021 04:57
Transformar imagen base64 a un archivo
<?php
function fromBase64ToImg($imgBase64 , $dir , $name_file ){
$pattern = '/data:image\/(.+);base64,(.*)/';
preg_match($pattern, $imgBase64, $matches);
$imageExtension = $matches[1];
$encodedImageData = $matches[2];
nano /etc/systemd/system/idempiere.service
-----------------------------------
[Unit]
Description=Description for sample script goes here
After=local-fs.target
[Service]
# temporarily disable SELinux run
sudo setenforce 0
# disabled SELinux
sudo /etc/selinux/config
# Add file /etc/selinux/config
SELINUX=disabled
select * from fact_acct fa where ad_table_id = 473;
-- 473
delete from fact_acct where ad_table_id = 473 ;
@dev-armando
dev-armando / env-example-pentaho.sh
Last active December 3, 2021 19:46
Example env PDI
# PENTAHO ENV EXAMPLE IN ~/.bashrc
export PENTAHO_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre

Pull image

docker pull idempiereofficial/idempiere

Deploy Container

docker run -d --name idempiere -p 8080:8080 --network bridge -e DB_HOST=127.0.0.1 -e DB_PORT=5432 -e DB_NAME=idempiere -e DB_USER=adempiere -e DB_PASS=adempiere -e DB_ADMIN_PASS=postgres idempiereofficial/idempiere:8.2