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 / inheritance.js
Last active August 10, 2018 10:22
Herança ES5 vs ES6 | super/extends
//---- ES6
class Pessoa {
constructor(nome) {
this._nome = nome;
}
falar(mensagem) {
console.log(`${this._nome}: ${mensagem}`);
}
@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 / 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 / mudarBackgroundWebWhatsapp.md
Last active July 2, 2018 02:43
mudar background do web whatsapp

pode ser usado como um bookmark para executar sempre quando entrar no https://web.whatsapp.com/

se trocar de contato vai sair kk print1

javascript: (function () {
    var img = 'https://i.pinimg.com/originals/2b/51/d4/2b51d41600db9a0b0aca819d248918c4.jpg';
    
 document.querySelector('#main&gt;.YUoyu').style.backgroundImage = 'url(' + img + ')';
@viniceosm
viniceosm / config.md
Created July 9, 2018 12:25
abrir diff com vscode

.git/config

[diff]
    tool = vscode
[difftool]
    prompt = false
[difftool "vscode"]
    cmd = "/usr/share/code/bin/code" "$LOCAL" "$REMOTE" --diff --wait
    trustExitCode = false
@viniceosm
viniceosm / editDatable.html
Created July 23, 2018 16:13
example for edit datable
<!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>Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css">
@viniceosm
viniceosm / concatMongoose.md
Last active July 31, 2018 11:35
function to search with mongoose and concatenate results

concatRes(addAttrReference, fnsPesquisa [, callback])

param type description
addAttrReference boolean true se quer que adicione um atributo dizendo de que model ela é
fnsPesquisa array array de objeto com controller e query
callback função opcional, função de retorno quando terminar a concatenação
var cFis = {
@viniceosm
viniceosm / orderByArrayOfObjects.js
Created August 1, 2018 17:37
order by [nome or idade] array of objects js
let pessoas = [
{
nome: 'Naiara',
idade: 18
},
{
nome: 'Alice',
idade: 24
},
{
@viniceosm
viniceosm / timeline-js.md
Last active November 1, 2018 14:53
editions and years of ecma

New editions (starting with 2015) will be named ES followed by the year of release.

editions year
ES1: June 1997 
ES2: June 1998
ES3: Dec. 1999 
ES4: October 2007
ES5: Dec. 2009
@viniceosm
viniceosm / array-options-select.html
Last active August 8, 2018 01:30
push in array the values of select
<style>
.fl {
float: left;
margin: 2px 10px;
}
#escolhidos {
min-width: 300px;
min-height: 100px;
border: 1px solid black;
padding: 5px;