Skip to content

Instantly share code, notes, and snippets.

View guiliredu's full-sized avatar
🚀
Working

Guilherme Dias Redü guiliredu

🚀
Working
View GitHub Profile
@guiliredu
guiliredu / 0_NestJS-Cheatsheet.md
Last active March 22, 2024 22:16
Nest.js Cheatsheet

Nest.js Cheatsheet

Nest CLI

  • npm i -g @nestjs/cli

Packages

  • yarn add class-validator class-transformer
  • yarn add @nestjs/mapped-types
@guiliredu
guiliredu / facebook-page-invite.js
Last active March 15, 2024 15:33
Facebook - Script to auto invite people who liked a page post do like the page
var buttons;
buttons = document.getElementsByClassName('_42ft');
for (var i = 0; i < buttons.length; i++) {
if(buttons[i].getAttribute('ajaxify') != null){
if(buttons[i].getAttribute('ajaxify').indexOf('invite') != -1){
buttons[i].click();
}
}
}
@guiliredu
guiliredu / feriados-brasileiros-em-php.php
Last active December 27, 2023 13:11
Retorna um array com todos os feriados brasileiros
<?php
function dias_feriados($ano = null)
{
if (empty($ano)) {
$ano = intval(date('Y'));
}
$pascoa = easter_date($ano); // Limite de 1970 ou após 2037 da easter_date PHP consulta http://www.php.net/manual/pt_BR/function.easter-date.php
$dia_pascoa = date('j', $pascoa);
@guiliredu
guiliredu / pagseguro-assinatura.php
Last active August 1, 2023 01:05
Exemplo de pagamento e assinatura pelo PagSeguro com PHP e CURL
<?php
$url = 'https://ws.pagseguro.uol.com.br/v2/pre-approvals/request';
$data['email'] = 'email_vendedor@gmail.com';
$data['token'] = 'TOKEN';
$data['currency'] = 'BRL';
$data['reference'] = $id_cliente;
$data['senderName'] = $cliente['nome'];

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@guiliredu
guiliredu / update-git.sh
Created October 4, 2021 23:03 — forked from YuMS/update-git.sh
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@guiliredu
guiliredu / .editorconfig
Created March 7, 2019 23:25
Editorconfig for PHP PSR-4
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# All PHP files MUST use the Unix LF (linefeed) line ending.
# Code MUST use an indent of 4 spaces, and MUST NOT use tabs for indenting.
# All PHP files MUST end with a single blank line.
# There MUST NOT be trailing whitespace at the end of non-blank lines.
[*]
@guiliredu
guiliredu / Express.md
Last active March 13, 2020 21:09
Express - Node Backend Studies

Express.js

Installing

$ npm install express --save

Hello World

// index.js
@guiliredu
guiliredu / 0-Snippets.md
Last active March 12, 2020 18:08
Docker - Basic Commands / Cheatsheet

Docker Snippets

MongoDB

  • Running: docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:4.0.4
  • Bash: docker exec -it mongodb bash

MySQL

  • Running: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=true -p 3306:3306 -v ~/Projects/Docker/mysql:/var/lib/mysql --name mysql mysql:5.7
@guiliredu
guiliredu / apache-template
Created September 25, 2019 19:16 — forked from lavoiesl/apache-template
Apache VirtualHost Template with variable replacement
<VirtualHost *:80>
ServerAdmin {USER}@cslavoie.com
ServerName {DOMAIN}
ServerAlias www.{DOMAIN}
ServerAlias {USER}.localhost
ServerAlias {USER}.static.cslavoie.com
DocumentRoot {DOC_ROOT}
<Directory {DOC_ROOT}>