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
# frozen_string_literal: true | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'selenium/webdriver' | |
Capybara.register_driver :firefox do |app| | |
Capybara::Selenium::Driver.new(app, browser: :firefox) | |
end | |
Capybara.default_driver = :firefox |
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
class CustomerScenario | |
def initialize(scenario) | |
@scenario = scenario | |
end | |
end | |
ParameterType( | |
name: 'customer_scenario', | |
regexp: /passed|failed|banned/, |
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
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <executable_name>" | |
exit 1 | |
fi | |
executable="$1" | |
IFS=':' read -ra path_dirs <<< "$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
#!/bin/bash | |
# Warning | |
# This assumes you already have copied your schematics to /share/schematics | |
# Also, we delete the original schematics folder in each instance, so back up everything you want to keep | |
multimc_instances_dir="$HOME/.local/share/multimc/instances" | |
shared_schematics_dir="$HOME/.local/share/schematics" | |
# Iterate over each instance folder |
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
#!/bin/bash | |
# Search for directories with name 'functional-tests' in current directory | |
for directory in $(find . -type d -name 'functional-tests'); do | |
# Check if a Gemfile exists in the directory | |
if [ -e "$directory/Gemfile" ]; then | |
# Output which directory is being checked | |
echo -e "\033[0;34mChecking gems in directory:\033[0m $directory" | |
# Change into the directory and run the bundler outdated command |
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
# frozen_string_literal: true | |
module Tictactoe | |
# Player records the symbol being used | |
class Player | |
attr_reader :symbol | |
def initialize(symbol) | |
@symbol = symbol | |
end |
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
=begin | |
Collatz Conjecture | |
Hint: recursion! | |
The Collatz Conjecture or 3x+1 problem can be summarized as follows: | |
Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely. The conjecture states that no matter which number you start with, you will always reach 1 eventually. | |
Given a number n, return the number of steps required to reach 1. | |
Example: | |
Starting with n = 12, the steps would be as follows: | |
12 | |
6 |
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
<!DOCTYPE html> | |
<html> | |
<style> | |
.rangeslider{ | |
width: 50%; | |
} | |
.myslider { | |
-webkit-appearance: none; |
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
=begin | |
Run length encodingRun-length encoding (RLE) is a simple form of data compression, where runs (consecutive data elements) are replaced by just one data value and count. | |
For example we can represent the original 53 characters with only 13. | |
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB" | |
RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression."AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE" | |
For simplicity, you can assume that the unencoded string will only contain the letters A through Z (either lower or upper case) and whitespace. | |
This way data to be encoded will never contain any numbers and numbers inside data to be decoded always represent the count for the following character. | |
=end | |
# Usage example |
NewerOlder