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
6363e89c8c5b1e6e18b06ef8fd158657621ac808
Ruby
hiroshi-mikuriya/3d_led_cube
/content/ruby/contents/tatsuo98se_trappedmatter/content.rb
UTF-8
8,419
3.53125
4
[ "MIT" ]
permissive
require 'timers' WIDTH = 16 HEIGHT = 32 DEPTH = 8 class RGB def self.white RGB.new(0xff, 0xff, 0xff) end def self.rand(base=0) add = 255 - base RGB.new(base + Kernel::rand(0..add), base + Kernel::rand(0..add), base + Kernel::rand(0..add)) end attr_accessor...
true
4fcc8a8d5d05a36e25edeb7e322a3d7474fe56d7
Ruby
dora1405/slack-cli
/lib/channel.rb
UTF-8
814
3
3
[]
no_license
require_relative 'recipient' class Channel < Recipient attr_reader :topic, :member_count, :detail def initialize(slack_id:, name:, topic:, member_count:, detail:) super(slack_id: slack_id, name: name) @topic = topic @member_count = member_count @detail = detail end # Source Citatio...
true
46ff13000ee440bc7fa697de06143aa6e59099e1
Ruby
Supro/aggregator
/app/models/publication/priceable/calculator.rb
UTF-8
1,205
2.703125
3
[]
no_license
class Publication < ActiveRecord::Base module Priceable class Calculator attr_reader :publication, :rate def initialize(publication) @publication = publication @rate = (publication.creator.rate.to_f/1000) end def total (body_price + title_price + sub_title_price +...
true
d81985feb0250f1a69f58ef0e0122e542118b215
Ruby
musta7188/ruby-oo-object-relationships-has-many-lab-london-web-012720
/lib/author.rb
UTF-8
529
3.171875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "pry" class Author attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def posts Post.all.each {|s|s.author == self} end def add_post(post) post.author = self @@all << self ...
true
588dc75bd0a5d3590953799b1aa9cb05dce68a3e
Ruby
JohannesHupfeld/countdown-to-midnight-onl01-seng-pt-120819
/countdown.rb
UTF-8
309
3.8125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def countdown(input) number = input.abs until number == 0 puts "#{number} SECOND(S)!" number -= 1 end "HAPPY NEW YEAR!" end def countdown_with_sleep(input) number = input.abs until number == 0 puts "#{number} SECOND(S)!" number -= 1 sleep(1) end puts "HAPPY NEW YEAR!" end
true
66084c1d69f703e80fe48c879fcf517d14da26cd
Ruby
misa5555/checker
/test.rb
UTF-8
694
3.140625
3
[]
no_license
require './board' require './piece' require './game' require './player' #print "initial board\n" #print b.render_board #print "================\n" #p piece.perform_moves([[4,3]]) ##p piece.perform_moves([[4,3],[3,4]]) #print b.render_board #p piece.perform_moves([[3,4]]) #print "================\n" #print b.render_bo...
true
eb6cb79cc774fb9c8bef2a87b609e3d6413fc784
Ruby
patrickcandlin/code-wars
/isPrime.rb
UTF-8
1,146
3.84375
4
[]
no_license
def is_prime(num) bool = true if num < 2 return bool = false end if num == 2 || num == 3 || num == 5 return bool = true end if num % 2 == 0 || num % 3 == 0 || num % 5 == 0 return bool = false end index = 5 while index <= Math.sqrt(num) if num % index ==...
true
8dda7f0690b0d400394dfbb1ad0d2b45a34dab2c
Ruby
OmairRaza9/sqlintrofridayassignment3
/assignment3.rb
UTF-8
4,057
3.203125
3
[]
no_license
Find all the robots from Star Wars. \d robots SELECT from robots; SELECT * from robots; SELECT * from robots where source = 'Star Wars' name | source | personality | id ------+-----------+-------------+---- C3PO | Star Wars | anxious | 4 R2D2 | Star Wars | loyal | 8 (2 rows) 2. Find the robot with ...
true
fc6113f2b19a5dc2a8ad6a7b65a94ef8fba2ac2e
Ruby
distro/packo
/lib/packo/host.rb
UTF-8
4,096
2.515625
3
[]
no_license
#-- # Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org] # # This file is part of packo. # # packo is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your ...
true
6d9c4fed33d4bed1f912013693855244253d01a3
Ruby
TheGuth/launch_school
/launch_school_review/ruby_basics_book/ruby_basic_exercises.rb
UTF-8
5,230
4.65625
5
[]
no_license
# Ruby Basic Exercises # Exercise 1. Use the each method of Array to iterate over # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], and print out each value. my_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] my_array.each do |value| puts value end # Exercise 2. Same as above, but only print out values greater than 5. my_array.each d...
true
afc8e692435e5cdd3643de9cadef0e8d9506626d
Ruby
ncoders/rubyrep
/lib/rubyrep/generate_runner.rb
UTF-8
2,745
2.5625
3
[ "MIT" ]
permissive
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'optparse' module RR # This class implements the functionality of the 'generate' command. class GenerateRunner CONFIG_TEMPLATE = <<EOF RR::Initializer::run do |config| config.left = { :adapter => 'postgresql', # or 'mysql' :database => ...
true
94f9f133d56e5bdcf9a7d04b64b24a4b3cfb750c
Ruby
matt-may/wfl
/lib/recommender/lunch_recommender.rb
UTF-8
860
3.125
3
[]
no_license
class LunchRecommender def initialize(user) @user = user end # Attempts to create a recommendation for where a user should eat today, # based on a score for each restaurant in our database that takes into account # the last time the user visited the restaurant, and any ratings. # # Returns an array w...
true
3eff834d103ac11f4d300c9688ac7f416d4ee9c9
Ruby
togusafish/bash0C7-_-cosmicrawler
/lib/cosmicrawler/em/crawler.rb
UTF-8
267
2.671875
3
[ "Ruby" ]
permissive
module Cosmicrawler module Em class Crawler include Em def each collection, &block raise unless block_given? iterate(collection) do |item| block.call item end self end end end end
true
c5fa8f5eccb32ceeb361fcfc886b2c6a21e93862
Ruby
ppomaker/WorldFactbook
/lib/base/base.rb
UTF-8
401
2.796875
3
[]
no_license
class Base def initialize(attributes) attributes.each do |key, value| var_name = "@#{key}" instance_variable_set(var_name, value) end end def method_missing(name) super unless instance_variable_get("@#{name}") instance_variable_get("@#{name}") end def respond_to_missing?(name, i...
true
c34abaeca48c227a517f8a1a3522a65a3bd083d9
Ruby
red-data-tools/red-chainer
/lib/chainer/dataset/convert.rb
UTF-8
2,627
2.796875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Chainer module Dataset module Convert def self.to_device(device, x) # TODO(sonots): Implement after Cumo supports transferring between devices x end def self.concat_examples(batch, device: nil, padding: nil) raise "batch is empty" if batch.size == 0 device...
true
e8d7512f36e70f0bb74a8db8d3dacac2b9fb1d18
Ruby
daviidy/Remote-jobs-scraper
/spec/scraper_spec.rb
UTF-8
2,408
2.78125
3
[]
no_license
require_relative '../lib/scraper' require 'nokogiri' require 'json' describe 'Remote Jobs Scraper' do describe Scraper do let(:scraper) { Scraper.new } let(:parsed_page) { Nokogiri::HTML(open('https://remotive.io/remote-jobs/software-dev')) } describe '#initialize' do it 'scraper.url is a string' d...
true
c09b0f126703797a9dcae05d64c1f4bec9930a31
Ruby
marin-cabac/my-each-v-000
/my_each.rb
UTF-8
103
2.984375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def my_each (r)# put argument(s) here i=0 while i<r.length # code here yield(r[i]) i+=1 end r end
true
00e32317308da75d525860c55bc1fdf5a04930af
Ruby
nutanek/mvc-ruby
/view.rb
UTF-8
235
3.203125
3
[ "MIT" ]
permissive
class SortView def renderSortForm print "Enter set of number: \n" strNumbers = gets.chomp return strNumbers end def renderSortInfo(sortedNumbers) puts "******** sorted nums ********" puts sortedNumbers end end
true
e9aade466d024f5ed3b6d08d2590bd23b11d65b6
Ruby
hiromzn/study-ruby
/0006-method.rb
UTF-8
211
3.296875
3
[]
no_license
puts 'no *() call sample'; puts( '*() call sample' ); puts '### def method' def print_name( name ) puts name end print_name('foo') def add(a, b, c) total = a + b + c return total end puts add(1, 2, 4)
true
d109dc92396d87cbfbb867bd856aa1511b7661ad
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/a58068e0996d4eba96efc30b06484419.rb
UTF-8
410
3.5
4
[]
no_license
class Bob def hey(msg) case msg when shouting then 'Woah, chill out!' when question then 'Sure.' when silent then 'Fine. Be that way!' else 'Whatever.' end end private def shouting lambda { |msg| msg == msg.upcase && !msg.strip.empty? } end def question lambda { |msg...
true
ceb533354acd83f06d514b1f8c39645535941ff4
Ruby
jockeman/Idlarn
/plugins/karma_plugin.rb
UTF-8
2,062
2.703125
3
[]
no_license
# coding: utf-8 class KarmaPlugin < BasePlugin KARMAUP = /^.*\+\+$/ KARMADN = /.*--/ def initialize() @actions = ['karma', 'karmatoppen', 'karmabotten'] @regexps = [KARMAUP,KARMADN] end def action(msg) case msg.message when KARMAUP puts 'karmaup' #if msg.user.last_karma && (Time.n...
true
ed4424ae6e359e62a6e80684b00a0e951297ae1d
Ruby
Global-localhost/resource_index_ruby_client
/test/test_resource_index.rb
UTF-8
3,431
2.515625
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
require "test/unit" require_relative "../lib/ncbo_resource_index_client" class TestResourceIndex < Test::Unit::TestCase APIKEY = ENV["APIKEY"] || "" LOCATION = "http://rest.bioontology.org/resource_index/" def test_apikey raise ArgumentError, "You must provide an API Key" if APIKEY.nil? || APIKEY.empty? e...
true
8a707bd89a68671ad67dddc65473a3ff5c1ddbe7
Ruby
IrinaSTA/Exercism_Ruby
/grains/grains.rb
UTF-8
188
3.28125
3
[]
no_license
class Grains def self.square(n) raise ArgumentError if n > 64 || n <= 0 2 ** (n - 1) end def self.total (1..64).to_a.map { |each| square(each) }.inject("+") end end
true
2fe9c800c3a8a046b42327010e9569ec6744f823
Ruby
maruguu/linebot
/test/test_word-handler.rb
UTF-8
904
3.015625
3
[]
no_license
require './word-handler' require 'test/unit' class TestWordHandler < Test::Unit::TestCase def setup @handler = WordHandler.new(nil) end def test_is_target? assert_equal(true, @handler.is_target?("おはようからおやすみまで")) assert_equal(true, @handler.is_target?("おやすみ")) assert_equal(true, @handler.is_targe...
true
8429cb89cd40cac0dbd2c3e2fc48ac6b952b6a3c
Ruby
tmaria17/night_writer
/lib/english_converter.rb
UTF-8
1,091
3.453125
3
[]
no_license
require_relative "./braille_converter" class EnglishConverter attr_reader :english_library def initialize braille = BrailleConverter.new @english_library = braille.braille_library.invert end def translate(braille_message) scanned = braille_scanner(braille_message) first = first_element(scanne...
true
45cf75b777d73ee2867e8fecf0eee9c50f17ea0e
Ruby
tlgakn/rb_101
/small_problems/09_easy/11_group_anagrams.rb
UTF-8
1,193
4.28125
4
[]
no_license
=begin Group Anagrams Given the array... Write a program that prints out groups of words that are anagrams. Anagrams are words that have the same exact letters in them but in a different order. Your output should look something like this: # ["demo", "dome", "mode"] # ["neon", "none"] #(etc) input: array of words ou...
true
3eeaf9d3c319452a3172a226d9047f38f854d3e3
Ruby
fnc314/Day3_Labs
/Day3_Lab.rb
UTF-8
1,604
3.265625
3
[]
no_license
smoothie_ingredients = { 'flax seeds' => '1 tbsp', 'chia seeds' => '1 tbsp', 'coconut flakes' => '1 tbsp', 'spirulina' => '1 tsp', 'pumpkin seeds' => '1 tbsp', 'oatmeal' => '1/4 cup', 'coco powder' => '1 tbsp', 'peanut butter' => '1 tbsp', 'almonds' => '1/4 cup', 'walnuts' => '1/4 cup', 'spinach' ...
true
3b69ac440f62b44a8d41db90637350f9419d82e4
Ruby
jerryzlau/algorithms
/hackerrank/making_anagram.rb
UTF-8
399
3.609375
4
[]
no_license
def making_anagram(a,b) a = a.chars.sort b = b.chars.sort count = 0 until (a+b).empty? if a.empty? count += b.length b = [] elsif b.empty? count += a.length a = [] elsif a[0] == b[0] a.shift b.shift elsif a[0] < b[0] a.shift count += 1 e...
true
f6536ccc666643fcdec15cd012153172ec249c14
Ruby
tylerbrewer2/eastbound_tags
/app/models/round.rb
UTF-8
529
2.546875
3
[]
no_license
class Round < ApplicationRecord has_many :players after_initialize :init validates :name, presence: true def init self.complete ||= false end def complete_round tag_numbers = players.pluck(:tag_in).sort players.order(:score, :tag_in).each do |player| player...
true
486aa08c7de49ced9dfc403b8168b2e4f5306de5
Ruby
elm-city-craftworks/pr-reporting
/lib/subscription_counter.rb
UTF-8
4,238
2.984375
3
[]
no_license
# This annotated codebase is meant to serve as [Practicing Ruby](http://practicingruby.com) *Issue 2.13*. # While the typical Practicing Ruby issue is published in article format, the subject matter # for this issue seemed to fit a literate-programming format better. # In this issue, I'll discuss how I implemented t...
true
f6cf63ed65de6de1c54c3a2f7c0a10439032e4e1
Ruby
bfontaine/homebrew-changelog
/lib/cache.rb
UTF-8
611
2.921875
3
[ "MIT" ]
permissive
# -*- coding: UTF-8 -*- GLOBAL_PATH = File.expand_path("#{File.dirname(__FILE__)}/../resources/changelogs.txt") class ChangelogsCache attr_reader :path def initialize(path = GLOBAL_PATH) @path = path end def url_for_formula(f) url_for_formula_name(f.full_name) end def url_for_formula_name(name)...
true
219fdc594814a5db4acd8c3f352f2b9cd83f6785
Ruby
slavikdev/design-patterns-in-dynamic-languages
/job-stat.rb
UTF-8
1,480
2.984375
3
[ "MIT" ]
permissive
require 'rss' require 'cgi' RE_FIND = /design\spattern/i LANGS = %w[Ruby JavaScript Python C# Java C++].freeze OUTPUT_FORMAT = '%.2f %% (%d/%d)'.freeze def contains?(text, str) text =~ /#{Regexp.quote(str)}/i end def query_escape(str) CGI.escape(str.downcase) end def html_escape(str) CGI.unescapeHTML(str) end...
true
11599ed72bacbccbfb72ec9f59d92a40ac0811ea
Ruby
SebastianSemper/Project-Euler
/prob_27.rb
UTF-8
947
3.625
4
[]
no_license
=begin Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0. =end def ist_prim(x) #if x % 2 != 0 if ((x+1) % 6) == 0 or ((x-1) % 6) == 0 i = 0 for i in 3..Math.sqrt(x).floor if x %...
true
91d5d3187ccf684e570cfb51e88acc2bc0971341
Ruby
gorsuch/check_http
/lib/check_http/checker.rb
UTF-8
593
2.578125
3
[ "MIT" ]
permissive
module CheckHTTP class Checker attr_accessor :blacklist def initialize self.blacklist = default_blacklist end def default_blacklist [:response_headers, :response_body, :httpauth_avail, :starttransfer_time, :appconnect_time, :pretransfer_time] end def check(url, opts={}) ...
true
7fbdebaecdbfaae3e89bcca0a26179a59d8e18d4
Ruby
yjf172/baidu_geo
/lib/baidu_geo.rb
UTF-8
805
2.609375
3
[ "MIT" ]
permissive
require "baidu_geo/version" require 'rest-client' require 'json' module BaiduGeo AK = "vSpq0zwhjlzDsK8IG5ox7nZNpvs1chjd" def self.address_to_geo(address,ak=AK) url = URI.encode("http://api.map.baidu.com/geocoder/v2/?address=#{address}&output=json&ak=#{ak}") result = JSON.parse(RestClient.get(url).body,sym...
true
a28a0072783e5dfd9d6556912721332da5ddad97
Ruby
t-takaai/WebTeX2
/main.rb
UTF-8
898
2.625
3
[]
no_license
# パッケージの読み込み require 'sinatra' require 'sinatra/base' require 'sinatra/reloader' require 'sqlite3' class FileUpload < Sinatra::Base configure do enable :static enable :sessions end # データベースから読み込み db = SQLite3::Database.new "db/post.db" db.results_as_hash = true # ハッシュとして返し,カラム名でアスセス get '/' do ...
true
833b2e8fbe5018fcf9935d9de56278ed2def0efa
Ruby
amandeep1420/RB101
/RB101/Small Problems/M1r2/7_wordigit.rb
UTF-8
837
3.984375
4
[]
no_license
=begin P - write a method that takes a sentence string as input and returns the same string with any sequence of words representing single-digit numbers converted to a string of digits with spaces between each digit - input: string - output: formatted string - note: I will account for case just to be...
true
e43ae11cad6610f5210b87b3960eb509176f8a87
Ruby
kaievns/twitter-sucker-example
/app/models/sucker.rb
UTF-8
369
2.71875
3
[]
no_license
class Sucker def initialize(keywords) @keywords = keywords end def last_tweet client.search("#{@keywords} -rt", count: 1, lang: 'en', result_type: 'recent').first end private def client @client ||= Twitter::REST::Client.new do |config| TWITTER_CONFIG.each do |key, value| config.se...
true
6923d7c17fa0c5bc2eac10f6f65726788f3146a4
Ruby
firechicago/challenges
/movie-catalog/server.rb
UTF-8
1,040
2.9375
3
[]
no_license
require "sinatra" require "csv" movies = CSV.read("movies.csv") titles = [] movies_hash = Hash.new movies[1..-1].each do |movie| titles << movie[0..1] this_movie_hash = { title:movie[1], year:movie[2], synopsis:movie[3], rating:movie[4], genre:movie[5], studio:movie[6], } movies_hash[...
true
91109f4418099e61586b27f93a015e503b9189c1
Ruby
UbuntuEvangelist/peatio
/bin/transifex
UTF-8
2,966
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'open3' if `which tx`.strip.empty? puts "", "The Transifex client needs to be installed to use this script." puts "Instructions are here: http://docs.transifex.com/developer/client/setup" puts "", "On Mac:", "" puts " curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip....
true
dc79f1d646acdab70623a7b557d2cc77bf3be5c8
Ruby
murajun1978/small_large_equal
/spec/lib/num_spec.rb
UTF-8
1,136
3
3
[]
no_license
require 'num' describe Num do let(:num){Num.new(arg)} context "with a big" do let(:arg){"2 1\n"} it "is a big" do expect(num.match).to eq "2 > 1" end end context "with a small" do let(:arg){"1 2\n"} it "is a small" do expect(num.match).to eq "1 < 2" end end context ...
true
e77d1d667b986cf001cb526aa1879464db70f444
Ruby
acearth/LeetCodePractice
/max_depth_Tree.rb
UTF-8
103
2.75
3
[]
no_license
def max_depth(tree) return 0 if not tree [max_depth(tree.left), max_depth(tree.right)].max + 1 end
true
bef0622ed17366c8d47994f40b76e9bc87089d2e
Ruby
ChristopherDurand/Exercises
/ruby/small-problems/easy3/e06.rb
UTF-8
138
3.234375
3
[ "MIT" ]
permissive
def xor?(a, b) (a && !b) || (b && !a) end puts xor?(true, true) puts xor?(true, false) puts xor?(false, true) puts xor?(false, false)
true
e186021eb3c6c39af1ac7cad67271028f6382a4a
Ruby
adelcambre/herebeforeatreplies
/before.rb
UTF-8
2,674
2.828125
3
[ "MIT" ]
permissive
require 'rubygems' require 'httparty' require 'sinatra' require 'yaml' class TwitterUser include HTTParty class Error < StandardError; end format :json base_uri 'api.twitter.com' def self.created_at(name) user = show(name) if user["error"] == "Not found" return nil elsif user["error"] ...
true
2074f0b8bb18f2e9175cc6c52a9b89bb451865d3
Ruby
madis/dros
/app/services/seed_sources.rb
UTF-8
1,586
2.828125
3
[]
no_license
require_relative 'github_trending' require_relative 'github_api' # Collection of different sources for repositories for using # as seeds and example data class SeedSources # List of trending repos class Trending LANGUAGES = ['ruby', 'javascript', ''].freeze PERIODS = %i(today weekly monthly).freeze de...
true
3b4dfd464035ef557d78d6b2ee3276d413786990
Ruby
openSUSE-zh/discourse-phpbb3-thanks-importer
/lib/thanks_mod/phpbb.rb
UTF-8
725
2.859375
3
[ "MIT" ]
permissive
module ThanksMod # extract thanks from phpbb3 mysql database class PHPBB def initialize(con) @con = con end def get read_data_from_thanks_table end private def read_data_from_thanks_table thanks_data = @con.query("SELECT * FROM phpbb_thanks") data = [] thanks...
true
503b23f835c370f9d6aaca6b03d2a03fbc81b997
Ruby
klaethecoder/RubyExercises
/address.rb
UTF-8
591
3.25
3
[]
no_license
class Address attr_accessor :kind, :street1, :street2, :city, :state, :zipCode def to_s(format = 'short') address = '' case format when 'long' address += "-#{kind}-\n#{street1} " if !street2.nil? address += "#{street2} \n" end add...
true
eac98ca0129dc7ccd4d41b790980b49939672179
Ruby
Dynflow/dynflow
/lib/dynflow/middleware/resolver.rb
UTF-8
1,653
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'tsort' module Dynflow class Middleware::Resolver include TSort include Algebrick::TypeCheck def initialize(register) @register = Type! register, Middleware::Register end def result @result ||= begin @deps = normalize_rules(@register.ru...
true
1d0dc90a60a354d28a32e031ad22022c0a1074ec
Ruby
Debora38/oystercard
/spec/station_spec.rb
UTF-8
752
2.75
3
[]
no_license
require 'station' RSpec.describe Station do describe "#name" do let(:kingscross) { described_class.new('London Kings Cross', 1) } it "should respond to #name" do expect(kingscross).to respond_to :name end it "should pass a name to the instance variable" do wood_green = described_class....
true
a043758a28d058671471092a3075e9adb691e2c0
Ruby
Vishnukulangara/vkrepo
/reservation.rb
UTF-8
523
2.890625
3
[]
no_license
#!/usr/bin ruby class Reservation attr_accessor :name attr_accessor :frm_date attr_accessor :to_date require "date" end a=[] i=0 while i<10 do obj=Reservation.new obj.name="guest#{i+1}" require "date" obj.frm_date=Date.new(2016,06,22)+(2*i) obj.to_date=Date.new(2016,06,26)+(2*i) a<<[obj.name,obj.frm_date,...
true
53dd03efb10589af7d3f193385a519d0b8fca423
Ruby
Draganovic/skill-inventory-crud
/app/models/skill_inventory.rb
UTF-8
666
2.828125
3
[]
no_license
require 'yaml/store' class SkillInventory attr_reader :database def initialize(database) @database = database end def create(skill) database.from(:skills).insert(skill) end def all result = database.from(:skills).map { |data| Skill.new(data) } end def find(id) result = database.from(...
true
6ac6a795715e6ea43e1f0b68ad72a0718cdd8749
Ruby
adam-larosa/ruby-oo-practice-anagram-detector-sea01-seng-ft-082420
/lib/anagram.rb
UTF-8
177
3.484375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' class Anagram def initialize(word) @word = word end def match(array) array.select {|w| @word.split('').sort.join == w.split('').sort.join} end end
true
5f9e7d335244c0044976208f8811749e72f8c14e
Ruby
DumboCL/launch-school
/exercises/ruby-challenges/easy-1/07-point-mutations/07_dna.rb
UTF-8
211
3.40625
3
[]
no_license
class DNA def initialize(base) @base = base end def hamming_distance(dna) size = dna.size @base[0, size].chars.select.with_index do |chr, index| chr != dna[index] end.count end end
true
174fd769fd7b4b555c6f01e5c0a0fee503311390
Ruby
schnittchen/henk
/lib/henk/step.rb
UTF-8
974
2.671875
3
[ "MIT" ]
permissive
module Henk class Step attr_reader :image def initialize(henk, *args) @henk = henk @arguments = args end # called with container id (string) and exit code (numeric) def after_wait(&block) @after_wait_block = block end # called with container id (string) and exit code (...
true
8b13d6b6fe75d4e1b63244fea931d5c73bcb014d
Ruby
noahhh/currency
/test/Currency_test.rb
UTF-8
1,234
3.0625
3
[]
no_license
require "minitest/autorun" require "Currency" class CurrencyTest < MiniTest::Unit::TestCase def test_currency_has_amount_and_code currency = Currency.new(5, "USD") refute_nil currency end def test_different_currency_objects_equal_eachother amount = Currency.new(9, "EUR") different_amount = Curre...
true
b41e05f2e71accc2a54083cef35a22874f7d71c8
Ruby
marystrohanova/upwork_test_task
/pages/search_results_page.rb
UTF-8
2,347
2.90625
3
[]
no_license
require './tests/test_base' require './lib/hooks' require './lib/steps_logger' require './pages/freelancer_profile_page' class SearchResultsPage def initialize @driver = Hooks.driver @wait = Selenium::WebDriver::Wait.new(timeout: 15) @logger = StepsLogger.new end def is_loaded? @logger.write(...
true
a9f64f603ef83f4a80c3ce904e21f9bf0defd0d2
Ruby
asnyder13/virginia-tech-hacks
/generate-classes-json.rb
UTF-8
2,175
3.015625
3
[ "MIT" ]
permissive
#!/usr/bin/ruby # Fetches all Virginia Tech classes from the timetable and spits them out into a nice JSON object # Can be run with option of which file to save output to or will save to classes.json by default require 'rubygems' require 'mechanize' require 'nokogiri' require 'json' #Create Mechanize Browser and Class...
true
cf10b98f83b9abddfc97e9630c06e16000f72b30
Ruby
Lampost42/oo-student-scraper-v-000
/lib/scraper.rb
UTF-8
1,140
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'open-uri' require 'nokogiri' require 'pry' class Scraper def self.scrape_index_page(index_url) students = [] doc = Nokogiri::HTML(open(index_url)) students_doc = doc.css(".roster-cards-container") student_list = students_doc.css(".student-card").map{|e| e} student_list.each {|student| s...
true
f64efc0673553fc5887cdd7ca1fda7408a90d68d
Ruby
bahmansadiq/phase-0-tracks
/ruby/shout.rb
UTF-8
425
3.703125
4
[]
no_license
module Shout def yell_angrily(words) words + "!!!" + " :(" end def yelling_happy(name) p name end end #Shout.yelling_happy("Yelling Happy") class Noise_poluion include Shout end class Yelling_sound include Shout end noise=Noise_poluion.new p noise.yell_angrily("...
true
feecffcf00cb38ad024892ca4a3b56c49cd014b1
Ruby
dblock/slack-ruby-bot
/spec/slack-ruby-bot/commands/commands_spec.rb
UTF-8
1,892
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true describe SlackRubyBot::Commands do let! :command do Class.new(SlackRubyBot::Commands::Base) do command 'sayhi' command 'saybye' def self.call(client, data, match) client.say(channel: data.channel, text: "#{match[:command]}: #{match[:expression]}") en...
true
c8172e58d80116441b19c63ebee93046f1d5cbe8
Ruby
Kinasu/mendeleev
/mendeleev.rb
UTF-8
974
3.515625
4
[]
no_license
require 'json' file = File.read('mendeleev.json', encoding: 'utf-8') elements = JSON.parse(file) # выводим пользователю что у нас есть — вместе с количеством элементов puts puts "У нас всего элементов: #{elements.keys.size}" puts elements.keys puts puts "О каком элементе хотите узнать?" element = gets.chomp # провер...
true
e1fc72a30c0ffa74d1b7c42ac784aae31b903174
Ruby
hallyvictoria/mini-jeu-POO
/app.rb
UTF-8
483
2.796875
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/player' # ref aux fichiers dans le lib require_relative 'lib/game' player1 = Player.new("Josiane") # définit les player Josiane et José player2 = Player.new("José") round = Fight.new # initialise le combat round.presentation(player1,player2) # fait tourner la ...
true
d07d92317310b42919a97b9cefc639238560dc95
Ruby
jnsya/chess
/spec/pieces_spec.rb
UTF-8
5,943
3.359375
3
[]
no_license
require File.expand_path("../../lib/pieces", __FILE__) describe Pawn do describe "#moveset" do context 'white pawn' do context 'on its first move' do subject(:pawn) {Pawn.new(:white, [6,2], true)} context 'with an empty square in front' do it 'can move two squares forward' do...
true
276063ee3bcd079549b502d8801da5109d78b718
Ruby
yumojin/Example-Sketches
/samples/processing_app/library/video/movie/reverse.rb
UTF-8
1,143
2.578125
3
[ "MIT" ]
permissive
# # Reverse playback example. # # The Movie.speed method allows to change the playback speed. # Use negative values for backwards playback. Note that not all # video formats support backwards playback. This depends on the # underlying gstreamer plugins used by gsvideo. For example, the # theora codec does support backw...
true
52e94d1efe7ad4b6b45c73fa66828abdab043749
Ruby
Gerula/interviews
/LeetCode/remote/majority_element.rb
UTF-8
776
3.65625
4
[ "MIT" ]
permissive
# https://leetcode.com/problems/majority-element/ # Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. # # You may assume that the array is non-empty and the majority element always exist in the array. # # https://leetcode.com/submissio...
true
926d7dfde55e932dbe87382979db053fe021a2dd
Ruby
deber116/programming-univbasics-nds-nds-to-insight-with-methods-chicago-web-021720
/lib/nds_extract.rb
UTF-8
1,691
3.203125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'directors_database' require 'pp' # Find a way to accumulate the :worldwide_grosses and return that Integer # using director_data as input def gross_for_director(director_data) movies_array = director_data[:movies] movies_array_index = 0 gross_income = 0 while...
true
0a6da78fbffd7ca0f2247b40fd99ed04b46abf6c
Ruby
esugano/side-hustle-cli-app
/lib/side_hustle/odds.rb
UTF-8
539
3.328125
3
[ "MIT" ]
permissive
class SideHustle::Odds attr_accessor :name, :odds, :teams @@all = [] def initialize(name, odds) @name = name @odds = odds @@all << self end def self.all @@all end def self.list_teams @teams = [] @@all.each do |team| @teams << team.name.upcase end @teams end #r...
true
d8cc0ff844244ba8379295157584dd2c137f7e3a
Ruby
mkrahu/launchschool
/exercises/ruby_basics/vers1/methods/greet_through_methods_p2.rb
UTF-8
212
3.515625
4
[]
no_license
# greet_through_methods_p2.rb # Greet Through Methods (Part 2) exercise # Ruby Basics exercises from LaunchSchool def hello "Hello" end def world "World" end def greet hello + ' ' + world end puts greet
true
6afd905da5ebe5e3d14d0c4b41e2270d05678633
Ruby
sergiobr/Futures-Exchange-Example
/lib/buyers.rb
UTF-8
2,619
2.671875
3
[]
no_license
require 'eventmachine' require 'securerandom' require 'logger' require 'em-redis' $: << "." << "lib" require 'participant' require 'security' module MarketParticipationClient def post_init redis = EM::Protocols::Redis.connect logger = Logger.new("logs/development.log") # Every second for the next peri...
true
1b623c6ebf7eb67fa5fd8ba6a48530c0dec01806
Ruby
plemiszki/flash-cards
/app/models/spanish_noun.rb
UTF-8
809
2.65625
3
[]
no_license
class SpanishNoun < ActiveRecord::Base validates_presence_of :english, :english_plural, :spanish, :spanish_plural, :gender validates_uniqueness_of :english, scope: :spanish, message: '/ Spanish combo already used' has_many :card_tags, as: :cardtagable, dependent: :destroy has_many :tags, through: :card_tags ...
true
c289470e1a4223c38f2dfa400fe50e7e50ec09a5
Ruby
tae8838/advent_of_code_2019
/1/1.rb
UTF-8
195
3.4375
3
[]
no_license
def get_fuel_required(mass) (mass.to_i / 3).floor - 2 end file = File.open('1.txt') mass_list = file.readlines.map(&:chomp) p mass_list.inject(0) { |sum, mass| sum + get_fuel_required(mass) }
true
d9909354fadf92261154a3cd826b3be60f924be2
Ruby
polyfox/moon-packages-mock
/spec/moon/mock/vector2_spec.rb
UTF-8
3,892
3.265625
3
[]
no_license
require 'spec_helper' require 'moon-mock/vector2' describe Moon::Vector2 do context '#initialize' do it 'initializes the vector without parameters' do v = described_class.new expect(v.x).to eq(0.0) expect(v.y).to eq(0.0) end it 'initializes the vector with a parameter' do v = des...
true
bcb35add8653f183f0ed69b1c7c245d421515676
Ruby
ethansr/icl_capture
/lib/icl_capture/capture_buddy.rb
UTF-8
697
2.6875
3
[]
no_license
class CaptureBuddy attr_accessor :video_device, :audio_device, :file_system def initialize find_uvc_device find_audio_device find_file_system end def capture_name `hostname`.strip + '_' + Time.now.utc.strftime("%m-%d-%Y_%H:%M:%S") end def find_file_system @file_system = CaptureSt...
true
8fd6e6762c87f20f2f54f82f8a5dcb7ffc2f1932
Ruby
Hakon/dominus
/lib/dominus/document.rb
UTF-8
569
2.640625
3
[ "MIT" ]
permissive
require "delegate" module Dominus class Document < SimpleDelegator def self.cleanup(doc) proc { doc.recycle } end def initialize(doc) super(doc) ObjectSpace.define_finalizer(self, self.class.cleanup(doc)) end def [](key) values = get_item_value(key) if(values....
true
672131887e73d0a7826802e8bc62e2fa34e49429
Ruby
dannyk03/byte-server
/app/models/hour_operation.rb
UTF-8
2,146
2.875
3
[]
no_license
class HourOperation < ActiveRecord::Base attr_accessible :day, :group_hour, :location_id, :time_close, :time_open belongs_to :location # Begin - hour of operation - New def self.get_hour_operation_v1(location_id) hours = HourOperation.where("location_id = ? and day < ?", location_id, 9).order("day ASC") ...
true
40adcf4fac7c8d6c0e046370de70edd4097119c1
Ruby
miwest929/rspec-perf
/lib/rspec_perf/benchmark_sample.rb
UTF-8
334
2.890625
3
[]
no_license
require 'benchmark' class BenchmarkSample def self.measure(sample_size) results = [] while results.count < sample_size do r = Benchmark.realtime { yield } r_ms = (r * 1000).round(2) # If response time is zero then ignore run and continue. results << r_ms if r_ms > 0 end resu...
true
4bae11f42ca7ec49b9afcce1868d555a343ad0f2
Ruby
ladeeluc/Rspec_practice-lighting_poker
/Rspec_practice-lighting_poker/lib/card.rb
UTF-8
1,251
3.1875
3
[]
no_license
class Card def initialize(suit:, rank:) @suit = suit @rank = case rank when :jack then 11 when :queen then 12 when :king then 13 else rank end end def suit @suit end def rank @rank end end RSpec.describe 'a p...
true
39a0e1f0283e67650f6d9bc1887a36de1e26fe71
Ruby
ngoziharrison/ruby-scripts
/wordcount/getFiles.rb
UTF-8
938
3.125
3
[]
no_license
require 'rubygems' require 'nokogiri' require 'open-uri' def getText(doc) heading = "" doc.css('h1.firstHeading > span').each {|head| heading = head.content} #->This block stores the title of the page in a variable doc.css('p').each do |text| open("#{heading}" + ".txt", "a") do |out| #->This block takes the co...
true
2cde8edd122663c53ec66d6116683342696ed971
Ruby
niftyrifty/scheduler
/controllers/appointment_controller.rb
UTF-8
3,092
3.140625
3
[]
no_license
require 'tty-prompt' require 'date' require_relative '../models/appointment' require_relative './provider_controller' DAY_OF_WEEK = { 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', 0 => 'Sunday' } class AppointmentControl...
true
b049019e397766a1b3e8b52e305e0b9ce5baaa9a
Ruby
isaacmtz90/Web-API
/controllers/event.rb
UTF-8
1,419
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true # Controller for the events class EventsLocatorAPI < Sinatra::Base # route to find events based on location defined by # latitude[-90<>90] & longitude[-180<>180] get "/#{API_VER}/events/search/:city/:term" do results = SearchByText.call(params) content_type 'application/json...
true
ea295323fdd590870928631aa2a9497c5d24597c
Ruby
himanushi/music-server
/lib/apple_music/album.rb
UTF-8
5,518
2.5625
3
[]
no_license
# frozen_string_literal: true module AppleMusic class Album class << self def create_full(apple_music_id, force: false) am_album = ::AppleMusicAlbum.find_by(apple_music_id: apple_music_id) return am_album unless !am_album || force return unless ::IgnoreContent.where(music_service_i...
true
950377f4e41b329b43ee2971fdd3b402db308934
Ruby
michaelpmattson/battleship
/spec/game_spec.rb
UTF-8
4,273
3.5
4
[]
no_license
require './lib/game' require './lib/board' require './lib/ship' require './lib/cell' RSpec.describe Game do context '#initialize' do it 'exists' do game = Game.new expect(game).to be_instance_of(Game) end it 'has attributes' do game = Game.new expect(game.human).to be_instance_...
true
58f5005e6e069c41818915adaa6a11564f2c7820
Ruby
markryall/.spacemacs.d
/bin/iterm_command_click.rb
UTF-8
2,330
2.71875
3
[]
no_license
#!/usr/bin/env ruby # Step 1: Copy this script somewhere # cp bin/iterm_command_click.rb ~ # Step 2: Set iTerm2 preferences # Profiles > Advanced > "Semantic History" # Choose "Always run command..." and enter: # ~/iterm_command_click "\1" "\2" "\3" "\4" "\5" filename, linenumber, _textbefore, _textafter, workingdir...
true
9fdcc955139f4182f7754ba4041dd310b66f20da
Ruby
simianarmy/vindicia-api
/lib/vindicia/util.rb
UTF-8
268
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Vindicia module Util # Taken from Rails 3.0.4 ActiveSupport::Inflector def self.camelize(lower_case_and_underscored_word) lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } end end end
true
d2d759b80ec59fecbb8959c6b8c994852eca3251
Ruby
obellech10/intro_to_ruby_exercises
/flow_control/case_statement.rb
UTF-8
212
3.984375
4
[]
no_license
#case_statement.rb a = 5 answer = case a when 5 "a is 5" when 6 "a is 6" else "a is neither 5, nor 6" end puts answer a = "false" if a puts "How can this be true?" else puts "This is not true" end
true
c4d3a0334cc150d2b5c2117b9ba2491c6539b28b
Ruby
tdy/coltrane
/exe/coltrane
UTF-8
1,630
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require 'paint' require 'color' require 'pedrozath-mercenary' require 'coltrane/commands' if ENV['COLORTERM'] == 'truecolor' Paint.mode = 0xFFFFFF else Paint.mode = 0 puts "This terminal doesn't seem ...
true
42b3bc6de9ff486cf19f721315c1782d362cf52b
Ruby
mbacovsky/foreman_cli_draft
/kartit/lib/kartit/exception_handler.rb
UTF-8
916
2.765625
3
[]
no_license
require 'rest_client' module Kartit class ExceptionHandler def initialize options={} @output = options[:output] or raise "Missing option output" end def mappings { RestClient::ResourceNotFound => :handle_not_found, RestClient::Unauthorized => :handle_unauthorized } ...
true
529a39d56fb2128c3ef233cb04ef28ba29fb71e2
Ruby
jjwumaster/project-euler-multiples-3-5-web-103017
/lib/multiples.rb
UTF-8
381
3.578125
4
[]
no_license
# Enter your procedural solution here! require 'pry' def collect_multiples(max) r = (1..max - 1).to_a r.select do |num| num % 3 == 0 || num % 5 == 0 end end def sum_multiples(max) r = (1..max - 1).to_a r.inject(0) do |sum, num| puts "#{sum}, #{num}" # binding.pry if num % 3 == 0 || num % ...
true
51cfeb14f7cbf1c4d01bc1d1eadc4b064f6d024a
Ruby
harrylb14/Portfolio
/Week2_Materials/Dependency_Injection_Workshop/Exercise1/spec/Exercise1_spec.rb
UTF-8
765
2.796875
3
[]
no_license
require 'Exercise1' describe Note do let(:subject) { described_class.new("Hello", "Body", formatter) } let(:formatter) { double :noteformatter, format: "Title: Hello\nBody" } it 'has a title' do expect(subject.title).to eq "Hello" end it 'has a body' do expect(subject.body).to eq "Body" end ...
true
1307baa7bab4f7770ede4480f28d0696c313194e
Ruby
mnamor/day_5_thp
/cesar.rb
UTF-8
501
3.625
4
[]
no_license
#definire une constante avec comme parametre texte et number def chiffre_de_cesar(text, number) #parametre de la constante texte converti en valeur ascii text_to_ascii = text.chars.map(&:ord) #chiffrement du texte ascii shifted = text_to_ascii.map { |a| a + number} #rotation du texte ascii en chiffrage rotated_string =...
true
487c23379ef94bf99135beaff29beacd6048a652
Ruby
nicosuave/lisp
/spec/lib/lisp/parser_spec.rb
UTF-8
1,704
3.03125
3
[ "MIT" ]
permissive
require 'spec_helper' describe Lisp::Parser do subject { described_class.new } describe "#read_from_tokens" do context "when the tokens are empty" do it "raises a lisp syntax exception" do expect { subject.read_from_tokens([]) }.to raise_exception Lisp::Parser::LispSyntaxError end end ...
true
c7c0d19e9c778582ebcddfadb8e74999c98d93b6
Ruby
codeforichikawa/5374-script
/make_target.rb
UTF-8
749
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'json' require 'csv' TYPE_FILE="type.json" DICTIONARY_FILE="dictionary.json" OUTPUT_FILE="target.csv" types = {} File.open(TYPE_FILE) do |file| json = JSON.load(file) json["array"]["dict"].each do |dict| types[dict["string"][3]] = dict["string"][2] end en...
true
a7bb3567ad0757c8a8899afa0b6bac2c6961e8bb
Ruby
CodingMBA/ls_101_small_probs_medium
/med102.rb
UTF-8
234
3.5625
4
[]
no_license
def rotate_array(array) array[1..-1] + [array[0]] end def rotate_rightmost_digits(number, n) digits = number.to_s.chars digits[-n..-1] = rotate_array(digits[-n..-1]) digits.join.to_i end p rotate_rightmost_digits(735291, 4)
true
9ecab1db7fb5c9a51af376b65dd6b8326e4d5d08
Ruby
wimsy/euler
/euler0025.rb
UTF-8
163
3.25
3
[]
no_license
i = 3 fibTerm = [1, 1, 2] while fibTerm[2].to_s.split("").length < 1000 fibTerm[0] = fibTerm[1]+fibTerm[2] fibTerm.rotate! i +=1 end puts fibTerm puts i
true
d18a5e31f478be373bb33a2f58270aa2cae30253
Ruby
vkaelin/YouTogether
/test/system/rooms_test.rb
UTF-8
5,661
2.703125
3
[ "MIT" ]
permissive
require "application_system_test_case" class RoomsTest < ApplicationSystemTestCase test 'create new room' do user = User.new email: 'test@epfl.ch', name: 'Test', password: 'password' user.save! visit(login_path({ locale: 'en' })) fill_in('Email', with: user.email) fill_in('password', with: user....
true
c6bd56ae2edf459e5b432d3c71a33ad60fd7397a
Ruby
ktlacaelel/ix
/bin/ix-show-tabs
UTF-8
108
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby STDIN.each_line do |line| print line.gsub(/(\t+)/, "\\1\e[0;0;41m<--- tab\e[0m") end
true
d45e21b5200c40b5991f395a578295cfbaeb2926
Ruby
zRouth/Mastermind
/sequence_generator.rb
UTF-8
335
3.171875
3
[]
no_license
class SequenceGenerator attr_reader :colors, :sequence def initialize @colors = ['r','g','b','y'] @sequence = '' end def generate_sequence 4.times.map { @colors.sample }.join end end # # def make_sequence # @colors.each do |color| # @colors.shuffle! # @sequence += @colors[0]...
true
61f326898109ae9fcf0f1e3b2089e43a0dd3d288
Ruby
dhgrainger/doug_grainger_csv_group_exercise
/app/models/csv_inspector.rb
UTF-8
4,551
2.71875
3
[]
no_license
require 'csv' class CsvInspector def table_name(csv) table_name = csv.split('/').last.split('.').first end def modified_file_name(table_name, matching_type) Rails.root + "tmp/" + "#{table_name}_matched_by_#{matching_type}.csv" end def upload_csv_to_table(csv, table_name) headers = CSV.read(csv,...
true
1679a1e0000a9eab06518484f080f8472b37ccf0
Ruby
carmencampise/oo-cash-register-cb-000
/lib/cash_register.rb
UTF-8
675
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class CashRegister attr_accessor :total, :discount, :items def initialize(discount=0) @total = 0 @discount = discount @items = [] end def add_item(item, price, quantity=1) @transaction_total = price * quantity @transaction_items = Array.new(quantity, item) @total += @transaction_total...
true
0d38e3060edcf00ae8e65091f922d2f4412d6345
Ruby
sociallyRK/Algorithms
/Algorithms/Round Table.rb
UTF-8
585
3.703125
4
[]
no_license
def cake_seeker(people, starting_person) count = 0 people.each do |person| if person == "X" count += 1 else cake_winner = person end end if count == people.length - 1 people[cake_winner] else people[starting_person + 2] = "X" if starting_person == people.length - 1 ...
true