Skip to content

Instantly share code, notes, and snippets.

View jonataa's full-sized avatar

Jonata Weber jonataa

  • Feira de Santana - Bahia
View GitHub Profile
function isBeatifulNumber(n, has = '4', hasnot = '9') {
const numberAsString = n.toString();
const hasFour = numberAsString.includes(has) === true;
const hasNine = numberAsString.includes(hasnot) === false;
return hasFour && hasNine;
}
const isBeatifulNumberHasThreeAndHasNotTwo = function (n) {
*{
padding: 0;
margin: 0;
font-family: Arial, Helvetica, Sans-serif;
font-size: 14px;
}
.logo{
display: flex;
flex-direction: row;
const assert = require('assert');
function getFizzBuzzRules() {
return [
{ label: () => 'fizzbuzz', rule: n => n % 15 === 0 },
{ label: () => 'buzz', rule: n => n % 5 === 0 },
{ label: () => 'fizz', rule: n => n % 3 === 0 },
{ label: (n) => n, rule: n => n === n },
];
}
[
{"lat": "37.782551", "long": "-122.445368"},
{"lat": "37.782745", "long": "-122.444586"},
{"lat": "37.782842", "long": "-122.443688"},
{"lat": "37.782919", "long": "-122.442815"},
{"lat": "37.782992", "long": "-122.442112"},
{"lat": "37.783100", "long": "-122.441461"},
{"lat": "37.783206", "long": "-122.440829"},
{"lat": "37.783273", "long": "-122.440324"},
{"lat": "37.783316", "long": "-122.440023"},
@jonataa
jonataa / requirements.txt
Last active January 12, 2016 21:24
PUT method for unexisting document is not working on the Python-EVE
eve==0.6.1
if ($_GET['acao'] == 'add') {
$id = intval($_GET['id']);
if (!isset($_SESSION['ticket'][$id])) {
$_SESSION['ticket'][$id] = array(
'qtd' => 1,
'item' => "X-frango",
'preco' => 10.00,
'subtotal' => 10.00 * 1
);
<?php
function buracosLetras($texto)
{
$qtd_buracos = 0;
$texto = strtoupper($texto);
$buracos = ['A' => 1, 'B' => 2, 'D' => 1, 'O' => 1, 'P' => 1, 'Q' => 1, 'R' => 1];
for ($i = 0; $i < strlen($texto); $i++) {
$letra = $texto[$i];

Buscar endereço através do CEP

Sendo um entregador de pizza, posso buscar o endereço do cliente através do CEP informado por telefone, pois assim ganho agilidade e realizo as entregas corretamente.

Cenário 1: Buscar endereço, CEP válido.
Dado que estou na página buscar endereço
Quando insiro um CEP VÁLIDO no campo do formulário
Então ele exibe o endereço correspondente.

Cenário 2: Buscar endereço, CEP inválido.
Dado que estou na página buscar endereço

@jonataa
jonataa / test.php
Last active September 1, 2015 18:51
Este script implementa uma função de teste simples e sem utilizar framework
<?php
// Executa quando o teste falha
function assertFailure($file, $line, $code, $failMsg)
{
echo $failMsg, PHP_EOL;
}
// Faz a asserção do nosso teste
function test($obtido, $esperado)