Skip to content

Instantly share code, notes, and snippets.

View fransafu's full-sized avatar
🎯
Keep it simple

Francisco Javier Sánchez Fuentes fransafu

🎯
Keep it simple
View GitHub Profile
francisco@Francisco-NB:~/ProyectoGit/PHPLaravelGymManagementSystem$ sudo php artisan migrate
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
Migration table created successfully.
[Exception]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migrations' already exists (SQL: create table `migrations` (`id` int unsigned not
null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null, `created_at` timestamp default 0 not null, `updated_at
` timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci) (Bindings: array (
@fransafu
fransafu / The Dijkstra algorithm
Created January 12, 2016 16:57
This is the Dijkstra algorithm in python 3
def dijkstra(matriz_costo, numero_vertices):
S = [1] # Vertices visitados, iniciamos con 1
V = list(range(1,numero_vertices+1)) # Vertices disponibles
D = [0] * numero_vertices # Arreglo de costo
print ('\n[+] Inicializando variables.')
print ('Vertice inicial visitado S:' + str(S))
print ('Vertices disponibles en total V:' + str(V))
print ('Arreglo de costo inicializado D:' + str(D))
print ('')
@fransafu
fransafu / Bubble Sort
Created January 12, 2016 19:36
Bubble Sort in PHP
function bubbleSort($array){
$lenArray = count($array);
for($i = 1; $i <= $lenArray; $i++){
for($j = 0; $j < $lenArray; $j++){
if (($j + 1) < $lenArray){
if ($array[$j] > $array[$j + 1]){
$aux = $array[$j];
$array[$j] = $array[$j + 1];
$array[$j + 1] = $aux;
#Actualiza repositorio
sudo apt-get update
# instala build-essential y libssl
sudo apt-get install build-essential libssl-dev
# Descarga script de instalacion de Node Version Manager
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
# Ejecuta script de instalacion de NVM
@fransafu
fransafu / Web_scraping_informeperros.py
Created February 25, 2018 17:52
Web scraping of site web informeperros.com
# -*- coding: utf-8 -*-
from pprint import pprint
from bs4 import BeautifulSoup
import requests
import json
URL = 'http://informeperros.com/lista-de-todas-las-razas-de-perros-por-orden-alfabetico/'
def main():
@fransafu
fransafu / getFilename
Created July 26, 2018 21:52
Get filename and extension from path route in excel [MACRO][VB]
Sub getFilename()
' Obtener Ultima fila y ultima columna
Dim numRows As Long
Dim numCols As Long
' Guardar texto de la ruta
Dim strDoc As Variant
' Guardar arreglo separado por la variable strSplit
@fransafu
fransafu / Import and Clear
Created July 26, 2018 21:54
Import and Clear filename from path route [MACRO][VB]
Sub ImportarData()
Dim pathToExcel As String
Dim sheetExcelOrigin As String
Dim numRows As Long
pathToExcel = "C:\Users\fransafu\Desktop\filename.xlsx"
sheetExcelOrigin = "Sheet1"
sheetExcelDest = "Destino"
strSplit = "/"
@fransafu
fransafu / 1_nativo.js
Last active February 7, 2020 00:13
[Node.js] Ejemplo de uso de modulo nativo en Node.js
/*
URL DOC: https://nodejs.org/api/fs.html
URL Ejemplo: https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback
*/
// Realizamos el llamado de la Biblioteca FileSystem (fs)
const fs = require('fs');
// Agregamos el mensaje 'Hello World' en un buffer y guardamos la salida en la variable 'data'
const data = new Uint8Array(Buffer.from('Hello World!'));
@fransafu
fransafu / 2_propio.js
Last active February 7, 2020 00:13
Ejemplo de uso de modulo propio en Node.js
// checkIfString verifica si el parametro corresponde a un String
const checkIfString = (str) => {
if (typeof str === 'string' || str instanceof String) {
return true;
}
return false;
}
// checkIfNumber verifica si el parametro ingresado corresponde a un Numero
const checkIfNumber = (num) => parseInt(num) === num;
@fransafu
fransafu / 3_ejemplo.js
Created February 7, 2020 00:13
[Node.js] Probar modulo nativo y modulo propio
/*
En este ejemplo se realiza el uso de un modulo nativo junto con
el modulo que acabamos de hacer
*/
// Importamos una Biblioteca Nativa
const fs = require('fs');
const nuestroModulo = require('./2_propio');
// Nota: Si no especifican el 'encoding' readFile retorna un Buffer en la variable 'data'
// Nota 2: Probar sin 'uft8' como parametro