- Qual é o problema com a arquitetura das aplicações atuais?
- Um projeto, na maioria das vezes, é começado pequeno, por uma pessoa e sem saber como será a sua evolução.
- Pode acontecer de novas pessoas entrarem no projeto e não conhecerem as regras que guiam a aplicação.
- Um dos princípios de organização é o MVC ou Model View Controller.
- No MVC a regra de negócio fica na Model, os templates na View e a mediação é feita pelo Controller.
- O MVC não é suficiente para manter uma aplicação com código compreensível durante muito tempo.
- A ideia de utilizar MVC veio de frameworks e a maioria das aplicações estão acopladas de alguma maneira a frameworks.
- Um projeto é iniciado normalmente (1) escolhendo um framework, (2) instalando um esqueleto, (3) removendo códigos de demonstração, (
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<nav aria-label="Page navigation"> | |
<ul class="pagination"> | |
<li :class="{ 'disabled' : currentPage <= 1 }"> | |
<a href="#" @click.prevent="pageChanged(currentPage - 1)" aria-label="Previous"> | |
<span aria-hidden="true">«</span> | |
</a> | |
</li> | |
<template v-if="needLeftDots"> | |
<li v-for="n in 2" :key="n" :class="activePage(n)"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const requestQuery = request => { | |
const param = request.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]") | |
const regex = new RegExp("[\\?&]" + param + "=([^&#]*)") | |
const results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")) | |
} | |
// caso de uso |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { box-sizing: border-box; } | |
html, body { min-height: 100vh; margin: 0; } | |
div, | |
html, | |
body, | |
nav, | |
header, | |
hgroup, | |
footer, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="container-fluid"> | |
<form> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="form-group" v-bind:class="{ 'has-error': $v.form.name.$error }"> | |
<label class="control-label" for="name">Nome completo* :</label> | |
<input type="text" v-model="form.name" v-on:input="$v.form.name.$touch" v-on:blur="$v.form.name.$touch" | |
v-bind:class="{error: $v.form.name.$error, valid: $v.form.name.$dirty && !$v.form.name.$invalid}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint" | |
if [[ "$STAGED_FILES" = "" ]]; then | |
exit 0 | |
fi | |
PASS=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function pis (PIS) { | |
if (PIS === '' || PIS === null) { | |
return false | |
} | |
if (String(PIS).match(/(\d)\1{9}/g)) { | |
return false | |
} | |
PIS = String(PIS).replace(/\D+/g, '') | |
const pesos = [3, 2, 9, 8, 7, 6, 5, 4, 3, 2] | |
let soma = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class DiggStylePagination { | |
/** | |
* DiggStylePagination::create(5, 1, 15, function($page){ return 'http://localhost/' . $page; }) | |
* | |
* | |
*/ | |
public final static function create($currentPage, $firstPage, $totalPages, \Closure $url, $adjacents = 1, array $classes = []) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import c3 from 'c3' | |
import { debounce, cloneDeep, defaultsDeep } from 'lodash' | |
export default { | |
name: 'c3-chart', | |
props: { | |
config: { | |
type: Object, | |
default: () => ({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} id | |
* @param {string} form | |
*/ | |
function Gerador (id, form) | |
{ | |
this.__id = id | |
this.__form = form || 'formUsuario' | |
/** |