- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Session data | |
$ftpHost = 'ftp.domain.ext'; | |
$ftpUsername = 'username'; | |
$ftpPassword = '*****'; | |
// Connect with ftp host | |
$conn = ftp_connect($ftpHost) or die("Is not possible connect with ftp host"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// VALIDATIONS | |
filter_var($integerNumber, FILTER_VALIDATE_INT); // verify if variable is an integer number | |
filter_var("127.0.0.1", FILTER_VALIDATE_IP); // verify if is an IP code | |
filter_var("[email protected]", FILTER_VALIDATE_EMAIL); // verify if is a correct email | |
filter_var("https://domain.ext/", FILTER_VALIDATE_URL); // verify if is a correct url | |
filter_var("true", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); // verify if is a boolean value | |
filter_var("123.45", FILTER_VALIDATE_FLOAT); // verify if is a float number | |
//SANITIZE DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://www.php.net/manual/es/refs.calendar.php | |
echo date("Y/m/d"); // Current date on format: 2024/12/24 | |
echo date("Y-m-d"); // Current date on format: 2024-12-24 | |
echo date("h:i:sa"); // Current hour on format: 04:33:39am | |
echo date("h:i:s"); // Current hour on format: 04:33:39 | |
echo date("H:I:s"); // Current hour on format: 20:33:39 | |
echo date('Y-m-d H:i:s'); // Current date: 2024-07-23 12:34:56 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
init_set('display_errors', 0); | |
init_set('html_errors', 0); | |
$message = new stdClass(); | |
$message->content[0] = "Hi there!"; | |
$message->content[1] = "See you later"; | |
/** Headers Response **/ | |
header('Content-Type: application/json; charset=utf-80); // response tpye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a promise and assign it to a variable | |
*/ | |
let promise = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('Success!') | |
}, 2000) | |
}); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Creamos una clase de la cual se crearan los objetos que contendra el array | |
* El array tendra solo objetos de esta clase. [Product, Product, ...] | |
*/ | |
readonly class Product | |
{ | |
public function __construct( | |
private string $name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"runtime" // Este paquete permite trabajar con las Go rutinas | |
"sync" // Permite crear sincronizar las rutinas de Go | |
) | |
// Variable que permite crear grupos de rutinas | |
var wg sync.WaitGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* npm i node-fetch // Instalamos el paquete | |
* Necesario agregar en el archivo package.json la directiva "type": "module" | |
*/ | |
import fetch from "node-fetch"; | |
const API = 'https://api.escuelajs.co/api/v1'; | |
/*--------------------GET---------------------------*/ | |
function fetchData(urlApi){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | |
const API = "https://api.escuelajs.co/api/v1"; | |
//funcion principal que obtendrá la informacion del producto como un objeto | |
function fetchData(urlApi, callback) { | |
//inicializar un objeto de tipo XMLHttpRequest | |
let xhttp = new XMLHttpRequest(); | |
//El metodo .open realiza la petición de apertura de comunicación, el metodo puede ser 'GET' o 'POST', | |
// luego se envia la URL, si es asincrono (true o false), usuario y contraseña. En esta caso solo se utiliza el metodo, la url y async | |
xhttp.open('GET', urlApi, true); |
NewerOlder