Skip to content

Instantly share code, notes, and snippets.

View ffuentese's full-sized avatar
😃
improving PHP and learning Vue

Francisco Fuentes ffuentese

😃
improving PHP and learning Vue
View GitHub Profile
@ffuentese
ffuentese / comunas-y-regiones-de-chile.sql
Created October 24, 2019 16:52
Comunas y regiones de Chile al 24-10-2019 en formato SQL
# ************************************************************
# Gonzalo De Spirito - gonzalo@freshworkstudio.com
# Corregido y actualizado por Francisco Fuentes - correo@ffuent.es
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@ffuentese
ffuentese / pagination-slim-bootstrap.md
Last active August 11, 2018 21:56
Pagination with Eloquent and Slim 3 using Bootstrap styles (PHP)

If you work with Slim you probably use Eloquent to retrieve and know that Eloquent is a ORM tool meant to be used within Laravel so its usage outside it is not very well documented.

if you want your query to include pagination you use:

$yourquery->links(); 

What if your Bootstrap version doesn't match Eloquent Pagination's? Support for Bootstrap 3/4 is built in however, Bootstrap 4 is not enabled in Pagination 5.2 at least.

To enable that you'd have to add an instance of the Bootstrap4Presenter.

import unittest
import palindrome
class TestNormalize(unittest.TestCase):
def test_normalize_russian(self):
str = "Кит на мо́ре — рома́нтик"
rstr = "Кит на море — романтик"
self.assertEqual(rstr, palindrome.normalize(str))
def test_normalize_spanish(self):
@ffuentese
ffuentese / palindrome.py
Created August 1, 2018 21:50
Palindrome in Python
import string
import unicodedata
def reverse_string(str):
# reverses the phrase
return ''.join(reversed(str))
def clean(str):
# helps ignoring punctuation as we check palindrom phrases
translator=str.maketrans('','',string.punctuation)
@ffuentese
ffuentese / config.php
Created May 31, 2018 17:25
PDO class for MySQL
<?php
// Define configuration
define("DB_HOST", "localhost");
define("DB_USER", "user");
define("DB_PASS", "password");
define("DB_NAME", "schema_name");
@ffuentese
ffuentese / criba.c
Created April 25, 2018 00:54
Sieve of erathostenes to file in C / Criba de eratóstenes en C a archivo de texto
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
int main()
{
FILE * fp;
@ffuentese
ffuentese / criba.css
Last active May 11, 2021 22:29
Criba de Eratóstenes en Javascript
p {
word-wrap: break-word;
width: 500px;
}
@ffuentese
ffuentese / PHPExcel Tutorial - Read an Excel File.php
Last active May 27, 2021 13:33 — forked from theredstapler/PHPExcel Tutorial - Read an Excel File.php
Example of reading an excel file with PHPExcel
<!doctype>
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
var _validFileExtensions = [".xls", ".xlsx", ".csv"];
function ValidateSingleInput(oInput) {
if (oInput.type == "file") {
var sFileName = oInput.value;
@ffuentese
ffuentese / buscar_correos_no_leidos.md
Created September 10, 2015 21:29
Cómo buscar todos los correos no leídos en ZBOX

Cómo buscar todos los correos no leídos

Para ver todos tus correos sin leer debes ingresar a tu bandeja de entrada y hacer clic en la lupa del botón de buscar. Luego debes ir a filtros básicos y marcar la opción no se ha leído.

Si quieres guardar esa búsqueda para ver siempre tus correos sin leer, en la parte derecha de tu pantalla hay un botón llamado Guardar que guarda las búsquedas, después aparecerá una ventana donde deberás darle un nombre a la búsqueda, por ejemplo "Sin leer". Selecciona un color y presiona Aceptar.

Más abajo verás en una animación todos los pasos.

Animación