blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
137
path
stringlengths
2
355
src_encoding
stringclasses
31 values
length_bytes
int64
11
3.9M
score
float64
2.52
5.47
int_score
int64
3
5
detected_licenses
listlengths
0
49
license_type
stringclasses
2 values
text
stringlengths
11
3.93M
download_success
bool
1 class
752b1eb6ddec85d4b59693a947c3e47a96d4e53c
Ruby
Fendev-repo/launch_school_exercises_main
/01_small_problems/03_easy_three/05_squaring_an_argument.rb
UTF-8
711
4.8125
5
[]
no_license
require_relative '04_multiplying_two_numbers' =begin Using the multiply method from the "Multiplying Two Numbers" problem, write a method that computes the square of its argument (the square is the result of multiplying a number by itself). Example: square(5) == 25 square(-8) == 64 Further Exploration ...
true
4f390b4d2df466596344df67233e043bd07b2bfa
Ruby
mmschertz/oo-student-scraper-onl01-seng-pt-061520
/lib/scraper.rb
UTF-8
1,355
2.96875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'open-uri' require 'pry' class Scraper def self.scrape_index_page(index_url) html = open(index_url) index = Nokogiri::HTML(html) page = index.css("div.student-card") page.collect do |student| {:name => student.css(".student-name").text , :location => student.css(".student-locat...
true
50fc6113d399e75edfd77778bb8e9baff999551d
Ruby
jepetersohn/phase-3-guide
/week-2/discussions/mocks-stubs-doubles/list_spec.rb
UTF-8
1,543
2.828125
3
[]
no_license
require "rspec" require_relative "list" describe List do let(:title) { "Home" } let(:task) { "clean" } let(:list) { List.new title } context "#title" do it "returns the title set at initialize" do expect(list.title).to eq title end end context "#tasks" do it "initializes with an empty list...
true
8e0b9d229bb156cafea5edfa0dd32369825e77fd
Ruby
jisaac01/code_kata
/conway/sveinn_josh/cell.rb
UTF-8
299
3.5
4
[]
no_license
class Cell def initialize(alive) alive = alive.respond_to?(:alive?) ? alive.alive? : alive @alive = (alive == 1 || alive == true) end def alive? @alive == true end def kill @alive = false end def revive @alive = true end def to_s alive?.to_s end end
true
f3693815d4211e0054c44b5330ec6a3e9a1d2038
Ruby
danielribeiro/hamster
/spec/hamster/hash/eql_spec.rb
UTF-8
1,585
2.8125
3
[ "MIT" ]
permissive
require File.expand_path('../../../spec_helper', __FILE__) require 'hamster/hash' describe Hamster::Hash do [:eql?, :==].each do |method| describe "##{method}" do describe "returns false when comparing with" do before do @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") ...
true
4d970e84695242bf8ca345efc53b3c31b8c09885
Ruby
davidruizrodri/code_kata
/lib/checkout/cart.rb
UTF-8
225
2.921875
3
[]
no_license
module Checkout class Cart attr_reader :products def initialize @products = Hash.new { |h, k| h[k] = [] } end def add_product(category, product) @products[category] << product end end end
true
29ddd99cd3bf7ca3e8234e0b45f4e91aac775654
Ruby
pollygee/sum-more-challenge
/solutions.rb
UTF-8
351
3.3125
3
[]
no_license
lines = File.read("numbers.csv").lines first_lines = lines[0] puts "first line is : #{first_lines}" first_lines = first_lines.chomp string_numbers = first_lines.split "," numbers = [] string_numbers.each do |num| int = num.to_i numbers << int end sum = 0 numbers.each do |num| sum += num end puts "sum of numbers...
true
e72af01d18c62d5336633cf33850bc715b51b2f0
Ruby
mendyismyname/looping-break-gets-000
/levitation_quiz.rb
UTF-8
199
3.296875
3
[]
no_license
def levitation_quiz #your code here input = "" until input == "Wingardium Leviosa" do puts "What is the spell that enacts levitation?" input = gets.chomp end puts "You passed the quiz!" end
true
3ac9db601fdc219a80c4d322063df5bb2b714062
Ruby
BiryukovViacheslav/Atom
/Основы Ruby/acreage_triangl.rb
UTF-8
312
3.25
3
[]
no_license
puts "Введите длинну основания треугольника" a = gets.chomp.to_i puts "Введите высоту треугольника, проведённую к его основанию" h = gets.chomp.to_i s = 0.5 * a * h puts " Площадь треугольника равна #{s}"
true
2b40070269b1a7d85f14b8074d88e97402b3c55f
Ruby
ark47/rspec-fizzbuzz-cb-000
/fizzbuzz.rb
UTF-8
307
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def fizzbuzz(int) if int % 3 == 0 && int % 5 == 0 "FizzBuzz" elsif int % 3 == 0 "Fizz" elsif int % 5 == 0 "Buzz" end end # if x % 3 = 0 print "Fizz" # if x % 5 = 0 print "Buzz" # if x % 3 = 0 && if x % 5 = 0 print "FizzBuzz" # if x % 3 > 0 && if x % 5 > 0 print nil # x = gets.string
true
117607ba240df22898ff900d1e280e21143faec9
Ruby
tylert88/unfamiliar-environment
/app/models/zpd_response.rb
UTF-8
2,249
2.578125
3
[ "Apache-2.0" ]
permissive
class ZpdResponse < ActiveRecord::Base validates :user_id, :date, :response, presence: true validate :validate_uniqueness_of_learning_experience belongs_to :user belongs_to :resource, polymorphic: true RESPONSES = { 0 => "Too Easy!", 1 => "In My ZPD", 2 => "Too Challenging" } def self....
true
4abe2327c47c8595f7d85296177098f0d89800a1
Ruby
mayatron/hippie-ipsum
/app/helpers/application_helper.rb
UTF-8
1,536
3.265625
3
[ "MIT" ]
permissive
module ApplicationHelper # Builds all paragraphs. Adds "Namaste" to the final paragraph. def build_paragraphs(number_of_paragraphs) paragraphs = paragraph_count(number_of_paragraphs).times.collect { build_paragraph } paragraphs.last.concat(" Namaste.") paragraphs end private # Returns a paraga...
true
bff9b790e4493deeb35aa46fa812fb76a87b9594
Ruby
Sara-Harvey/ttt-7-valid-move-v-000
/lib/valid_move.rb
UTF-8
347
3.1875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def position_taken?(board, index) if board[index] == "X" or board[index] == "O" return true else board[index] == " " or board[index] == "" or board[index] == nil return false end end def valid_move?(board, index) if index.between?(0, 8) && (position_taken?(board, index) == false) return true else ...
true
ce381df06048756abe79b0c3df1ef2796298db3e
Ruby
Karis-T/RB130
/lesson_1/select_method.rb
UTF-8
601
4.34375
4
[]
no_license
def select(array) counter = 0 selection = [] while counter < array.length selection << array[counter] if yield(array[counter]) counter += 1 end selection end # alternative with Array#each def select(array) counter = 0 selection = [] array.each { |n| selection << n if yield(n) } selection end ...
true
83f7dfa87bf1a4bc492733fc9bcc154452ba0fbe
Ruby
marlesson/gosu_pong
/lib/paddle.rb
UTF-8
1,020
3.328125
3
[]
no_license
class Paddle MOVE = 8 def initialize() @blocks = [] @blocks << Block.new(Block::BLOCK_SIZE, GameWindow::HEIGHT/2 + (0 * Block::BLOCK_SIZE)) @blocks << Block.new(Block::BLOCK_SIZE, GameWindow::HEIGHT/2 + (1 * Block::BLOCK_SIZE)) @blocks << Block.new(Block::BLOCK_SIZE, GameWindow::HEIGHT/2 + (2 * B...
true
6c1d7fd74d27f97e4cb72855308e061a4ae7902d
Ruby
dorianwolf/warcraft
/spec/test_11.rb
UTF-8
463
2.921875
3
[]
no_license
require 'pry' require_relative 'spec_helper' describe Barracks do describe 'initialization' do it "has an initial HP of 500 that is readable" do @barracks = Barracks.new expect(@barracks.health_power).to eq(500) end end describe '#damage' do it "takes damage that is equal to half the...
true
3fee9a59c5bab859ff04aa1da345c3f57ef70238
Ruby
jamesapowers/Ruby_projects
/W2D2/chess/display.rb
UTF-8
919
3.390625
3
[]
no_license
require 'colorize' require_relative 'cursor.rb' class Display attr_reader :board, :cursor def initialize(board) @board = board @cursor = Cursor.new([0,0], board) end def render system("clear") puts "Arrow keys, WASD, or vim to move, space or enter to confirm." build_grid @cur...
true
4440a8ae6722c67ed3a29b7542e1cc66a1d03b38
Ruby
madelynrr/field_trip_1909
/spec/models/flight_spec.rb
UTF-8
2,135
2.578125
3
[]
no_license
require 'rails_helper' RSpec.describe Flight, type: :model do describe 'validations' do it {should validate_presence_of :number} it {should validate_presence_of :date} it {should validate_presence_of :time} it {should validate_presence_of :departure_city} it {should validate_presence_of :arrival_...
true
06b59c9c396bef39d0500e10977eb0760112fc8d
Ruby
akerl/pkgforge
/lib/pkgforge/components/test.rb
UTF-8
1,970
2.546875
3
[ "MIT" ]
permissive
require 'fileutils' module PkgForge ## # Add test methods to Forge class Forge attr_writer :test_block Contract None => Proc def test_block @test_block ||= proc { raise 'No test block provided' } end Contract None => nil def test! tester = PkgForge::DSL::Test.new(self) ...
true
7fdedb37e63b341452e46f14c0bc641d3d58de96
Ruby
rommelniebres/Village88-Training
/Ruby on Rails/Ruby/Hash/hash.rb
UTF-8
600
4.375
4
[]
no_license
# .delete(key) => deletes and returns a value associated with the key h = {:first_name => "Coding", :last_name => "Dojo"} h.delete(:last_name) puts "Delete: #{h}" # .empty? => returns true if hash contains no key-value pairs h = {:first_name => "Coding", :last_name => ""} puts "Empty" if h[:last_name].empty? # .has...
true
c1bc5773f1fbcca93dcaaf356b7d9ac96e304577
Ruby
hubert/takeout
/lib/takeout/restaurant_menu.rb
UTF-8
1,215
3.109375
3
[ "MIT" ]
permissive
module Takeout class RestaurantMenu attr_reader :id, :menu_items def initialize(id: nil, menu_items: []) @id = id @menu_items = menu_items end def eql?(other) id.eql?(other.id) && menu_items.sort.eql?(other.menu_items.sort) end def best_price(order_list) best_p...
true
43b6374c630debff1c4340a892c8ad9bd8b9e22c
Ruby
christianduncan/reverse-each-word-nyc-web-career-042219
/reverse_each_word.rb
UTF-8
151
3.296875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) reverse_string = string.split(" ").collect do |element| element.reverse end return reverse_string.join(" ") end
true
75cf6e0415f5e242d4edb68e64310069373039dd
Ruby
emjoseph/worklede
/app/services/oauth_service.rb
UTF-8
956
2.734375
3
[]
no_license
#app/services/oauth_service.rb class OauthService attr_reader :auth_hash def initialize(auth_hash) @auth_hash = auth_hash end def create_oauth_account! oauth_account = nil existing_user = User.where(uid: @auth_hash[:uid]).first if existing_user puts "Returning User Log In" oauth_ac...
true
ca29e21b88d3ad75a20cd6a9eba865d9aa4329bf
Ruby
johannes-keinestam/tpv715-rental-system
/lib/data/database_handler.rb
UTF-8
5,877
3.15625
3
[]
no_license
require "sqlite3" require_relative "order_handler" require_relative "product_handler" #Module which acts as an intermediary between the database and the rest of the #application. Also handles creation of the database if it doesn't exist. module DatabaseHandler #Uses SQLite3 and sqlite3-ruby gem include SQLite3 ...
true
6797512c90675beacea9a4e4400589e1dd52283b
Ruby
skarb/skarb
/test/functional/if-else.rb
UTF-8
39
2.75
3
[ "MIT" ]
permissive
#3 if not 1 puts 2 else puts 3 end
true
a17b473fcb16857ab21e87cc70a352e6aef0843c
Ruby
daroleary/HeadFirstRuby
/exceptions/play.rb
UTF-8
650
3.734375
4
[]
no_license
require './small_oven' class Play dinner = ['turkey', nil, 'pie'] oven = SmallOven.new oven.turn_off dinner.each do |item| begin oven.contents = item puts "Serving #{oven.bake}" rescue OvenEmptyError => error # store exceptions in a variable puts "Error: #{error.message}" rescue...
true
54ba2f1e0a4ed145d60a673dbbb91da67e084718
Ruby
lessless/mysquar-ror-test1
/app/services/paginated_posts.rb
UTF-8
398
2.734375
3
[]
no_license
class PaginatedPosts def initialize(params) @page = params["page"] @per_page = params["per_page"] end def execute {records: records, pagination: pagination} end private def records posts.page(@page).per(@per_page) end def pagination { "page" => @page, "per_pa...
true
544623e89ffb767f810c820f82042b04ad2a0ae7
Ruby
radar/buildkite-notifier
/buildkite.rb
UTF-8
880
2.546875
3
[]
no_license
#!/usr/bin/env ruby require 'httparty' token = ENV.fetch("BUILDKITE_TOKEN") org, pipeline, build_number = ARGV[0..2] url = "https://api.buildkite.com/v2/organizations/#{org}/pipelines/#{pipeline}/builds/#{build_number}" state = "unknown" web_url = nil print "Waiting for build..." until ["passed", "failed", "blocked"...
true
610bc4c3ea25b0377230f6e473c9b9ef0cb67e1a
Ruby
b-shears/Relocate-Back-End-Rails
/app/services/businesses_search_service.rb
UTF-8
744
2.5625
3
[]
no_license
class BusinessesSearchService def self.utility_search(location, type) response = conn.get("/#{location}/utilities/#{type}") parsed(response) end def self.recreation_search(location, type) response = conn.get("/#{location}/recreation/#{type}") parsed(response) end def self.homeservice_search(...
true
bd39a9c0328bce93fb47be2fc240c7a80b639e5a
Ruby
tomjnunez/potluck
/lib/potluck.rb
UTF-8
359
3.671875
4
[]
no_license
class Potluck attr_reader :date, :dishes def initialize(date) @date = date @dishes = [] end def add_dish(new_dish) @dishes << new_dish end def get_all_from_category(chosen_category) returned_array = [] @dishes.each do |dish| if dish.category = chosen_category returned_arr...
true
b6c818e4eeb402ca966e0984b163321e5d94c9db
Ruby
albertobraschi/radiant-trike-tags-extension
/app/models/changed_standard_tags.rb
UTF-8
2,361
2.671875
3
[]
no_license
module ChangedStandardTags include Radiant::Taggable desc %{ Renders the @url@ attribute of the current page. Respects trailingslash attribute or Radiant::Config['defaults.trailingslash']. *Usage:* <pre><code><r:url [trailingslash="true|false"] /></code></pre> } tag 'url' do |tag| url = re...
true
c7983a3275c980be4e00371ab237f376304eb13a
Ruby
ronaldporch/poodr-code
/args.rb
UTF-8
304
3.375
3
[]
no_license
class Car attr_accessor :make, :model def initialize args @make = args[:make] @model = args[:model] end def to_s "#{make} #{model}" end end car = Car.new(make: "Toyota", model: "Camry") puts car.to_s defaults = {thing: 1, stuff: 2} stuff = {thing: 3} stuff = defaults.merge(stuff) puts stuff
true
66bdae77bc5bde0f6dc00190548a3d74dac01a01
Ruby
littlemove/barometer
/lib/barometer/formats/weather_id.rb
UTF-8
2,789
3.015625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Barometer # # Format: Weather ID (specific to weather.com) # # eg. USGA0028 # # This class is used to determine if a query is a # :weather_id, how to convert to and from :weather_id # and what the country_code is. # class Query::Format::WeatherID < Query::Format def self.format; :weather...
true
c5c10aec11ab2a9bb97f3dea9d234b1b1aaade1c
Ruby
njpearman/Peachy
/lib/peachy/morph_into_array.rb
UTF-8
949
2.734375
3
[]
no_license
module Peachy module MorphIntoArray include Compatibility private MethodsForArraysOnly = Array.instance_methods - Object.instance_methods def used_as_array method_name, block_given, *args return (block_given or args.size > 0) && array_can?(method_name) end def array_can? method_name ...
true
7421374b7158edba009ba47d7681cb54632abfe9
Ruby
mdinacci/socialyaml
/aggregate.rb
UTF-8
751
2.828125
3
[]
no_license
require 'rubygems' require 'twitter' def tweetToPost(tweet, template) title = tweet.text body = "" post = template.sub("#title", title).sub("#body",body) return post end # Read config file conf = YAML.load_file("config.yml") # Process tweet comments tweets = Twitter.user_timeline(conf["twitter"]["us...
true
0612f9307fd3462cf5bda4a45769cde7c6389a16
Ruby
Virus-Hunter/Ruby
/lib/modules/commands/tumblr.rb
UTF-8
1,219
2.625
3
[ "MIT" ]
permissive
module Bot module DiscordCommands #Tumblr search # Search for tumblr blogs! module TumblrSearch extend Discordrb::Commands::CommandContainer command :tumblr do |event| break unless event.user.bot_account == false client2 = Tumblr::Client.new separaT = "#{event.message.content[8..-1]}"...
true
4a2fd9cd1971991a16b9f9cacc03ec9b2d179a75
Ruby
aswinsanakan/ruby-programs
/test_divisor.rb
UTF-8
727
4.875
5
[]
no_license
=begin Create a function named divisors that takes an integer and returns an array with all of the integer's divisors(except for 1 and the number itself). If the number is prime return the string '(integer) is prime'. Example: divisors(12); #should return [2,3,4,6] divisors(25); #should return [5] divisors(13); #shou...
true
3e9f9d685d892f03a6d298b6eac8a5388aac3133
Ruby
setsumaru1992/ddd_practice_ruby_application
/app/domain_models/domain/person/group/finder/fetch_groups_finder_with_hierarchy.rb
UTF-8
4,617
2.546875
3
[]
no_license
module Domain::Person::Group class Finder::FetchGroupsFinderWithHierarchy < ::Domain::Base::Finder attribute :access_user_id, :integer validates :access_user_id, presence: true attribute :limit_layer_depth, :integer def fetch hierarchy_records = ::PersonGroupHierarchy.filter_user_accessible_pe...
true
b4b44899e2018268d30ab18930afe407fa0da2da
Ruby
CardozoIgnacio/Ruby_Tp
/Proyecto/AlquilerPeliculas.rb
UTF-8
14,993
2.796875
3
[]
no_license
class Cola def initialize() @arry=Array.new() end def add(elemnt) @arry.push(elemnt) end def element() aux=@arry[0] @arry[0]=nil @arry=@arry.compact return aux end def size() return @arry.size() end end ...
true
a892e6889a0094aa9199fcb93d26738a165dd94d
Ruby
gengogo5/atcoder
/math_and_algo/q023.rb
UTF-8
134
3.046875
3
[]
no_license
N = gets.to_i B = gets.split.map(&:to_i) R = gets.split.map(&:to_i) ans = (B.sum.to_f / B.length) + (R.sum.to_f / R.length) puts ans
true
6fc36c6c37221b7428fcd4af53d60c5047b93bc5
Ruby
NinjaMadMad/shopify-app-cli
/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb
UTF-8
4,176
2.765625
3
[ "MIT" ]
permissive
module CLI module UI module Frame module FrameStyle module Bracket extend FrameStyle VERTICAL = '┃' HORIZONTAL = '━' DIVIDER = '┣' TOP_LEFT = '┏' BOTTOM_LEFT = '┗' class << self def name 'bra...
true
d5858eb0c376b7bf34f4ae95e8eda8f552d39556
Ruby
mattie43/ruby-oo-practice-relationships-silicon-valley-exercise-nyc01-seng-ft-080320
/tools/console.rb
UTF-8
1,188
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative '../config/environment.rb' def reload load 'config/environment.rb' end # Insert code here to run before hitting the binding.pry # This is a convenient place to define variables and/or set up new object instances, # so they will be available to test and play around with in your console startup1 = St...
true
655e123fcf02d8726437e89b72d536fa543d1f54
Ruby
matadon/resque-promises
/spec/redis_hash_spec.rb
UTF-8
2,405
2.609375
3
[]
no_license
require 'resque/plugins/promises/redis_hash' require 'spec_helper' describe RedisHash do let(:hash) { RedisHash.new('redis-hash-test') } before(:each) { Redis.new.flushall } it "#connect" do hash.connect(Redis.new).should be_a(RedisHash) end it "set and get" do hash['foo'] = "hel...
true
acaf880e6b308b4d5463fd12aa6f61982464f343
Ruby
jprpich/hackerrank-solutions
/04-07-2019/acm_team.rb
UTF-8
518
3.671875
4
[]
no_license
# Complete the acmTeam function below. def acmTeam(topic) hash = Hash.new(0) topic.each_with_index do |sub1, idx1| topic.each_with_index do |sub2, idx2| if idx2 > idx1 test = comparison(sub1, sub2) if test > max hash[test] end end end end end def compar...
true
d8e3b2221eb11710185e81d63a1ab7be079248b5
Ruby
petems/chronosphere
/spec/cli/since_spec.rb
UTF-8
663
2.5625
3
[ "MIT" ]
permissive
require 'spec_helper' require 'timecop' describe Chronosphere::CLI do include_context "spec" before do Timecop.freeze(Time.local(2012)) end after do Timecop.return end describe "since" do it "returns error string if you give a date in the future" do expect{@cli.since('next year')}.to r...
true
167a87954eebe73e277df7eb4f6369ccb87ad340
Ruby
PreetBhadana/Training
/Ruby/Ruby_Practice/while_Modifier.rb
UTF-8
145
2.8125
3
[]
no_license
# while_Modifier same as do while of java and c c++ $i = 0 $num = 5 begin puts "Inside the loop i : #$i" $i += 1 end while $i <= $num
true
b0f126355816f1bcdd4a02bf521a422084e781d6
Ruby
WilsonkwSheng/blue-apron
/app/models/user.rb
UTF-8
1,465
2.578125
3
[]
no_license
class User < ApplicationRecord has_secure_password has_many :authentications, dependent: :destroy has_many :recipes, dependent: :destroy validates :name, presence: true validates :password_digest, presence: true validates :email, presence: true, uniqueness: true, format: { with: /\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+...
true
94d179fdf9e5d10ad499c6e3959d2e0fc8330848
Ruby
hoangtommy/dbpractice
/iOwork.rb
UTF-8
657
3
3
[]
no_license
# File.open("text2.txt").each { |line| puts line } # File.open("text2.txt").each(',') { |line| puts line } # File.open("text2.txt").each_byte { |byte| puts byte } # File.open("text2.txt") do |f| # 2.times { puts f.getc } # end # puts File.open("text2.txt").readlines # f = File.open("text2.txt") # puts f.pos # puts ...
true
df50068d2d428ce516a60e1bc5ecded60304c5ff
Ruby
davidsgbang/epub-maker-for-reddit
/src/reddit-to-epub.rb
UTF-8
425
2.78125
3
[ "MIT" ]
permissive
require_relative 'book' require_relative 'post' puts "Self-Post only!" print "Link ID: " id = gets.strip directory_name = "output" Dir.mkdir(directory_name) unless File.exists?(directory_name) begin post = Post.new(id) book = post.generate_book book.render rescue ArgumentError => argumentException p...
true
bd6d51d7fee8fa037f9ce0174fc294d0cd0f08ff
Ruby
RosaChoi/temperature_spread
/lib/class_data_analysis.rb
UTF-8
986
3.703125
4
[]
no_license
class ClassDataAnalysis def initialize(data) @data = data end def data @data end def lowest_temperature data.map do |instance| instance.low end.min end def highest_temperature data.map do |instance| instance.high end.max end def day_of_lowest_temperature # ...
true
5645ff789ff04c65ff352c16cacdffded1d8aea2
Ruby
dannnylo/hold_firefox
/lib/hold_firefox.rb
UTF-8
713
2.515625
3
[ "MIT" ]
permissive
require "hold_firefox/version" require 'pathname' module HoldFirefox class Path def initialize(platform) @platform = platform return unless allowed? Selenium::WebDriver::Firefox::Binary.path = firefox_path end # Folder path def home Pathname.new(File.dirname(__FILE__)).join('...
true
194aca9293a314bc0213dffe3e85046f4672b520
Ruby
cyrusaf/wikipedia_classifier
/train_classifier.rb
UTF-8
631
2.71875
3
[]
no_license
require 'stuff-classifier' cls = StuffClassifier::Bayes.new("Wikipedia") total_cats = Dir.entries('documents').length - 2 i = 1 Dir.foreach('documents') do |category| next if category == '.' or category == '..' puts "#{i}/#{total_cats}: #{category}" i += 1 # do work on real items Dir.foreach("documents/#...
true
e541a939e4d75725d8a9f7128f0682099df52477
Ruby
teoucsb82/workouts
/lib/workouts/round.rb
UTF-8
333
3.125
3
[]
no_license
class Workouts class Round attr_reader :days attr_reader :type def initialize(type = :classic) @type = type @days = load_days end def workouts @days.map(&:workouts) end private def load_days Array.new(90) { |day_number| Day.new(@type, day_number + 1) } e...
true
a361fd9dedf9b9558daaabb17eb9c91714410312
Ruby
romaspace/romasharma
/_site/convert.rb
UTF-8
1,908
2.65625
3
[]
no_license
#!/usr/bin/env ruby require 'active_support/core_ext/hash/conversions' require 'date' def slug(title) _slug = title.gsub(/\W+/,'-') _slug.sub!(/^-/,'') _slug.sub!(/-$/,'') _slug end def post_file_name(pub_date,title) "_posts/" + pub_date + "-" + slug(title) + ".markdown" end xmlData = File.read('roma.xml'...
true
08b97f5d4fd9d0023a1a9befd5aaf85921843d51
Ruby
einarstensson/simple-loops-001-prework-web
/simple_looping.rb
UTF-8
1,442
4.6875
5
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# REMEMBER: print your output to the terminal using 'puts' =begin This is my least gavprite loop because it is the least reader friendly. It also requires an avoidable counter variable. =end def loop_iterator(number_of_times) phrase = "Welcome to Flatiron School's Web Development Course!" counter = 0 loop do ...
true
4ed5a23e010834d3e6022b68b8c147a798710ba7
Ruby
goermine/user-board-api
/api/lib/interactors_observer.rb
UTF-8
789
2.578125
3
[]
no_license
require 'observer' module InteractorsObserver include Observable def on(event, &block) registered_events[event] = block self end def succeeded(*obj) event_processing(*obj, __method__) end def failed(*obj) event_processing(*obj, __method__) end def broadcast(event) add_observer(s...
true
8349371bded394390b2167792b3d376a462aa30e
Ruby
nayefmuhiar/CanCanCanSee
/lib/CanCanCanSee.rb
UTF-8
5,779
2.734375
3
[ "MIT" ]
permissive
require "CanCanCanSee/version" module CanCanCanSee MY_GLOBAL_HOLDER_OF_ABILITY = Hash.new def self.initiate_gem configuration_file = File.read('config/initializers/cancancansee.rb') if configuration_file.include?("single") my_file = File.read('app/models/ability.rb') # for single read_fil...
true
c6da42af100de84686fd8592bf4a04477cad3c1e
Ruby
mo-nathan/mushroom-observer
/app/classes/image_s3.rb
UTF-8
2,968
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "aws-sdk" class ImageS3 # Initialize connection: # # s3 = ImageS3.new( # server: "https://objects.dreamhost.com", # bucket: "mo-images", # access_key_id: "xxx", # secret_access_key: "xxx" # ) # def initialize(opts) @server = opts[:server] @bucket ...
true
acf2a190f8558ad2313f44f8c3b75fe0eaa54911
Ruby
detunized/dashlane-ruby
/lib/dashlane/fetcher.rb
UTF-8
1,385
2.53125
3
[ "MIT" ]
permissive
# Copyright (C) 2016 Dmitry Yakimenko (detunized@gmail.com). # Licensed under the terms of the MIT license. See LICENCE for details. module Dashlane class Fetcher LATEST_URI = URI "https://ws1.dashlane.com/12/backup/latest" def self.fetch username, uki, http = Net::HTTP response = http...
true
48b396d07bcb9fbff9d43dae5c281235f01f0f6c
Ruby
MaryTecnoNic/clase_ruby
/cancion.rb
UTF-8
710
3.875
4
[]
no_license
#ACCESORES class Cancion #de lectura #attr_reader :cancion #lectura y escritura attr_accessor :titulo def initialize(titulo,artista) @titulo = titulo @artista = artista end # get #def titulo # @titulo #end #set #def titulo = (titulo) # @titulo = titulo #end def to_s "la cancion es #{@titulo} de...
true
928f258f7e7d7833a2f1236107f48454d9096811
Ruby
zekarias99/yet-another-groupon-clone
/app/models/deal.rb
UTF-8
1,630
2.5625
3
[]
no_license
class Deal < ActiveRecord::Base has_many :users_deals has_many :users, :through => :users_deals belongs_to :partner validates_presence_of :name, :description, :partner_id validates_numericality_of :price, :greater_than => 0 validate :only_featured_for_given_period validate :start_in_future validate :...
true
097e8fba57a35119070f06cb2abaab1695babdc2
Ruby
DigitalRogues/rubiks-cube
/lib/rubiks_cube/cubie.rb
UTF-8
346
3.1875
3
[ "MIT" ]
permissive
# Generic cubie piece, either edge cubie or corner cubie module RubiksCube Cubie = Struct.new(:state) do def ==(other) state == other.state end def rotate! self.state = state.split('').rotate.join self end def rotate Cubie.new(state.dup).rotate! end def to_s ...
true
e3ac5a15724b59a87ee7c15a76bd61f9a1c30516
Ruby
dwilkie/tropo_message
/lib/tropo_message.rb
UTF-8
5,594
2.765625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Tropo class Message attr_accessor :params, :tropo_session def initialize(tropo_session = {}) @params = {} @tropo_session = tropo_session end # Interesting methods # Determines whether a message is meant for sending by checking # if it has session parameters. This is usef...
true
0495e2df528c535a65de5a4559524f5d604c5a64
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/c270da336bf2446bb74a553039f830ab.rb
UTF-8
491
3.5
4
[]
no_license
class Anagram def initialize(word) @word = word end def match(words) anagrams = Array.new letters = prepped_array(@word) words.each do |eval| eval_letters = prepped_array(eval) break if eval_letters[:unsorted].eql?(letters[:unsorted]) anagrams << eval if eval_letters[:sorted].e...
true
e614ac857b9445ebfeeddf9cd7ab207de5145d24
Ruby
lord63/flask_toolbox_by_rails
/app/jobs/pypi_parser.rb
UTF-8
1,134
2.921875
3
[ "MIT" ]
permissive
require 'json' class PyPIMeta def initialize(response) @response = JSON.parse(response) end def to_h { download_num: download_num, release_num: release_num, current_version: current_version, released_date: released_date, first_release: first_release, python_version: ...
true
8956c37b615ea0a950525a7f136e63bbdd8d940d
Ruby
dansimpson/ruby-kafka
/lib/kafka/pending_message_queue.rb
UTF-8
997
3.515625
4
[ "Apache-2.0" ]
permissive
module Kafka # A pending message queue holds messages that have not yet been assigned to # a partition. It's designed to only remove messages once they've been # successfully handled. class PendingMessageQueue attr_reader :size, :bytesize def initialize @messages = [] @size = 0 @byte...
true
efe4ca55eaf90eb72a15b7281cb89585a6246aa6
Ruby
BrovkinOleg/Ruby_Thinknetica_Lessons
/Basic_Ruby_task_03/train.rb
UTF-8
1,422
3.34375
3
[]
no_license
# frozen_string_literal: true # author Brovkin Oleg # 04.08.2019 require_relative 'route.rb' # class Train must get name, type(cargo, passenger), count of wagons # can change velocity, return velocity, return number of wagons, # can change number of wagons if velocity.zero? == true # can get route (class) => and afte...
true
a2b70bc430e52a374844fe5f0eb7133e24bc4630
Ruby
mikhailov/codility
/palindromes.rb
UTF-8
257
3.59375
4
[]
no_license
def solution(s) len = s.length if len > 100000000 return -1 end (0..len).each do |i| (2..len - i).each do |j| next if s[i,j] != s[i,j].reverse puts "(#{i},#{i + s[i,j].length - 1})" end end end a = "abbabba" solution(a)
true
3d8a8a483cf457356ebcea984452b2d837b36e98
Ruby
ericyericy/rbTest
/test/test11.rb
UTF-8
189
3.953125
4
[]
no_license
def greater_than_5(num) if num >= 5 puts true else puts false end end num = 10 puts greater_than_5(num) def area_of_circle(radius) 3.14 * radius ** 2 end puts area_of_circle(10)
true
bbf8ab367a4751436d15d53f3d6687a9c75d050e
Ruby
yantsong/axiom
/lib/axiom/attribute/boolean.rb
UTF-8
709
2.5625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# encoding: utf-8 module Axiom class Attribute # Represents a Boolean value in a relation tuple class Boolean < Object include Function::Connective::Conjunction::Methods, Function::Connective::Disjunction::Methods, Function::Connective::Negation::Methods # The attrib...
true
9e7623d05cd9548edfeed2413855b0a82042ded1
Ruby
r7kamura/rnes
/lib/rnes/cpu_registers.rb
UTF-8
2,968
3.0625
3
[ "MIT" ]
permissive
module Rnes class CpuRegisters CARRY_BIT_INDEX = 0 ZERO_BIT_INDEX = 1 INTERRUPT_BIT_INDEX = 2 DECIMAL_BIT_INDEX = 3 BREAK_BIT_INDEX = 4 RESERVED_BIT_INDEX = 5 OVERFLOW_BIT_INDEX = 6 NEGATIVE_BIT_INDEX = 7 # @param [Integer] # @return [Integer] attr_accessor :accumulator ...
true
095f8a6591351e31a42c356078b51c2c298764bf
Ruby
18F/identity-idp
/app/services/user_seeder.rb
UTF-8
3,464
2.921875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
require 'csv' class UserSeeder def self.run(**opts) new(**opts).run end # Instantiate a new instance of the service object # # @attr csv_file [String] the location of the CSV file with the dummy user data # @attr email_domain [String] the domain to use for user emails # @attr deploy_env [String] the...
true
f22c61f801e1667a82aee771fbba2c7f0c32f2bb
Ruby
pgoos/clark-app
/features/support/page_object/pages/app/manager.rb
UTF-8
2,501
2.53125
3
[]
no_license
# frozen_string_literal: true require_relative "../../components/card.rb" require_relative "../../components/messenger.rb" require_relative "../../components/modal.rb" require_relative "../page.rb" module AppPages # /de/app/manager class Manager include Page include Components::Card include Components...
true
a165c5fec9f334c77cb5f96d4b346277fe36181c
Ruby
minoriinoue/ruby_practice
/ctci/1/chap2/linked_list.rb
UTF-8
794
3.671875
4
[]
no_license
class Node attr_accessor :value, :next def initialize(value) @value = value @next = nil end end def generate_list(length) head = Node.new(rand(1..10)) tmp = head for i in 1..length do tmp.next = Node.new(rand(1..10)) tmp = tmp.next end return head end de...
true
53f9ac46347d66be3ccce93cb29df061879d8acb
Ruby
zwick-stripe/CodeComp
/CodeComprehension/flapjackrecord.rb
UTF-8
2,973
2.703125
3
[]
no_license
module Pancake class FlapJackRecord include FieldTypes # DSL methods def self.column_separator(column_separator) @column_separator = column_separator if column_separator && column_separator.is_a?(String) end def self.get_column_separator; @column_separator; end def self.column_count(co...
true
83cf5a26c7e3661d753be2a962343d48948200a5
Ruby
Druwerd/prime_time
/lib/prime_time/table.rb
UTF-8
1,575
2.96875
3
[ "MIT" ]
permissive
module PrimeTime class Table attr_accessor :width, :height, :col_headers, :row_headers, :rows def initialize(width: 1, height: 1) @width = width @height = height @col_headers = Array.new(width){''} @row_headers = Array.new(height){''} @rows = Array.new(height){ Array.new(width){...
true
8c0321e41923c1da61aaf0c6e224e14b32b474a3
Ruby
ConradIrwin/bugsnag_resque_locking
/app/workers/task.rb
UTF-8
511
2.734375
3
[]
no_license
class Task attr_reader :id class << self alias :queue :name def perform(id) puts "#{name}[#{id}] is about to do some work" new(id).do_now end end def initialize(id) @id = id end def do_later puts "#{self.class.name}[#{id}] will do some work later" Resque.enqueue(self....
true
be9f634b81483dc89b8b2d5f3ad0a48bdfd5893f
Ruby
blainelawson/pcd-calendar
/lib/pcd-calendar/event.rb
UTF-8
998
3.046875
3
[ "MIT" ]
permissive
class PCDCalendar::Event attr_accessor :name, :date, :time, :venue, :address, :city, :state, :zip, :url, :group, :month # either using the date, OR add a month attrubute# # make sure we don't scrape for the same month's events mor than one # add a method, a class method called `.find_by_month` which should tak...
true
b3964f0f168846532d47c3073730ee8d7e626e4e
Ruby
bharatagarwal/launch-school
/175_networked_applications/03_working_with_sinatra/frankie/1.rb
UTF-8
1,234
3
3
[]
no_license
module Frankie class Application def self.routes @routes ||= [] end def self.get(path, &block) route('GET', path, block) end def self.post(path, &block) route('POST', path, block) end def self.route(verb, path, block) routes << { verb: verb, path:...
true
52bb0cb02f56a963e3b0710cd6cdfacc0d1a67a9
Ruby
narender2031/ruby
/classes object/information.rb
UTF-8
657
4.21875
4
[]
no_license
class Information attr_accessor :title, :first_name, :last_name # when we calll the attr reader method ruby create this method for us def initialize(title, first_name, middle_name, last_name) @title = title @first_name = first_name @middle_name = middle_name @last_name = last_name end def ful...
true
d14f9b1f572d43ce1c1b594f7fee173a38735fe7
Ruby
harumukanon/itaiji
/spec/lib/itaiji/core_ext/string/conversions_spec.rb
UTF-8
611
2.515625
3
[ "MIT" ]
permissive
#encoding: utf-8 require 'spec_helper' using Itaiji::Conversions describe Itaiji::Conversions do let(:itaiji_text) { '齊藤正澔' } let(:seijitai_text) { '斉藤正浩' } let(:converter) { Itaiji::Converter.new } describe '#to_seijitai' do it 'converts name from itaiji to seijitai' do expect { itaiji_tex...
true
cb4b4b72161a6804f6c9ba1c7528c16b0e3da2a5
Ruby
DrFrotzen/freshUP
/freshup-client-ruby/lib/soap/user_interface_client.rb
UTF-8
6,458
2.515625
3
[]
no_license
require 'savon' module FreshupClient module Soap class UserInterfaceClient def initialize @client = Savon::Client.new("http://#{$GAMESERVER_HOST}:#{$GAMESERVER_PORT}/webserverInterfaceUser?wsdl") #puts @client.wsdl.soap_actions end def test_say_hello resp = @client....
true
b8699c57a97c1c0047dc9ffa09e353b2a82e5309
Ruby
svkrclg/greed
/Player.rb
UTF-8
358
3.390625
3
[]
no_license
class Player attr_accessor :point attr_accessor :in_the_game def initialize @point = 0 @in_the_game = false end def add_point(x) @point+=x end def get_point return @point end def in_the_game return @in_the_game end def set_in_the_game ...
true
3a7f0564256e95a5b087479f71ef08bc3e6c6e80
Ruby
spinnylights/math-work
/linear_algebra/foundations/img/only_one_y^n_eq_x_lt.rb
UTF-8
3,706
2.796875
3
[]
no_license
# frozen_string_literal: true require 'cairo' require 'pango' include Cairo::Color W = 3840 H = 2160 TICK_HEIGHT = 100 LINE_WIDTH = 20 FONT_SIZE = 50 def draw_tick(cr, x, y, dashed=false) cr.save if dashed cr.set_dash([TICK_HEIGHT/10]) end cr.move_to(x, y - TICK_HEIGHT/2) cr.line_to(x, y + TICK_...
true
33d344e83e1ccf0296b2d74cb8da84ad2921f65c
Ruby
ljwhite/order_up
/spec/models/dish_spec.rb
UTF-8
1,066
2.59375
3
[]
no_license
require 'rails_helper' RSpec.describe Dish, type: :model do describe "validations" do it {should validate_presence_of :name} it {should validate_presence_of :description} end describe "relationships" do it {should belong_to :chef} it {should have_many :dish_ingredients} it {should have_many(:...
true
113976f5bbd935d0907f9d4ebe9f9979ece49f47
Ruby
richwblake/my-each-online-web-pt-110419
/my_each.rb
UTF-8
115
3.34375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def my_each( arr ) count = 0 while count < arr.length do yield arr[count] count += 1 end arr end
true
f5a7f4a418181758e0f1e0c2c7afedfac600eb19
Ruby
Requiem-of-Zero/a-A-Homework
/W4D3/skeleton/lib/simon.rb
UTF-8
1,097
3.890625
4
[]
no_license
class Simon COLORS = %w(red blue green yellow) attr_accessor :sequence_length, :game_over, :seq def initialize @sequence_length = 1 @seq = [] #[red] @game_over = false end def play until game_over == true take_turn end game_over_message reset_game end def take_turn ...
true
09f577da8baf784ae34258131f36284404cd92e4
Ruby
mindreframer/api-stuff
/github.com/mwunsch/gilt/lib/gilt/sale.rb
UTF-8
2,180
2.671875
3
[ "MIT" ]
permissive
require 'time' module Gilt # A Gilt Sale object, representing an active or upcoming "flash" sale. class Sale class << self Gilt::Client::Sales.resources.keys.each do |key| define_method key do |params, &block| args = params || {} apikey = args[:apikey] affid = args[:...
true
725a43a8aba79d4dca07145f4b0b4e0cea59b8e6
Ruby
phoffer/ball_clock
/ruby/optimized_ball_clock.rb
UTF-8
2,794
3.546875
4
[]
no_license
# frozen_string_literal: true # Paul Hoffer # Note: this assumes the fixed ball in the hour indicator was not selected from the total ball count # If it was selected from the ball count, then the minimum number (27) must be incremented, the overflow (11) must be incremented, and the hour indicator is not completely flu...
true
754d13ca63a0140242a2799d37e438d62385e31d
Ruby
evizitei/git-tests
/git_changes.rb
UTF-8
407
2.515625
3
[]
no_license
class GitChanges def self.is_a_problem?(files) GitChanges.new(files).is_a_problem? end attr_reader :files def initialize(file_string) @files = file_string.gsub("lib/feature.rb",'') end def is_a_problem? !!((files =~ /^(app|public).*\.(coffee|js)$/ && !(files =~ /^spec.*\.(coffee|js)$/)) ...
true
89588081b158f4571afa53dba9cc8af12e0e3a95
Ruby
salmanneimat/advanced-hashes-hashketball-dumbo-web-career-012819
/hashketball.rb
UTF-8
7,810
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def game_hash game_hash = { :home => {team_name: "Brooklyn Nets", colors: ["Black", "White"], players: { "Alan Anderson" => {number: 0, shoe: 16, points: 22, ...
true
83235df5631dd2d7c98c9a6e5b48573029810f0a
Ruby
dockhands/CodeCore
/4week/intro_to_ruby_labs/prime.rb
UTF-8
690
4.3125
4
[]
no_license
# Ask the user for a number x and then print the first x prime numbers. Prime numbers are divisible only by 1 and themselves. puts "Give me first entry plz" howMany = gets.to_i # numbers we want to check if prime for number in 1..howMany is_prime(number) puts prime_number end # for number in 1..howMany # ...
true
fe662342b3d60762011e3aacb6e53d8f5ddaa518
Ruby
zdogma/math-puzzle
/question_7.rb
UTF-8
1,782
3.515625
4
[]
no_license
require 'Date' puts (Date.parse("1964-10-10")..Date.parse("2020-07-24")).map { |date| date_str = date.strftime("%Y%m%d") date_str == date_str.to_i.to_s(2).reverse.to_i(2).to_s ? date_str : nil }.compact =begin ぱっと見て思いつくやり方で実装し、正解。4分くらい。 模範解答が2種類あって、そのうち前者とほぼ同じだった。 (出力内容を date_str にするために、やや直感的ではない書き方をしている点のみ差分) R...
true
9553dc5f1efcceca0d411b51c8296371911f8805
Ruby
OlivierSes/rails-longest-word-game
/app/controllers/game_controller.rb
UTF-8
1,933
3.046875
3
[]
no_license
require 'open-uri' require 'json' require 'date' class GameController < ApplicationController def game_welcome end def launch_game @grid_size = params[:size].to_i @grid = generate_grid(@grid_size) @start_time = params[:time] end def generate_grid(grid_size) grid = [] n = grid_size / 1....
true
2893a84bfe65317bb9287c2b0457e31729281c95
Ruby
guilleiguaran/nancy
/test/use_test.rb
UTF-8
500
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require File.expand_path("../test_helper", __FILE__) class Reverser def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) [status, headers, [body.first.reverse]] end end class HelloApp < Nancy::Base use Reverser get "/" do "Hello World" end end class ...
true
b41a253dba970a7d24651b27218dbe447957843c
Ruby
jkisor/weather
/lib/reports_weather/outputs_weather.rb
UTF-8
288
3.171875
3
[]
no_license
class OutputsWeather def self.output(weather) lines = [ "-" * 10, "Date: #{Time.now.strftime("%m/%d/%Y")}", "Time: #{Time.now.strftime("%I:%M %p")}", "Temp: #{weather.temperature}F", "-" * 10 ] text = lines.join("\n") puts text end end
true
8104fa706f0032288af75974e13300673fbfd4bd
Ruby
smarthitarth/Java-Programming-array--list-and-structured-data
/week 2/2fc41686eab7400b796b-b575bd01a58494dfddc1d6429ef0167e709abf9b/only_hamlet_lines.rb
UTF-8
316
3.109375
3
[]
no_license
is_hamlet_speaking = false File.open("hamlet.txt", "r") do |file| file.readlines.each do |line| if is_hamlet_speaking && (line.match(/^ [A-Z]/) || line.strip.empty?) is_hamlet_speaking = false end is_hamlet_speaking = true if line.match("Ham\.") puts line if is_hamlet_speaking end end
true
a7bffc741475c8d9d1ccd43447008a9ceb0faa2e
Ruby
jeltethefacer/excersize_game
/classes/Player.rb
UTF-8
234
3.796875
4
[]
no_license
class Player def initialize (name, health, armor) @name = name @health = health @armor = armor end def puts print <<~HEREDOC naam: #{@name} health: #{@health} armor: #{@armor} HEREDOC end end
true
c147ebab79907aeee1f25baa6a8c51f5a476c457
Ruby
Geoffrey03/ruby_20_exos_et_pyramide
/exo_07B.rb
UTF-8
325
3.765625
4
[]
no_license
puts "Bonjour, c'est quoi ton blase ?" print "> " user_name = gets.chomp puts user_name # Ce programme est très similaire au programme 7a, car il nous pose # la question au début pour nous demander notre nom / "blase" mais # la seule différence avec le premier est qu'il met une ">" avant # notre prénom en l'impriman...
true
26b66a79b1dc0a4c2456070e1bdb4a3057f9cc05
Ruby
ippachi/aoc-2020
/day5/1.rb
UTF-8
1,027
3.546875
4
[]
no_license
max = 0 inputs = %w[ BFFFBBFRRR FFFBBBFRRR BBFFBBFRLL ] inputs = File.read('1.txt').split list = [] inputs.each do |input| row_range = [0, 127] col_range = [0, 7] final_fb = '' final_lr = '' input.each_char do |char| case char when 'F' final_fb = 'F' row_range[1] = row_range[1] + ((r...
true