Skip to content

Instantly share code, notes, and snippets.

View lucasheriques's full-sized avatar

Lucas Faria lucasheriques

View GitHub Profile
@lucasheriques
lucasheriques / ler-arquivos-python-argparse.md
Last active September 7, 2020 19:39
Como ler arquivos usando Python e argparse

Ler arquivos significa que vamos carregar o arquivo na memória do programa, e ler linha por linha o conteúdo do arquivo.

Para fazer isso, precisamos apenas de alguns passos:

import argparse
from argparse import ArgumentParser
using System;
using System.Threading.Tasks;
using Xunit;
namespace UnitTest {
public class Triangle {
[Fact]
public void CalculateArea_WithValidTriangle_ShouldReturnCorrectArea () {
Assert.Equal (24, CalculateArea (6, 8, 10));
}
public class Fatorial {
public static int fatorial(int x) {
if (x == 0)
return 1;
int total = x;
for (int i = x - 1; i > 0; i--) {
total *= i;
}
return total;
@lucasheriques
lucasheriques / QuickSort.java
Created June 4, 2018 20:35
QuickSort implementation
public class QuickSort {
/*
Pega o último elemento como pivô, e coloca ele seu em lugar correto,
com todos os elementos menores à esquerda, e os maiores à direita.
*/
private int partition(int arr[], int low, int high) {
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j < high; j++) {
if (arr[j] <= pivot) {
import java.util.*;
public final class StackSorting {
public static void resolve(int[] array, int n, int k) {
Stack<Integer> s = new Stack<>();
s.push(n+1);
int t = 1;
{
"receitas": [{
"receita": "Barrinhas de cereal",
"ingredientes": "1 xícara de nozes, 1 xícara de frutas secas, 1 xícara de tâmaras secas sem caroço",
"ingredientesBase": {
"0": "3",
"1": "Nozes",
"2": "Frutas secas",
"3": "Tamaras"
},
@lucasheriques
lucasheriques / coin.java
Created June 10, 2017 01:45
CoinCollector algorithm
package com.company;
import java.io.*;
import java.util.Arrays;
/**
* Created by lucashenrique on 03/06/17.
*/
public class Main {
.
11:21: Your death from 11. Dec 2016 19:40:18 CET has been compensated because it was related to connection issues. Your Losses of Skill and Level have been revoked. For each lost blessing, you received the corresponding blessing charm in your inbox.
11:21: Your death from 12. Dec 2016 00:17:07 CET has been compensated because it was related to connection issues. Your Losses of Skill and Level have been revoked. For each lost blessing, you received the corresponding blessing charm in your inbox.
11:21: Your death from 13. Dec 2016 12:47:49 CET has been compensated because it was related to connection issues. Your Losses of Skill and Level have been revoked. For each lost blessing, you received the corresponding blessing charm in your inbox.
11:21: Your death from 15. Dec 2016 03:08:15 CET has been compensated because it was related to connection issues. Your Losses of Skill and Level have been revoked. For each lost blessing, you received the corresponding blessing charm in your inbox.
11:21: Your death from
@lucasheriques
lucasheriques / gist:60d0de3bbf3d66ef41eb50a52deb153b
Last active November 22, 2016 18:58
Diff for master commit
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index a7714db..d122f15 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -21,13 +21,13 @@
*= require jquery.fileupload
*/
+@import 'bootstrap-sprockets';
+@import 'bootstrap';