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 / gist:f380eec94b67fcc7b5c993d96469b670
Created June 23, 2017 16:23
Replace images src with erb <%= image_tag(src) %> in sublime text
Search all images paths on file
\/[\w:-]*\.(png|jpg?e)
replace with
<%=image_path('${0}')%>
ej:
@emafriedrich
emafriedrich / html
Created July 12, 2017 19:55
Break words on overflow on new line
overflow-wrap:break-word;white-space: pre-line;
scp -i mykey.pem somefile.txt [email protected]:/
@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;
@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 / 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 / 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 / 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 / .env
Last active August 25, 2020 20:46
env node module. Typescript implementation
MY_ENV_VAR=some-value
@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