Skip to content

Instantly share code, notes, and snippets.

View emafriedrich's full-sized avatar

Emanuel Friedrich emafriedrich

  • Blaze
  • Posadas, Misiones, Argentina
View GitHub Profile
@emafriedrich
emafriedrich / stupid-conversation-with-chagGPT.txt
Created June 27, 2024 19:13
Most frustrating CHAT GPT conversation ever (spanish version)
Original chat in spanish https://chatgpt.com/c/e033ec6c-297b-45ef-924e-47ae4082130b. There are another things that i asked before, but ignore that and just go to the frustrating conversation that starts with "
sabes, te cuento un sueño que tengo"
sabes, te cuento un sueño que tengo
ChatGPT
¡Claro! Cuéntame sobre tu sueño. Estoy aquí para escucharte.
mira este codigo
import _ from 'lodash';
@emafriedrich
emafriedrich / randomelement.sql
Created June 22, 2024 11:28
Select random array element PostgreSQL
update table set your_colum = (array['foo', 'bar', 'baz'])[floor(random() * 3 + 1)]; -- replace 3 with your array length
@emafriedrich
emafriedrich / random-number-generator.js
Last active April 5, 2024 13:24
Random Number Generator with Chi Squared test
const crypto = require('crypto');
// Can set the game param to fix any bias you find
const randomDecimalFromHash = ({ hash, game, charsToTake = 5, startsFromPosition = 0 }) => {
hash = hash + game;
const cycle = 3;
const cycleOffset = (cycle * 2) % hash.length;
const hashSegmentForInterval = hash.substring(cycleOffset, cycleOffset + 2);
const randomInterval = parseInt(hashSegmentForInterval, 16) % charsToTake + 1;
@emafriedrich
emafriedrich / gist:f06805223fa1d56fb2945ab31b399152
Created January 20, 2021 12:58
If you docker containers do not recreate with updated code...
# docker
docker build --no-cache
# docker-compose
docker-compose up --build --force-recreate --no-deps
@emafriedrich
emafriedrich / .env
Last active August 25, 2020 20:46
env node module. Typescript implementation
MY_ENV_VAR=some-value
@emafriedrich
emafriedrich / README-español.md
Created March 25, 2020 21:03 — forked from Villanuevand/README-español.md
Una plantilla para hacer un buen README.md. Inspirado en el gist de @PurpleBooth => https://gist.github.com/PurpleBooth/109311bb0361f32d87a2

Título del Proyecto

Acá va un párrafo que describa lo que es el proyecto

Comenzando 🚀

Estas instrucciones te permitirán obtener una copia del proyecto en funcionamiento en tu máquina local para propósitos de desarrollo y pruebas.

Mira Deployment para conocer como desplegar el proyecto.

@emafriedrich
emafriedrich / rename_database_mysql.sql
Created November 4, 2019 20:12
This command generate the commands for rename all table names from a database to another database schema.
SELECT CONCAT('RENAME TABLE ',table_schema,'.',table_name,
' TO ','new_database_name',table_name,';')
FROM information_schema.TABLES
WHERE table_schema LIKE 'old_database_name';
@emafriedrich
emafriedrich / order by difference
Last active November 3, 2017 02:17
Sort javascript array by difference beetwen elemtents
function sortByDifference (value, arr) {
return arr.sort(function (x, y) {
let difx = Math.abs(parseFloat(x) - value);
let dify = Math.abs(parseFloat(y) - value);
if (difx < dify) return -1;
if (difx == dify) return 0;
return 1;
});
}
@emafriedrich
emafriedrich / gist:e372444375d483e4f1161ba9709e0e8f
Created August 17, 2017 19:16
JS Date in dd/mm/yyyy without dependencies and large coding
new Date().toJSON().slice(0,10).split('-').reverse().join('/');
Extract from
https://stackoverflow.com/questions/12409299/how-to-get-current-formatted-date-dd-mm-yyyy-in-javascript-and-append-it-to-an-i
@emafriedrich
emafriedrich / .css
Created August 16, 2017 09:37
Print input like label
@media print {
.no-print {
display: none !important;
}
.form-control
{
border: 0;
padding:0;
overflow:visible;