Skip to content

Instantly share code, notes, and snippets.

View gabrielsaints's full-sized avatar
:octocat:

Gabriel Santos gabrielsaints

:octocat:
View GitHub Profile
@gabrielsaints
gabrielsaints / spPhoneValidation.js
Created March 25, 2019 11:49
joi validation for brazilian cellphone
const Joi = require('joi');
const schema = Joi.object().keys({
phone: Joi.string().regex(/^[0][1-9]{2}(?:[1-9]|9[1-9])[0-9]{3}[0-9]{4}$/).required(),
});
const Joi = require('joi');
const schema = Joi.object().keys({
cpf: Joi.string().regex(([0-9]{3}[.]){2}([0-9]){3}-([0-9]){2}),
});
import * as Joi from 'joi';
const val = Joi.string().regex(/[0-5][0-9]\:[0-5][0-9]\:[0-5][0-9]$/);
@gabrielsaints
gabrielsaints / .hyper.js
Last active June 4, 2019 16:19
hyper with git bash styled
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
fontFamily: 'Fira Code',
// 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
async asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
<?php
$vehicle = array("b"=>"Bus","t"=>"Truck");
print_r(array_change_key_case($vehicle, CASE_UPPER));
?>
/*
OUTPUT
Array
(
[B] => Bus
@gabrielsaints
gabrielsaints / cep.js
Created July 2, 2019 19:21
Validador de CEP por regex
/([0-9]{5}[-])([0-9]){3}$/.test('17055-175')
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/gabriel/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#include <stdio.h>
/**
* Sequência de Fibonacci otimizada com Inline Assembly
*/
int fib(int n)
{
register int r = 0;
__asm__(
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/gabriel/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes