Skip to content

Instantly share code, notes, and snippets.

View anchietajunior's full-sized avatar
💭
Working Hard

José Anchieta anchietajunior

💭
Working Hard
View GitHub Profile
@anchietajunior
anchietajunior / paint_bucket.rb
Created November 20, 2023 10:53
Implementing MS-Paint's “paint bucket”
def flood_fill(image, x, y, new_color)
target_color = image[x][y]
fill(image, x, y, target_color, new_color)
end
def fill(image, x, y, target_color, new_color)
return if x < 0 || x >= image.length || y < 0 || y >= image[0].length
return if image[x][y] != target_color
return if image[x][y] == new_color
@anchietajunior
anchietajunior / suppliers.sql
Created November 20, 2023 10:51
Query suppliers in “VITORIA” that provide “MOTOR” for “KOMBI”,
-- Create database structure
CREATE TABLE SUPPLIER (
SUPPLIER_CODE VARCHAR(255),
SUPPLIER_NAME VARCHAR(255),
CITY VARCHAR(255)
);
CREATE TABLE PART (
PART_CODE VARCHAR(255),
NAME_PART VARCHAR(255),
@anchietajunior
anchietajunior / phone_search.rb
Created November 20, 2023 10:48
Search a person number in a list given a person name
def search_phone_by_name(list, name)
left = 0
right = list.length - 1
while left <= right
mid = (left + right) / 2
current_name = list[mid][:name]
if current_name == name
return list[mid][:phone]
@anchietajunior
anchietajunior / palindrome.rb
Created November 20, 2023 10:46
Palindrome algorithm
def palindrome?(word)
left = 0
right = word.length - 1
while left < right
return false if word[left] != word[right]
left += 1
right -= 1
end
centre_id brand center_status address_line1 address_line2 address_line3 city state_or_province zip_or_postal_code country_iso_code longitude latitude address_number building_name street_name floor_numbers suite_numbers unit_numbers product_category product_name building_description local_area_description total_building_size area_size_unit min_desks max_desks centre_open_date min_term max_term min_cost max_cost currency featured_image external_building_image high_res_images high_res_image_tags low_res_images low_res_image_tags feature_24_hour_access feature_24_hour_cctv_monitoring feature_airport_location feature_bicycle_storage feature_breakout_areas feature_business_park_location feature_city_town_centre feature_day_care feature_disabled_facilities feature_double_glazing feature_elevator feature_gym_and_fitness_room feature_lounge_area feature_major_transport_links feature_meeting_rooms feature_on_site_dry_cleaning feature_on_site_lunch_restaurant feature_outside_seating_area_terrace feature_parking feature_
centre_id brand center_status address_line1 address_line2 address_line3 city state_or_province zip_or_postal_code country_iso_code longitude latitude address_number building_name street_name floor_numbers suite_numbers unit_numbers product_category product_name building_description local_area_description total_building_size area_size_unit min_desks max_desks centre_open_date min_term max_term min_cost max_cost currency featured_image external_building_image high_res_images high_res_image_tags low_res_images low_res_image_tags feature_24_hour_access feature_24_hour_cctv_monitoring feature_airport_location feature_bicycle_storage feature_breakout_areas feature_business_park_location feature_city_town_centre feature_day_care feature_disabled_facilities feature_double_glazing feature_elevator feature_gym_and_fitness_room feature_lounge_area feature_major_transport_links feature_meeting_rooms feature_on_site_dry_cleaning feature_on_site_lunch_restaurant feature_outside_seating_area_terrace feature_parking feature_

Mutations

Create user and return user data with JWT

mutation {
  createUserForMobile(
    input: {
      name: "Santo Agostinho",
      email: "santoagostinho202118930823910@gmail.com",
@anchietajunior
anchietajunior / template_diferente.md
Last active February 22, 2022 20:06
PR Template Diferente

Descrição

Esse Pull Request tem a intenção de ... (descrição completa).

Card do Jyra

Imagens (caso necessário)

Radouken

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Engineering Principles

Our guidelines for building new applications and managing legacy systems.

Backend development

For us doesn't not matter the language you choose to develop the application. It's importat to follow some rules when you decide to implement a different language that we are describing in other section of this document.

The main objective of this section is to make sure we follow the rules below independent of the language we choose. We like Sandi Metzs Rules for OOP. These rules have helped us to keep our code simpler to understand and easier to change.

A class can be no longer than 100 lines of code.