Skip to content

Instantly share code, notes, and snippets.

View placecodex's full-sized avatar

Maicol Romero placecodex

  • Dominican Republic
View GitHub Profile
@placecodex
placecodex / remote-file-copy.php
Created September 26, 2019 20:44 — forked from kongondo/remote-file-copy.php
Remote file copying with progress reporting in PHP.
<?php
/*
* Remote File Copy PHP Script 2.0.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
@placecodex
placecodex / curl_progress.php
Created September 28, 2019 02:12 — forked from stuudmuffin/curl_progress.php
PHP/cURL download progress monitoring
<?php
//output buffer
ob_start();
//create javascript progress bar
echo '<html><head>
<script type="text/javascript">
function updateProgress(percentage) {
document.getElementById(\'progress\').value = percentage;
}
@placecodex
placecodex / Database
Created February 15, 2021 22:16 — forked from sabid/Database
Laravel + Jquery Ajax Country and City
CREATE TABLE `paises` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
CREATE TABLE `ciudades` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pais_id` int(11) DEFAULT NULL,
`nombre` varchar(50) DEFAULT NULL,
@placecodex
placecodex / IndexController.php
Created February 18, 2021 21:01 — forked from juyal-ahmed/IndexController.php
Curl get request in Laravel controller with cache support.
<?php
namespace App\Http\Controllers;
class InfoController extends Controller
{
/*
*
* Checking if cache file exist
* @ param string $name cache file name
@placecodex
placecodex / aes_enc_dec.php
Created May 12, 2021 01:23 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@placecodex
placecodex / Response.php
Created February 8, 2022 15:01 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@placecodex
placecodex / trc20.js
Created March 18, 2022 16:31 — forked from andelf/trc20.js
Get TRC20 balance and transfer USDT tokens
const TronWeb = require('tronweb');
const HttpProvider = TronWeb.providers.HttpProvider;
const fullNode = new HttpProvider("https://api.trongrid.io");
// const fullNode = new HttpProvider("http://192.168.1.162:8090");
const solidityNode = new HttpProvider("https://api.trongrid.io");
const eventServer = new HttpProvider("https://api.trongrid.io");
const privateKey = "3481E79956D4BD95F358AC96D151C976392FC4E3FC132F78A847906DE588C145";
const tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey);
@placecodex
placecodex / tokenPriceApi.js
Created May 9, 2022 22:10 — forked from Linch1/tokenPriceApi.js
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"interna
@placecodex
placecodex / Laravel-Scheduler-Windows.md
Created August 6, 2022 12:19 — forked from Splode/Laravel-Scheduler-Windows.md
Laravel Scheduler on Windows

Run Laravel Scheduled Tasks on Windows

The following are instructions for running scheduled tasks defined in a Laravel project on Windows. The Laravel documentation provides instructions for running scheduled tasks using cron jobs on Linux systems. However, cron jobs are not available on Windows. The built-in Windows Task Scheduler can be used to run scheduled tasks instead.

Create a Scheduled Task

  1. Open Task Scheduler
  2. Select Create Task...
  3. Give the task a name and description
  4. To run the task in the background, select Run whether the user is logged on or not and check the Hidden checkbox.