This file contains hidden or 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
# 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.>" |
This file contains hidden or 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
# 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: | |
# ??? |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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) |
This file contains hidden or 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
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 |
This file contains hidden or 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
class Tasting < ApplicationRecord | |
# ... | |
has_one :host_participation, -> { where(host: true, status: "accepted") }, class_name: "Participation" | |
has_one :host, through: :host_participation, source: :user | |
# ... | |
end |
This file contains hidden or 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
================================================================================ | |
================================ 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 |
This file contains hidden or 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
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| |
This file contains hidden or 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
class Flat | |
def initialize(attrs = {}) | |
# DATA | |
# @id | |
# @name | |
# @price_per_night | |
# .... | |
end | |
### ALL |