Skip to content

Instantly share code, notes, and snippets.

Israel Ériston israeleriston

Block or report user

Report or block israeleriston

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@israeleriston
israeleriston / schema.js
Created May 17, 2018
Simple scheme using fastify
View schema.js
const schema = {
response: {
'2xx': {
type: 'object',
properties: {
value: { type: 'string' },
otherValue: { type: 'boolean' }
}
},
@israeleriston
israeleriston / route.js
Last active May 17, 2018
Simple example the using fastify with default response
View route.js
'use strict'
const fastify = require('fastify')()
const handler = (req, reply) => {
reply.send({ hello: 'world' })
}
const route = {
method: 'GET',
@israeleriston
israeleriston / Route.js
Created May 5, 2018
Auto loading the routes
View Route.js
const middleware = require('./Middleware')
const create = handler => ({
name: 'user-create',
path: '/user',
version: '1.0.1',
method: 'post',
handler: () => handler
})
View input-validation.js
test('Inject GET request fastify', t => {
const fastify = Fastify()
const payload = {
hello: 'world'
}
fastify.get('/', (req, reply) => {
reply.send(payload)
})
@israeleriston
israeleriston / module.js
Last active Apr 26, 2018
Commits and Mutations examples vuex
View module.js
import service from './service-http'
const SET_USER = 'user/SET_USER'
const state = {
user: ''
}
const actions = {
@israeleriston
israeleriston / state.js
Created Apr 26, 2018
Example of pattern State Manager
View state.js
class Car {
constructor(count, currentState) {
this.count = 0
this.currentState = new Red(this)
}
change (state) {
if (this.count++ >= 10) {
return
}
@israeleriston
israeleriston / file.vue
Created Apr 17, 2018
footer vuejs componenter
View file.vue
<template>
<section class="footer-accordeon" :class="{ '-open': open }">
<header class="header" @click="open = !open">
<h4 class="title">{{ title }}</h4>
<batista-icon class="icon" icon="arrow_down" size="9" />
</header>
<div class="content" :style="contentStyle">
<slot />
</div>
</section>
@israeleriston
israeleriston / file.js
Created Apr 14, 2018
donwload imagens of storage firebase
View file.js
const img = ['images/education/bauru/elementaryI/carousel02', 'images/education/bauru/elementaryI/carousel01' ]
// example should imagens path
this.grade.images.forEach((img) => {
this.$fireApp.storage().ref().child(img).getDownloadURL().then((url) => {
this.images.push(url)
})
})
@israeleriston
israeleriston / index.js
Created Apr 13, 2018
Function cloud send e-mail using firebase
View index.js
var user = event.data.val()
var { age, email, grade, name, phone, text, unit } = user
const destination = unit === 'Perdizes' ? 'debora.bueno@batistabrasileiro.com.br' : 'secretariageral@cbbauru.com.br'
const to = project === 'batista-webapp' ? destination : 'contato@guibarscevicius.com.br'
console.log('projeto:', project)
var data = {
@israeleriston
israeleriston / http.js
Created Mar 19, 2018
Axios and Vuejs Integration
View http.js
import axios from 'axios'
export const http = axios.create({
baseURL: process.env.SUA_API
})
export default function install (Vue) {
Object.defineProperty(Vue.prototype, '$http', {
get: () => http
})
You can’t perform that action at this time.