Skip to content

Instantly share code, notes, and snippets.

View dahngeek's full-sized avatar
🖥️
Working on PWAs

Daniel Xutuc dahngeek

🖥️
Working on PWAs
View GitHub Profile
@dahngeek
dahngeek / cors.json
Created September 21, 2019 22:43
ActiveStorage Google cloud Storage. Solution for CORS error, THE ERROR WAS THE FOLLOWING: Error storing "image.png". Status: 0
[
{
"origin": ["*"],
"responseHeader": ["Content-Type", "Content-Md5"],
"method": ["PUT", "GET", "HEAD", "DELETE"],
"maxAgeSeconds": 3600
}
]
@dahngeek
dahngeek / index.js
Created July 31, 2019 21:55
Redireccionar forzando a descargar archivo externo de terceros con express y request
var request = require('request');
const express = require('express');
// ..
app.get('/pdf', (req, res) => {
// ...
request(urldescarga).on("response", remoteRes => {
// You can add/remove/modify headers here
remoteRes.headers["content-disposition"] = "attachment; filename=archivodescargado.pdf";
}).pipe(res);

Traducción

t('g.edit')

Helpers

Enlaces solo si no es la pagina actual:

@dahngeek
dahngeek / ffmpeg-rotate.txt
Created April 17, 2019 02:23
Rotate a video with ffmpeg
ffmpeg -i numero1-renacidos.mp4 -vf "transpose=1" numero1-renacidos-roteted.mp4

Cheatsheet para Ruby on Rails 5 alt text

Hoja de trucos de Ruby on Rails 5

Manejo de gemsets

rvm gemset list
rvm gemset use
@dahngeek
dahngeek / most recent from group by.sql
Created February 21, 2019 21:04
Get the most recent row from a group by query.
SELECT `contact_id`, `user_id`, `date_backup`, `first_name`, `last_name`
FROM tbl_contacts WHERE `date_backup` IN (
SELECT MAX(`date_backup`)
FROM tbl_contacts WHERE `user_id`= 1 GROUP BY `contact_id`
)
ORDER BY `contact_id` DESC
const log = new Proxy({}, {
get: (_, colour) => function() {
console.log(`%c ${[].slice.call(arguments).join(' ')}`, `color: ${colour}`)
}
})
// example
log.tomato('I am tomato')
log.chocolate('I am chocolate')
log.cornflowerblue('I am cornflowerblue')
@dahngeek
dahngeek / link.txt
Created June 8, 2018 18:27
Remote console.log
@dahngeek
dahngeek / sitesavailable_default
Created May 29, 2018 19:34
Problema con Croppa
# https://github.com/BKWLD/croppa
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
error_page 404 = /index.php?$query_string;
expires 1M;
access_log off;
add_header Cache-Control "public";
}
@dahngeek
dahngeek / nginx_php_setup.conf
Last active January 17, 2019 00:46
Configuracion para NGINX, DEBIAN 8, PHP. laravel
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name dominio.example.com;
#ojo.. tiene que estar en public.. si es laravel
root /var/www/html/public;
error_log /var/log/nginx/error.log warn;