Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Renan Monteiro RenanMonteiroS

🏠
Working from home
View GitHub Profile
View gist:2571fb2dc72a60e4c296ecbed070c9e1
const number = 12345.67
currency = number.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' })
console.log(currency) // "R$ 12.345,67"
View Update images Docker
docker images | grep -v REPOSITORY | awk '{printf $1; printf ":"; print $2}' | xargs -L1 docker pull
View URL friendly on Nginx
location / {
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;
try_files $uri/index.html $uri.html $uri/ $uri =404;
}
View Sass mixins for images retina
@import "variables";
@mixin retina-image($image, $type:png, $size:100%, $position: center center) {
background-image: url($path-dist-images + $image + '.' + $type);
background-size: $size;
background-position: $position;
@media #{$retina-2x} {
background-image: url($path-dist-images + $image + '@2x.' + $type);
}
View Docker map local folder on container
docker run -it --name container-name -p 8000:80 -v "$PWD":/container-path image
docker run -it --name ila-programacao --link ila-programacao-mysql:mysql -p 8091:80 -v "$PWD":/var/www/html/wp-content/plugins/ila-programacao -d wordpress
View Up PHP upload size files
# usr/local/etc/php/conf.d/
memory_limit = 50M
post_max_size = 8M
file_uploads = On
upload_max_filesize = 8M
View Hyper terminal Ubuntu theme
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 17,
// font family with optional fallbacks
View Virtual host on linux with SSH
<VirtualHost *:80>
ServerName site.com
ServerAlias site.com www.site.com *.site.com
DocumentRoot /var/www/
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
View Git live deploy
mkdir website.git && cd website.git
git init --bare
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/meusite.com.br git checkout -f
chmod +x hooks/post-receive
git remote add live ssh://meusite.com.br/home/thiagobelem/website.git
View Create user in Linux MySQL
CREATE USER 'novousuario'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE database;
GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost';
GRANT ALL PRIVILEGES ON database.* TO 'user'@'0.0.0.0' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
You can’t perform that action at this time.