Skip to content

Instantly share code, notes, and snippets.

Solving problems, one at a time.

Kaluã Bentes kaluabentes

Solving problems, one at a time.
View GitHub Profile
View vscode-config.json
"workbench.iconTheme": "material-icon-theme",
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.fontFamily": "JetBrains Mono",
"editor.fontWeight": "500",
"terminal.integrated.fontWeight": "500",
"editor.fontSize": 14,
"terminal.integrated.fontSize": 14,
kaluabentes / stream-file-to-response.js
Created Jul 27, 2020
Stream file from source to response in Node.js
View stream-file-to-response.js
const http = require("http");
const fs = require("fs");
export default function Sitemap(req, res) {
const url = `${process.env.NEXT_PUBLIC_API_URL}/sitemap`;
const request = http.get(url, (response) => {
const contentType = response.headers["content-type"];
res.setHeader("Content-Type", contentType);
kaluabentes / settings.json
Last active Jun 26, 2020
VSCode configuration
View settings.json
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.fontFamily": "SF Mono",
"editor.fontWeight": "500",
"terminal.integrated.fontFamily": "SF Mono",
"terminal.integrated.fontWeight": "500",
"workbench.iconTheme": "material-icon-theme",
"javascript.updateImportsOnFileMove.enabled": "never",
"editor.codeActionsOnSave": {
kaluabentes / phoneValidate_BR.php
Created Apr 7, 2020 — forked from boliveirasilva/phoneValidate_BR.php
Regex para validação de telefones (celular ou fixo) no Brasil. A expressão leva em conta o formato internacional/nacional, com ou sem o DDD, de telefones fixos e celulares.
View phoneValidate_BR.php
// A função abaixo demonstra o uso de uma expressão regular que identifica, de forma simples, telefones válidos no Brasil.
// Nenhum DDD iniciado por 0 é aceito, e nenhum número de telefone pode iniciar com 0 ou 1.
// Exemplos válidos: +55 (11) 98888-8888 / 9999-9999 / 21 98888-8888 / 5511988888888
function phoneValidate($phone)
$regex = '/^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$/';
if (preg_match($regex, $phone) == false) {
kaluabentes /
Created Sep 6, 2017 — forked from noelboss/
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like or and pull or export it to a production server. Or you use a service like my to act upon a Web-Hook that's triggered that service.

View .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config| = "ubuntu/xenial64" "private_network", ip: ""
config.vm.synced_folder ".", "/var/www", :mount_mode => ['dmode=777', 'fmode=666']
config.vm.provision :shell, path: ""
View vhost.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory /var/www>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
echo "--------- Updating repository ---------"
sudo apt-get -y update
echo "--------- Installing Apache2 ---------"
sudo apt-get -y install apache2
kaluabentes /
Created Apr 4, 2016 — forked from m1st0/
Compiling PHP 7 on Ubuntu 15.04 with Various Supported Modules
#! /bin/bash
## PHP 7 Initial Compile ##
## Some help from the various places like these. ##
## Setup Ubuntu 15.04/15.10 ##
# Other dependencies for PHP 7. Add any missing ones from configure script
# complaints, plus some LAMP needs too.