Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lucasreta on github.
  • I am lucasreta (https://keybase.io/lucasreta) on keybase.
  • I have a public key ASB2z5Fqm4RTUFrKQ-8WCBtqDGPQ5QM9Nqu0cRGToMX-cQo

To claim this, I am signing this object:

@lucasreta
lucasreta / fecha.js
Last active July 17, 2020 00:34
GIST hecho por #AwsomEntrepriseCouding VIDEOS INCORPORATED todos los derechos RESERVADOS (pero codigo abierto y no recomendable)
// #AwsomEntrepriseCouding version 1.0
// mi clase de tiempo
bisi = (ano) => ano%400 == 0 || (ano%4 == 0 && ano%100 != 0)
messi = [null,31,28,31,30,31,30,31,31,30,31,30,31]
validate = (ano, mes, dia) => dia > 0 && ((mes == 2 && bisi(ano) && messi[mes]+1 >= dia) || ((!bisi(ano) || mes != 2) && messi[mes] >= dia))
class fecha {#ano;#mes;#dia; constructor(ano, mes, dia) { if (validate(ano,mes,dia)) {this.#ano=ano; this.#mes=mes; this.#dia=dia;} else {throw new Error('fecha invalida mostro')}} getdia(){return this.#dia} getmes(){return this.#mes} getano(){return this.#ano}}
@lucasreta
lucasreta / index.html
Created September 22, 2020 16:01
working with Chart.JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css" rel="stylesheet" type="text/css">
<title>Portfolio Review Overview</title>
@lucasreta
lucasreta / README.md
Created October 16, 2020 21:36
react-hello-world

Small gist to try and help answer a question in Stack Overflow.

Download the contents of the gist into a folder, open the terminal and navigate to said folder. Once inside the directory, run:

npx serve

This should start a local server in which the small Hello World application can be viewed.

@lucasreta
lucasreta / README.md
Last active October 16, 2020 23:31
php-login

Small gist for a Stack Overflow question about simple PHP login flow.

  • Download all files into a directory
  • Create a database named logintest
  • Create a table as the one described in users.sql
  • Replace login credentials in mysqli() for your own (both in signup.php and login.php)
  • Start a local server in the directory where the files exist: php -S 0.0.0.0:8888
  • Go to http://localhost:8888/signup.php and create a user
  • Go to http://localhost:8888/login.php and log in with email and password of created user
@lucasreta
lucasreta / cligol.c
Created December 3, 2020 09:30
reduced version of cligol's main.c file for medium article
#include "headers/config.h"
#include "headers/custom_string.h"
void compute (int neighbors[BOARD_HEIGHT][BOARD_WIDTH], int board[BOARD_HEIGHT][BOARD_WIDTH]);
void randomize (int board[BOARD_HEIGHT][BOARD_WIDTH]);
void clear () { printf ("\033[H\033[J"); }
void show (int board[BOARD_HEIGHT][BOARD_WIDTH]);
@lucasreta
lucasreta / gifeegol.sh
Last active December 4, 2020 02:29
embeddable version of gifeegol.sh for medium article
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
./cligol/cligol
weekday=`date +"%w"`
today=`date +%Y-%m-%d`
@lucasreta
lucasreta / jwtRS256.sh
Created December 29, 2020 21:33 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
const useHash = true;
const apiUrl = 'https://lucasreta.com/stack-overflow/spa-vanilla-js/api';
const routes = ['section-1', 'section-2'];
const content_box = document.getElementById("content_box");
function get(page) {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
data = JSON.parse(xhr.responseText);
* {
font-family: sans-serif;
}
body {
background-color: #eee;
}
header, main {
background-color: #fff;
border: 1px solid #ababab;
box-shadow: 1px 1px 0 rgba(0,0,0,.2);