Skip to content

Instantly share code, notes, and snippets.

View viniceosm's full-sized avatar

Vinícius Miiller Rebello viniceosm

View GitHub Profile
@viniceosm
viniceosm / possibilidadesIf.js
Last active February 16, 2018 16:40
Montar as possibilidades através de if/else
class PossibilidadesIf {
constructor() {
this.arrSe = [];
this.syntaxesComParametro = ['se', 'senao', 'log', 'getMensagem'];
this.syntaxesSemParametro = ['fimse'];
}
se(str) {
this.arrSe.push(str);
}
senao(str) {
@viniceosm
viniceosm / zypper.md
Last active March 15, 2018 12:31
Comandos do Zypper, o gerenciador de pacotes.

Comandos

Aplicar todos os patches necessários ao sistema sem solicitar confirmação de nenhuma licença

zypper patch --auto-agree-with-licenses

Testar comandos zypper

zypper remove --dry-run MozillaFirefox
@viniceosm
viniceosm / git-change-commit-messages.md
Created March 19, 2018 10:31 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@viniceosm
viniceosm / vkek.js
Last active March 21, 2018 19:54
vkek - manipular o DOM
function Vkek(){
// this.el será o elemento buscado apartir do Vkek.$()
}
Vkek.prototype = {
$: function(selector) {
if (typeof selector == 'string') {
this.el = (document.querySelectorAll(selector).length > 1) ? document.querySelectorAll(selector) : document.querySelector(selector);
} else {
this.el = selector;
@viniceosm
viniceosm / promiseCont.js
Created April 6, 2018 12:26
Exemplo de promise com async function
function promiseCont(cont = 0){
return new Promise((resolve, reject) => {
resolve(cont + 1);
})
}
async function contadorSincrono() {
try {
r = await promiseCont();
console.log(r);
function Recjs(usuarios, itens, interacao) {
Object.assign(this, { usuarios, itens, interacao });
}
Recjs.prototype.getAllUsuarios = function() {
return this.usuarios;
}
Recjs.prototype.recomendarPara = function(usuario) {
var filtradoApartirAmigos = filtrarPorAmigos(usuario); //interacao filtrada
@viniceosm
viniceosm / listaSimplesEncadeada.c
Last active June 3, 2018 20:00
Inserir no inicio, no final, imprimir lista, remover da lista ou esvaziar lista
#include <stdio.h>
#include <locale.h>
//Definindo da lista simplesmente encadeada
typedef struct lista {
int num;
struct lista *prox;
} LISTA;
@viniceosm
viniceosm / splitInterval.js
Created June 27, 2018 17:10
split string passing start and end
String.prototype.splitInterval = function (delimiter, start = 0, end) {
return this.split(delimiter).filter(function(_, i) {
if (end === undefined) {
return i >= start;
}
return i >= start && i <= end;
});
}
var str = '1171_1_False_False';
@viniceosm
viniceosm / umustache.html
Last active June 27, 2018 17:15
using mustache.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Using mustache</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
@viniceosm
viniceosm / regexIncludeExclude.md
Last active June 28, 2018 03:33
regex include and exclude

two pattern

let validate = (str) => {
	let required = /(\$.*\$)/i; // Regex include - tem que te-lo
	let blocked = /(\$\()/i; // Regex exclude - não tem que te-lo
	return required.test(str) && !blocked.test(str);
}

one pattern