Skip to content

Instantly share code, notes, and snippets.

View LeandroLS's full-sized avatar
🎯
Focusing

Leandro L. LeandroLS

🎯
Focusing
View GitHub Profile
@LeandroLS
LeandroLS / exemplo.php
Created September 6, 2017 20:51
exemplo
public function listarContasReceber( $dados = null ){
if(!empty($dados['classTipoDespesa'])){
$query[] = "cn.class_ctd_id = {$dados['classTipoDespesa']}";
}
/*
if(isset($dados['centroDeCusto'])){
if(is_array($dados['centroDeCusto'])){
@LeandroLS
LeandroLS / templatestringwithmap.js
Last active September 4, 2017 19:08
Template String com .map dentro
success: (retorno) => {
let tr = `
<table class='table'>
<thead>
<th></th>
<th>Descrição</th>
<th>Tamanho</th>
<th>Modelo</th>
<th>Tecido</th>
<th>Madeira</th>
@LeandroLS
LeandroLS / template-string-js.js
Last active April 21, 2018 14:22
Template String em js
let nome = "Leandro";
let sobrenome = "Lima";
//concatenação de string sem template string.
console.log("O " + nome + " " + sobrenome + " é um programador.");
//resultado: O Leandro Lima é um programador.
//com template string ficaria assim:
console.log(`O ${nome} ${sobrenome} é um programador`);
//resultado: O Leandro Lima é um programador.
@LeandroLS
LeandroLS / arrowfunction1.js
Last active September 2, 2017 22:46
arrow function js
//1ª maneira
listaDeNomes.forEach((item) => {
console.log(item);
})
//2ª maneira
listaDeNomes.forEach(item => console.log(item));
@LeandroLS
LeandroLS / arrowfunction.js
Created September 2, 2017 22:31
array js
let listaDeNomes = ['Flávio', 'Rogers', 'Júlia'];
listaDeNomes.forEach(function(item){
console.log(item);
});
@LeandroLS
LeandroLS / formattribute.html
Last active August 21, 2017 22:54
Submit button out of a form
<form id="meuform" method="post" action="algumarquivo.php">
<input type="text" name="nome" />
</form>
<input type="submit" form="meuform" />
@LeandroLS
LeandroLS / group-concat-nulls-2.sql
Created July 17, 2017 23:40
Post group-concat-nulls
SELECT
GROUP_CONCAT(IFNULL(nome_frutas, 'NULL'))
FROM
frutas
@LeandroLS
LeandroLS / group-concat-nullos.sql
Last active July 17, 2017 22:52
Post GROUP_CONCAT com valores nullos
CREATE TABLE `frutas` (
`nome_frutas` varchar(50) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
)
INSERT INTO `frutas` (`nome_frutas`) VALUES ('maçã');
INSERT INTO `frutas` (`nome_frutas`) VALUES (NULL);
INSERT INTO `frutas` (`nome_frutas`) VALUES ('banana');
INSERT INTO `frutas` (`nome_frutas`) VALUES (NULL);
@LeandroLS
LeandroLS / input-mesmo-nome2.html
Created July 6, 2017 00:16
Post inputs mesmo nome
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Teste</title>
<script src="jquery-3.2.1.js"></script>
</head>
<body>
<form id='form' action="teste.php" method="POST">
<input type="text" name="nome[]" value='nome1'>
@LeandroLS
LeandroLS / input-mesmo-nome.html
Last active July 6, 2017 00:00
Post inputs mesmo nome
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Teste</title>
<script src="jquery-3.2.1.js"></script>
</head>
<body>
<form id='form' action="teste.php" method="POST">
<input type="text" name="nome" value='nome1'>