Skip to content

Instantly share code, notes, and snippets.

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

Wharley wharley

🏠
Working from home
View GitHub Profile
const checkImageSize = (imageRealWidth, imageRealHeight, minImageSize) => {
return imageRealWidth <= minImageSize ||
imageRealHeight <= minImageSize ||
imageRealWidth < imageWidth ||
imageRealHeight < imageHeight
}
if (checkImageSize(imageRealWidth, imageRealHeight, minImageSize)) {
this.setState({ imageHideZoomIcon: true })
import ComingSoon from './ComingSoon.vue';
/* CUSTOMER */
import Customer from './customer/Customer.vue';
import CustomerList from './customer/CustomerList.vue';
export const views = {
ComingSoon,
/* CUSTOMER */
Customer,
CustomerList,
import Vue from 'vue';
import Router from 'vue-router';
import Main from './views/Main.vue';
Vue.use(Router);
export default new Router({
mode: 'history',
routes: [
{
mapRoutes = [
{
link: 'customer',
name: 'Customer',
routes: [
{
link: 'customer',
name: 'Customer',
routes: [
{
<template>
<transition>
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</transition>
</template>
@wharley
wharley / aws-s3.js
Last active January 26, 2018 12:26
upload
'use strict'
const AWS = require('aws-sdk')
const env = require('../../.env')
const formidable = require('formidable')
const fs = require('fs')
const sendErrorsFromDB = (res, dbErros) => {
const errors = []
_.forIn(dbErros.errors, error => errors.push(error.message))
return res.status(400).json({ errors })
@wharley
wharley / locals.js
Last active December 30, 2017 17:10
Resource.after('get', (req, res, next) => {
const tmp = res.locals.bundle.title // Permita trocar os campos do título e do ano
res.locals.bundle.title = res.locals.bundle.year
res.locals.bundle.year = tmp
next() // Não se esqueça de ligar para a próxima!
})
Resource.after('recommend', do_something) // Executa após todos os verbos HTTP
Resource.route('moreinfo', {
detail: true,
handler: (req, res, next) => {
// req.params.id holds the resource's id
res.send("I'm at /resources/:id/moreinfo!")
}
})
Resource.before('post', hash_password).before('put', hash_password)
function hash_password(req, res, next) {
req.body.password = hash(req.body.password)
next()
}