Skip to content

Instantly share code, notes, and snippets.

View anabastos's full-sized avatar
😭
Sad and Brazilian

Ana Luiza Portello Bastos anabastos

😭
Sad and Brazilian
View GitHub Profile
@anabastos
anabastos / triangulinho.py
Last active October 2, 2016 19:41
triangulinho
n= input("Numero de linhas: ")
if n>1:
for i in range(n):
n-=1
print " "*n+"."+" ."*i
else:
print(".")
piramid = map(lambda n: "/n".join([" "*(n-i-1)+"."+" ."*i for i in range(n) if n>1]))
def piradimidinha_rec(n):
if n < 1 return ["."]
map(lambda piramid2: piramid1(n-1)+" .")
return " "*n-1+"*"+
n= input("Numero de linhas: ")
if n>1:
@anabastos
anabastos / fermat.c
Last active October 2, 2016 05:41
Desafio Fermat
#include <stdio.h>
int ehPrimo(long number) {
int i;
for (i=2; i<number; i++) {
if (number % i == 0 && i != number) return 0;
}
return 1;
}
@anabastos
anabastos / fermatgoto.c
Created October 3, 2016 01:14
Fermat usando goto q fico horrivel
#include <stdio.h>
int main () {
long n, pPrimo, qPrimo, p, q, e, x, y;
int i, j;
printf ("-----------");
printf ("\nF e R m A t");
printf ("\n-----------");
printf ("\nDigite um numero impar: "); scanf ("%ld", &n);
@anabastos
anabastos / gist:b98af2fd2cc881d14349faff7f4ec100
Last active January 22, 2017 15:49
Como instalar o ambiente do projeto no UBUNTU
Copie e cole esses comandos no terminal
Instalar python e pip(instalador do python):
sudo apt-get install python
sudo apt-get install python-pip
Instalar o banco de dados mongo:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get install -y mongodb-org
@anabastos
anabastos / Atv TDD
Last active January 25, 2017 14:08
Entrar no repositorio do github e clicar no botao de fork. Isso vai criar um repositorio igual pra sua conta
Entrar nesse seu repositorio e clona-lo
git clone (link)
cd furlong
Instalações:
sudo apt-get install ruby
gem install rspec -v 3.4.0
Digite no terminal para rodar os testes
@anabastos
anabastos / desafio.js
Created March 9, 2017 18:54
Desafio 1
//dado o array de dictionary abaixo some o total dos valores
let dictionary = [{ '5': 50, '6': 60 }, { 'A': 10 }, { 'YEEZY': 30 }]
dictionary.reduce((acc, val) => acc.concat(Object.values(val)), []).reduce((acc, val) => acc + val, 0)
/**
* Show Me the Evens - Show me the Odds
* Diana is learning to count and she just learned the difference between odds and even numbers.
* She wants to have some fun, so she picks a random number.
* If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input.
* If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input.
**/
const counting = (x) => {
return arrayFrom(x)
@anabastos
anabastos / criaArrayPrimos.js
Last active January 7, 2020 00:16
Dado um número aleatório, retornar todos os números PRIMOS entre 0 e o número escolhido
const criaArrayPrimos = x =>
criaArray(x)
.slice(2)
.filter(checaFatores)
const criaArray = tamanho => Array.from({ length: tamanho }, (el, index) => index)
const checaFatores = n =>
criaArray(maiorDivisor(n))
.slice(2)
@anabastos
anabastos / desafio1.js
Created March 17, 2017 19:36
Desafio map -js4girls
//tendo uma matrix 4x4 multiplicar apenas os valores pares
var matrix = [
[1, 11, 32],
[13, 14, 15],
[7, 6, 2]
]
//resultado esperado:
// [