Skip to content

Instantly share code, notes, and snippets.

View edgvi10's full-sized avatar

Eduardo Vieira edgvi10

  • Amora Sistemas, Link Informática RJ
  • Rio de Janeiro
View GitHub Profile
@edgvi10
edgvi10 / base64url.php
Last active October 5, 2020 06:46
PHP function to convert any string to base64 url friendly
<?php
function base64url_encode($data)
{
$base64 = base64_encode($data);
if ($base64 === false) return false;
$url = strtr($base64, '+/', '-_');
@edgvi10
edgvi10 / slugify.js
Last active August 25, 2020 17:39 — forked from codeguy/slugify.js
Create slug from string in Javascript
String.prototype.slugify = function (separator = "-") {
return this
.toString()
.normalize('NFD') // split an accented letter in the base letter and the acent
.replace(/[\u0300-\u036f]/g, '') // remove all previously split accents
.toLowerCase()
.trim()
.replace(/[^a-z0-9 ]/g, '') // remove all chars not letters, numbers and spaces (to be replaced)
.replace(/\s+/g, separator);
};
@edgvi10
edgvi10 / Helpers.php
Last active October 2, 2020 17:34
Some PHP Functions
<?php
namespace EDGVI10;
class Helpers
{
public static function getEnv($filepath)
{
$env = file_get_contents($filepath);
@edgvi10
edgvi10 / DBWalker.php
Last active October 13, 2021 18:42
A little simple class to Walk into MySQL database using Array structure
<?php
namespace EDGVI10;
class DBWalker
{
protected $host;
protected $user;
protected $pass;
protected $base;
{
"uuid": "123456-123456-123456-123456-123456",
"name": "Eduardo Gomes Vieira",
"nickname": "edgvi10",
"role": "developer",
"key": "value"
}
@edgvi10
edgvi10 / QueryBuilder.php
Created January 22, 2021 23:54
Funções PHP para converter Arrays em SQL
<?php
function parseValue($value)
{
$functions = ["UUID()", "NOW()", "NULL"];
$useapostrofe = true;
if ($useapostrofe) $useapostrofe = (array_search($value, $functions) === false) ? true : false;
if ($useapostrofe) $useapostrofe = (hexdec(intval($value)) == hexdec($value)) ? false : true;
if ($useapostrofe) $useapostrofe = (hexdec(floatval($value)) == hexdec($value)) ? false : true;
@edgvi10
edgvi10 / curriculo.md
Last active October 25, 2023 19:12
Um resumo sobre meu perfil profissional e habilidades.

Eduardo Vieira

Desenvolvedor FullStack / +55 21 97378-1275 / edgvi10@gmail.com

Palavras chave: Desenvolvedor JavaScript, NodeJS, ReactJS, NextJS, PWA, React Native, PHP, MySQL, HTML5, CSS3. Desenvolvimento de sites, sistemas de gestão, aplicativos híbridos e nativos. Arquitetura de sistemas, design e diagramação.

Apresentação

INSTALL AND CONFIGURE LAMP

Install Apache and cURL.

sudo apt update

sudo apt install apache2 curl

Configure Apache Firewall

@edgvi10
edgvi10 / object-search.js
Last active March 7, 2021 10:18
Javascript Object Search
Array.prototype.search = function (keyword, options) {
const results = [];
if (options === undefined) options = {};
this.map(item => {
if (typeof item === "object") {
var keys = Object.keys(item);
if ("fields" in options)
keys = options["fields"];
@edgvi10
edgvi10 / db.js
Last active October 26, 2021 22:12
Arquivo inicial de configuração e manipulação do banco de dados MySQL para Next.JS
import mysql from 'serverless-mysql';
const db = mysql({
config: {
host: process.env.MYSQL_HOST,
port: process.env.MYSQL_PORT ?? 3306,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASS,
database: process.env.MYSQL_BASE,
}