Skip to content

Instantly share code, notes, and snippets.

View luchiago's full-sized avatar
🚀
Learning

Lucas Hiago luchiago

🚀
Learning
View GitHub Profile
@irvine5k
irvine5k / links.md
Last active August 29, 2020 01:01
TDC SP 2020 TESTES DE WIDGET

numbers

def sum(first, *rest)
  rest.inject(first) { |o, x| o + x }
end

> sum(1) # first = 1, rest = []
1
> sum(1, 2) # first = 1, rest = [2]
3
@marclerodrigues
marclerodrigues / balanced_string.rb
Last active November 23, 2020 18:57
Leet Code Problems
# Problem: https://leetcode.com/problems/split-a-string-in-balanced-strings/
# @param {String} s
# @return {Integer}
def balanced_string_split(s)
balance = 0
total_count = 0
s.split("").each do |value|
if value == "R"

Microservices

Advantages

  • Independent components. Firstly, all the services can be deployed and updated independently, which gives more flexibility. Secondly, a bug in one microservice has an impact only on a particular service and does not influence the entire application. Also, it is much easier to add new features to a microservice application than a monolithic one.
  • Easier understanding. Split up into smaller and simpler components, a microservice application is easier to understand and manage. You just concentrate on a specific service that is related to a business goal you have.
  • Better scalability. Another advantage of the microservices approach is that each element can be scaled independently. So the entire process is more cost- and time-effective than with monoliths when the whole application has to be scaled even if there is no need in it. In addition, every monolith has limits in terms of scalability, so the more users you acquire, the more problems you have with your monolith. Therefor
@wonderbeyond
wonderbeyond / vsc-settings.py
Created February 25, 2019 09:11
script to export vsc settings
#!/usr/bin/env python3
from os import path
import tempfile
import subprocess
import datetime as dt
import click
@click.group()
def cli():
@akitaonrails
akitaonrails / BACKEND.md
Last active April 3, 2024 19:49
Codeminer 42 - BACKEND Test

TRZ (The Resident Zombie) - Backend

Problem Description

The world, as we know it, has fallen into an apocalyptic scenario. The "Influenzer T-Virus" (a.k.a. Twiter Virus) is transforming human beings into stupid beasts (a.k.a. Zombies), hungry to cancel humans and eat their limbs.

You, the last survivor who knows how to code, will help the resistance by deploying a system to connect the remaining humans. This system will be essential to detect new infections and share resources between the members.

Requirements

@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active March 7, 2024 03:56
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@santiagobasulto
santiagobasulto / gist:3056999
Created July 5, 2012 23:05
Mocking private methods in python
""" This is a simple gist to show how to mock
private methods. I've got lots of questions
regarding this topic. Most people seems confused.
Hope it helps.
"""
import unittest
import mock