This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Install rbenv | |
$ brew update && brew install rbenv ruby-build | |
## Install Ruby Version Choosed (2.6.5 it's the one I want) | |
$ rbenv install -v 2.6.5 | |
$ rbenv global 2.6.5 | |
## Check Ruby Version | |
$ ruby -v | |
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Antonio Netto | |
email = tonis.04@gmail.com | |
[core] | |
excludesfile = /Users/anetto/.gitignore_global | |
editor = atom | |
ignorecase = false | |
[web] | |
browser = google-chrome | |
[color] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes. | |
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes. | |
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum. | |
enum HTTPStatusCode: Int, Error { | |
/// The response class representation of status codes, these get grouped by their first digit. | |
enum ResponseType { | |
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. | |
case informational |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum ItalianMenu { | |
case penne | |
case ravioli | |
case lasagna | |
} | |
let italianOrdersQueue = RestaurantOrders<ItalianMenu>()// instance with ItalianMenu Items | |
italianOrdersQueue.enqueue(item: .penne) | |
italianOrdersQueue.enqueue(item: .lasagna) | |
print(italianOrdersQueue.showCurrentQueue()) // [.penne, .lasagna] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Orders Protocol | |
protocol Orders { | |
associatedtype Item | |
func enqueue(item:Item) | |
func dequeue() -> Item? | |
func showCurrentQueue() -> [Item] | |
} | |
// RestaurantOrders class | |
class RestaurantOrders<Item>: Orders { | |
var items : [Item] = [Item]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom Protocol | |
protocol CustomAddable { | |
static func +(lhs: Self, rhs: Self) -> Self | |
} | |
// Sum 2 Numeric elements | |
func sum<T: CustomAddable>(x: T, y: T) -> T { | |
return x + y | |
} | |
// extending to work with the Custom Protocol | |
extension Int: CustomAddable {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sum 2 Numeric elements | |
func sum<T: Numeric>(x: T, y: T) -> T { | |
return x + y | |
} | |
sum(3, 4.5) // result 7.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sum 2 Int elements | |
func sum(x: Int, y: Int) -> Int { | |
return x + y | |
} |
NewerOlder