Skip to content

Instantly share code, notes, and snippets.

View gabrielleme00's full-sized avatar
🪐
Exploring

Gabriel de Oliveira Leme gabrielleme00

🪐
Exploring
View GitHub Profile
@gabrielleme00
gabrielleme00 / troco_minimo.py
Created August 14, 2017 01:10
Problema do troco mínimo (Python)
def troco_minimo(troco):
moedas_disponiveis = [100, 50, 25, 10, 5, 1]
moedas_utilizadas = {} # Dicionario (moeda: quantidade)
total = 0
for i in range(len(moedas_disponiveis)):
num_moedas = troco // moedas_disponiveis[i]
troco -= num_moedas * moedas_disponiveis[i]
total += num_moedas
@gabrielleme00
gabrielleme00 / bf.cpp
Last active November 5, 2023 19:50
Simple Brainfuck interpreter in C++
#include <iostream>
unsigned char tape[30000] = {0};
unsigned char* ptr = tape;
void interpret(char* input)
{
char current_char;
unsigned int i, loop;
@gabrielleme00
gabrielleme00 / alphabet.bf
Created January 7, 2019 04:34
Code golf - print the alphabet in BF
# "Legit" way (no input) [51 bytes]:
>+++++[<+++++++++++++>-]>++++[<+++++++>-]<--[<.+>-]
# "Not-so-legit" way (needs 'A' as input) [27 bytes]:
,.>>+++++[<+++++>-]<[<+.>-]
# "Even-less-legit" way (needs 'A' and '[space]' as inputs) [15 bytes]:
,.>,----[<+.>-]
@gabrielleme00
gabrielleme00 / iv2_lista3_ex21.html
Created May 27, 2019 00:09
Fatorial simples em JS/jQuery
<!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>Ex21</title>
</head>
<body>
<h1>Fatorial</h1>
@gabrielleme00
gabrielleme00 / iv2_lista3_ex22.html
Created May 27, 2019 02:36
Exercício 22 - Peso médio por faixa etária
<!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>Ex22</title>
</head>
<body>
<h1>Peso médio por faixa etária</h1>
@gabrielleme00
gabrielleme00 / App.js
Last active July 18, 2019 19:25
Exemplo de requisição com fetch() em React | API Star Wars
import React from 'react';
import './App.css';
class Person extends React.Component {
// Define os estados
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,