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

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.

@anchietajunior
anchietajunior / distances.rb
Created May 23, 2020 20:03
Implementation
def distance_between_locations(locations)
def distance(location_one, location_two)
rad_per_deg = Math::PI/180
radius_in_meters = 6371 * 1000
dlat_rad = (location_two[0]-location_one[0]) * rad_per_deg
dlon_rad = (location_two[1]-location_one[1]) * rad_per_deg
@anchietajunior
anchietajunior / miojo.rb
Last active May 23, 2020 19:59
Implementation and CLI
puts "Type the cooking time: "
cooking_time = gets.chomp.to_i
puts "Type the first hourglass time: "
hour_glass_one = gets.chomp.to_i
puts "Type the second hourglass time: "
hour_glass_two = gets.chomp.to_i
def calculate_minimum_time(cooking_time, hour_glass_one, hour_glass_two)
minimum_time = 0
=begin
Write some code, that will flatten an array of arbitrarily
nested arrays of integers into a flat array of integers.
e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com
with your implementation.
When writing this code, you can use any language you're
comfortable with. The code must be well tested and documented.
@anchietajunior
anchietajunior / pull_request.md
Last active February 12, 2020 16:10
This is a PR template

Pull Request Description

This PR aims to do something (detailed description).

Type (Feature, Fix, Config, etc)

  • Bug fix
  • New feature
  • Breaking change
  • This change requires a documentation update
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: your_database_development
host: localhost
username: postgres
# Each
arr = ["Luke", "Leia", "Vader"]
arr.each do |name|
p name
end
# Times
name = "Mary"
3.times do
prefix = "My name is"
name = "John"
p "#{prefix} #{name}"
end
name = "Mary"
3.times do
prefix = "My name is"
p "#{prefix} #{name}"
end