Skip to content

Instantly share code, notes, and snippets.

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

Victor Bastos victorwpbastos

🏠
Working from home
View GitHub Profile
@victorwpbastos
victorwpbastos / .eslintrc.js
Last active July 26, 2019 19:38
eslint config for vue projects
module.exports = {
root: true,
env: {
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'plugin:vue/recommended',
@victorwpbastos
victorwpbastos / useLoadingHandler.js
Created June 6, 2019 15:23
Vue loading handler component
import Vue from 'vue';
import { VDialog, VCard, VCardText, VProgressLinear } from 'vuetify/lib';
export default async function useLoadingHandler(fn = () => {}, message = 'Processando requisição...') {
let loadingView = new Vue({
components: { VDialog, VCard, VCardText, VProgressLinear },
data() {
return {
show: false
@victorwpbastos
victorwpbastos / useErrorHandler.js
Created June 6, 2019 15:23
Vue error handler component
import Vue from 'vue';
import {
VDialog,
VCard,
VCardText,
VToolbar,
VToolbarTitle,
VSpacer,
VIcon,
VExpansionPanel,
@victorwpbastos
victorwpbastos / .bash_profile
Last active October 1, 2019 18:30
.bash_profile windows 10
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo " [${BRANCH}${STAT}] "
else
echo " "
fi
@victorwpbastos
victorwpbastos / documentViewer.vue
Created June 13, 2019 15:30
Vue document viewer component
<template>
<div>
<v-layout row align-center @click="show = true" style="cursor:pointer;">
<v-flex shrink class="mr-3">
<v-icon>insert_drive_file</v-icon>
</v-flex>
<v-flex>
<div>
<strong>{{ document.tipoAnexo.descricao }}</strong>
</div>
@victorwpbastos
victorwpbastos / platforms.js
Last active July 30, 2019 21:17
canvas platforms
/** @type {HTMLCanvasElement} */
const canvas = document.querySelector('#screen');
const ctx = canvas.getContext('2d');
canvas.width = 400;
canvas.height = 400;
let box = {
width: 25,
height: 25,
@victorwpbastos
victorwpbastos / .hyper.js
Created October 1, 2019 17:34
Hyper config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// 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)
cursorColor: 'rgba(248,28,229,0.8)',
@victorwpbastos
victorwpbastos / settings.json
Created October 4, 2019 16:35
VS Code settings
{
"editor.detectIndentation": false,
"editor.fontFamily": "Fira Code",
"editor.fontWeight": "300",
"editor.fontLigatures": false,
"editor.fontSize": 15,
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.insertSpaces": false,
"editor.lineHeight": 24,
@victorwpbastos
victorwpbastos / javascript.json
Created October 9, 2019 16:02
VS Code snippets
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": ["console.log($1);"],
"description": "Log output to console"
@victorwpbastos
victorwpbastos / flatlist.js
Created May 22, 2020 16:47
Better performance paginated FlatList
import React, { useState, useEffect } from 'react';
import { Text, FlatList, View, TextInput, TouchableOpacity } from 'react-native';
let arr: any[] = [];
for (let i = 1; i <= 100; i++) {
arr.push({ id: i, text: `mensagem bacana #${i}` });
}
arr.reverse();