Skip to content

Instantly share code, notes, and snippets.

View gabrielsaints's full-sized avatar
:octocat:

Gabriel Santos gabrielsaints

:octocat:
View GitHub Profile
async asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
@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)
import * as Joi from 'joi';
const val = Joi.string().regex(/[0-5][0-9]\:[0-5][0-9]\:[0-5][0-9]$/);
const Joi = require('joi');
const schema = Joi.object().keys({
cpf: Joi.string().regex(([0-9]{3}[.]){2}([0-9]){3}-([0-9]){2}),
});
@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(),
});
DROP FUNCTION IF EXISTS GetTableContent(INTEGER);
DROP TABLE IF EXISTS registro;
DROP TABLE IF EXISTS permite_cena;
DROP TABLE IF EXISTS agendamento;
DROP TABLE IF EXISTS rotina;
DROP TABLE IF EXISTS cena;
DROP TABLE IF EXISTS permissao;
DROP TABLE IF EXISTS alerta;
DROP TABLE IF EXISTS controle;
DROP TABLE IF EXISTS ambiente;
@gabrielsaints
gabrielsaints / houzion.ino
Created October 4, 2018 00:59
arduino program
//int devs[] = {2, 3, 5, 6, 9, 10, 4};
int devs[] = {0, 6, 10, 9, 3, 5, 4, 0, 2};
int count = (sizeof(devs) / sizeof(int));
#include "DHT.h"
int DHTPIN = 11;
int DHTTYPE = DHT22;
//int devs[] = {2, 3, 5, 6, 9, 10, 4};
int devs[] = {0, 6, 10, 9, 3, 5, 4, 0, 2};
int count = (sizeof(devs) / sizeof(int));
#include "DHT.h"
int DHTPIN = 11;
int DHTTYPE = DHT22;
INSERT INTO nivel_acesso VALUES(DEFAULT, 'Administrador');
INSERT INTO nivel_acesso VALUES(DEFAULT, 'Moderador');
INSERT INTO nivel_acesso VALUES(DEFAULT, 'Usuário');
INSERT INTO nivel_acesso VALUES(DEFAULT, 'Visitante');
INSERT INTO familia VALUES(DEFAULT, 'Alunos TCC', 'CTI - "Profº Isaac Portal Roldán"');
INSERT INTO familia VALUES(DEFAULT, 'Santos', 'Residência Bauru - Jd. Bela Vista');
INSERT INTO grupo VALUES(DEFAULT, 1, 'Admin');
INSERT INTO grupo VALUES(DEFAULT, 1, 'Gabriel');
INSERT INTO grupo VALUES(DEFAULT, 1, 'Gisele');
INSERT INTO grupo VALUES(DEFAULT, 1, 'Caio');
@gabrielsaints
gabrielsaints / PostgreSQL.java
Created August 17, 2018 00:06
PostgreSQL class for Java
import java.sql.*;
import javax.swing.*;
import java.util.*;
public class PostgreSQL{
private int _code;
private String _type;
private String[] database = {"postgres", "sqladmin", "org.postgresql.Driver", "jdbc:postgresql://localhost:5432/banco73b2017"};
private Connection _pgsql;