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
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <stdlib.h> | |
int main() { | |
//A = valor do litro de Alcool | |
//G = valor do litro de Gasolina | |
//D = valor do litro de Diesel |
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
<div class="btns"> | |
<button>BTN 1</button> | |
<button>BTN 2</button> | |
<button>BTN 3</button> | |
<button>BTN 4</button> | |
</div> | |
<script> | |
$(document).ready(function(){ | |
$(".btns button").click(function(){ | |
$(".btns button").css("background-color", "rgb(20, 115, 153)"); //coloca todos na mesma cor |
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
using System; | |
namespace MailCleaner | |
{ | |
using Pop3; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; |
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 | |
function myCount($array){ | |
global $chamadas; | |
if($chamadas == 0) | |
echo "<i>Primeira chamada da função <b>myCount</b>!</i> <br />"; | |
else | |
echo "Chamei a função <b>myCount</b> de novo! <b>Isso é um problema</b>...<br />"; | |
$chamadas++; | |
return count($array); |
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 | |
$urlX = "https://jsonplaceholder.typicode.com/todos/"; //URL1 que retorna X | |
$urlY = "https://jsonplaceholder.typicode.com/users"; //URL2 que retorna Y | |
$multiHandler = curl_multi_init(); | |
//URL1 - X | |
$curlX = curl_init(); | |
curl_setopt($curlX, CURLOPT_URL, $urlX); | |
curl_setopt($curlX, CURLOPT_HEADER, 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
function Custo(valor, nome){ | |
this.valor = valor; | |
this.nome = nome; | |
} | |
Custo.prototype.juros = function(juros) { | |
//isso tá errado, pq isso não é juros né... | |
this.valor += juros; | |
return this.valor; | |
} |
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
function parseCSV(data, separator) { | |
const lines = data.split(/\r\n|\n/); | |
const header = lines[0].split(separator); | |
const result = []; | |
for(let i = 1; i < lines.length; i++){ | |
const fields = lines[i].split(separator); | |
const line = {}; | |
for(let k = 0; k < header.length; k++) | |
line[header[k]] = fields[k]; |
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 | |
$texto = "sua string de 1500 caracteres"; | |
$limite = 5; //troca para 500, fiz 5 só pra teste. | |
$banner = "<img src='https://via.placeholder.com/50' alt='teste'/>"; //troca pelo seu código de banner. | |
$result = ""; | |
$splits = strlen($texto) % $limite; | |
for($i=0;$i<$splits;$i++) | |
$result .= substr($texto, $i * $limite, $limite) . $banner; | |
echo $result; |
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 | |
session_start(); | |
//seu código de verificar usuário... | |
//... | |
//... | |
//... | |
$_SESSION['email'] = $code; | |
$_SESSION['nome'] = $nome; |
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
public static string Parse(this DbEntityValidationException e) | |
{ | |
var builder = new StringBuilder(); | |
foreach (var eve in e.EntityValidationErrors) | |
{ | |
builder.AppendFormat("Entity type: {0} | State: {1}",eve.Entry.Entity.GetType().Name,eve.Entry.State); | |
foreach (var ve in eve.ValidationErrors) | |
builder.AppendFormat("Property name: {0} | Current value: {1} | Error message: {2}", | |
ve.PropertyName, | |
eve.Entry.CurrentValues.GetValue<Object>(ve.PropertyName), |