Skip to content

Instantly share code, notes, and snippets.

View caioertai's full-sized avatar
🔮
Klatchian Coffee Guzzler

Caio Andrade caioertai

🔮
Klatchian Coffee Guzzler
  • Mexico City
View GitHub Profile
# Create an array of valid hands
# 0 1 2
# -3 -2 -1
valid_hands = %w[rock scissors paper]
user_hand = nil
# Get user input for a hand
loop do
puts "Choose your hand: #{valid_hands.join(' | ')}"
puts "<To exit just press enter.>"
# RECAP
# On representation:
# 1. The name of a dog.
# 2. The age of a person.
# 3. The height of a person in meters.
# 4. Affirmation of negation.
# 5. ???
# On retrieving and assigning values:
# ???
start_time = Time.now
min = 1
# We can optionally represent add the commas of large numbers
# as _ in Ruby for better legibility
max = 100_000_000
#Generate random price between a min and max (initially 1 and 100)
price = rand(min..max)
# Starts at 0 and is increased at every guess
def acronymizer(sentence)
sentence.split.map { |word| word[0] }.join.upcase
end
describe "#acronymizer" do
it "Test case with empty sentence" do
actual = acronymizer("")
expect(actual).to eq("")
end
def encrypt(text, key = -3)
alphabet = ("A".."Z").to_a
letters = text.chars
letters.map do |letter|
letter_index = alphabet.index(letter)
letter_index.nil? ? letter : alphabet[(letter_index + key) % alphabet.size]
end.join
end
def decrypt(text, key = -3)
if !(test -f "/usr/local/sbin/wslopen")
then
echo '#!/bin/bash' >> /usr/local/sbin/wslopen
echo '/mnt/c/Windows/explorer.exe "file://$(wslpath -m ${1/"file://"/})"' >> /usr/local/sbin/wslopen
chmod +x /usr/local/sbin/wslopen
fi
if [ -z $BROWSER ]
then
echo 'export BROWSER="wslopen"' >> ~/.zshrc
class Tasting < ApplicationRecord
# ...
has_one :host_participation, -> { where(host: true, status: "accepted") }, class_name: "Participation"
has_one :host, through: :host_participation, source: :user
# ...
end
================================================================================
================================ Cursed Commits ================================
=================================== allwaves ===================================
================================================================================
-------
Author: Alexandre Papineau
Message: Small justify-content change on weekly schedule
Cursed Words: ["Small"]
https://api.github.com/repos/ctboyle6/AllWaves/git/commits/2f19cba79c9af743f4c2b6e1691fb7f6ec1e929e
class Result
class Day
def initialize(params)
@date = params[:date] || Date.today
@preference = params[:preference]
@spot = params[:spot]
end
def time_periods
conditions.map do |condition|
class Flat
def initialize(attrs = {})
# DATA
# @id
# @name
# @price_per_night
# ....
end
### ALL