Skip to content

Instantly share code, notes, and snippets.

View kaluabentes's full-sized avatar
💭
Solving problems, one at a time.

Kaluã Bentes kaluabentes

💭
Solving problems, one at a time.
View GitHub Profile
@kaluabentes
kaluabentes / php7_build_ubuntu.sh
Created April 4, 2016 03:22 — forked from m1st0/php_build_ubuntu.sh
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. ##
# http://www.zimuel.it/install-php-7/
# http://www.hashbangcode.com/blog/compiling-and-installing-php7-ubuntu
## Setup Ubuntu 15.04/15.10 ##
# Other dependencies for PHP 7. Add any missing ones from configure script
# complaints, plus some LAMP needs too.
#!/bin/bash
echo "--------- Updating repository ---------"
sudo apt-get -y update
echo "--------- Installing Apache2 ---------"
sudo apt-get -y install apache2
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory /var/www>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/var/www", :mount_mode => ['dmode=777', 'fmode=666']
config.vm.provision :shell, path: "provision.sh"
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
@kaluabentes
kaluabentes / git-deployment.md
Created September 6, 2017 14:18 — forked from noelboss/git-deployment.md
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 github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

@kaluabentes
kaluabentes / phoneValidate_BR.php
Created April 7, 2020 22:00 — 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.
<?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
kaluabentes / settings.json
Last active June 26, 2020 18:39
VSCode configuration
{
"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
kaluabentes / stream-file-to-response.js
Created July 27, 2020 23:35
Stream file from source to response in Node.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);
{
"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,