Skip to content

Instantly share code, notes, and snippets.

View brunosousadev's full-sized avatar
🏠
Working from home

Bruno Sousa brunosousadev

🏠
Working from home
View GitHub Profile
@fhugoduarte
fhugoduarte / useValidateForm.ts
Created September 26, 2020 14:08
A validation hook to unform 2.0
import { FormHandles, SubmitHandler } from '@unform/core';
import { RefObject, useCallback, useState } from 'react';
import { ObjectSchema, ValidationError } from 'yup';
type Hook = <T>(
args: Props<T>,
) => {
validating: boolean;
handleSubmit: SubmitHandler<T>;
};
@starfeeling
starfeeling / sequelize.js
Last active April 15, 2020 18:13
async sequelize transaction
const findUser = await models.Users.findOne({
where: {
ds_id: user.id
}
})
const transaction = await models.sequelize.transaction()
try {
// Create
await models.Users.create(data, transaction)
@lucasscariot
lucasscariot / model-user.js
Last active June 22, 2023 17:08
Composite Primary Key in Sequelize
/*
* Migration
*/
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Users', {
firstName: {
type: Sequelize.STRING
},
@TooTallNate
TooTallNate / http-error.js
Created August 3, 2016 00:48
HTTPError class for JavaScript HTTP errors
import { format } from 'url';
import { STATUS_CODES } from 'http';
import uppercamelcase from 'uppercamelcase';
class HTTPError extends Error {
constructor(code, message, extras) {
super(message || STATUS_CODES[code]);
if (arguments.length >= 3 && extras) {
Object.assign(this, extras);
}
@rxaviers
rxaviers / gist:7360908
Last active July 24, 2024 17:43
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: