Skip to content

Instantly share code, notes, and snippets.

View wilcorrea's full-sized avatar
🚀
// TODO: be life good

William Correa wilcorrea

🚀
// TODO: be life good
View GitHub Profile
@snowyu
snowyu / ts-quasar-cli.md
Created September 8, 2018 13:19
Add the typescript supports to quasar framework

Note: This guide applies to the project created by quasar-cli.

First install typescript and ts-loaderpackages in your project.

npm i -D typescript ts-loader

Then modified the quasar.conf.js file in your project:

@paolocarrasco
paolocarrasco / README.md
Last active April 18, 2024 23:49
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

function formatTime (timeInMs) {
let date = new Date(timeInMs)
// ${date.getDate()}/${date.getMonth()}/${date.getFullYear()}
return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`
}
function log (type, ...args) {
if (this.$options.debug) {
console[type](`%c[${this.$_id}]${formatTime(Date.now())}>> `,
`background:${type === 'log' ? '#384A5E' : type === 'warn' ? '#F1BF39' : '#FF5370'}; padding: 3px; border-radius: 3px; color: #fff`,
@luiguild
luiguild / logger.js
Last active November 16, 2018 18:03
Simple logger module and VuePlugin that check NODE_ENV to show console.log()
const prefix = process.env.PREFIX
const nodeEnv = process.env.NODE_ENV
let logCounter = 0
let errorCounter = 0
let fatalCounter = 0
let warnCounter = 0
export const vLogger = {
install (Vue, options) {
@IgorDePaula
IgorDePaula / parse_yaml.sh
Created June 14, 2018 20:27 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@almino
almino / human-name-shortcode.php
Last active June 14, 2018 19:17
WordPress human name ucwords shortcode (apply correct cases for human names)
<?php
# Include this file in your functions.php
add_shortcode('human-name', 'human_name');
add_shortcode('human_name', 'human_name');
add_shortcode('name', 'human_name');
function human_name($atts, $content = null) {
return HumanName::parse($content);
@lfalmeida
lfalmeida / post-receive.sh
Last active October 21, 2023 17:33
Hook post receive com push options
#!/bin/sh
# ---- Config
ENV_NAME="Homologação"
TAG_SUFFIX="homolog"
PROJECT_NAME="Scania Journey Event"
PROJECT_PATH_HOST="/home/lfalmeida/Projects/GitHooks/prod/"
PROJECT_PATH_DOCKER="/src/projeto"
SLACK_WEBHOOK=""
ENABLE_SLACK_POST=0
#!/usr/bin/env bash
V_DIR_SQL="/home/sysadmin/data"
V_DIR_BACKUP="/home/sysadmin/backup"
V_HOST="localhost"
V_DATABASE="database"
V_USER="root"
V_PASSWORD="root"
  • 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, (
@jhorlima
jhorlima / DiggStylePagination.php
Last active March 20, 2018 13:10
Digg Style Pagination - Bootstrap PHP
<?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 = []) {