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
896346463075f2de11c5bb0eaa4af0ef7997f3ca
Ruby
krastina/date_night
/lib/date_night.rb
UTF-8
1,829
3.875
4
[]
no_license
require_relative "binary_search_tree" tree = BinarySearchTree.new puts "Welcome to date night!" puts "Type 'commands' to see available tree methods." puts "Type 'quit' to leave date night." input = nil until input == "quit" input = gets.chomp case input when "commands" then puts "You can...
true
0a94ee9c1d399479523122a6d4705a9ceebdd78b
Ruby
yuhanlyu/coding-challenge
/codeeval/email_validation.rb
UTF-8
154
2.6875
3
[]
no_license
File.open(ARGV[0]).each_line do |line| puts line.strip.match(/(?:^[^ @"<>]+|".*")@(?:[A-Z0-9]+?(?:-*[A-Z0-9]+)*\.)+[A-Z]+$/i) ? "true" : "false" end
true
e5bf303aab48c79e5507980d20d5695dac51d842
Ruby
sabtain93/rb_101_small_problems
/easy_1/03.rb
UTF-8
1,124
4.96875
5
[]
no_license
# Write a method that takes one argument, a positive int # and returns a list of the digits in that number # input = positive integer # output = list of integers (array) # Given a positive integer of any length # Split it up into an array # Each element in the array is a single digit in the integer # Put array into ...
true
c29654968c9f1e13dd8d3aa69aac5e7a0ddb12f1
Ruby
jcigale/classwork_review
/week1/rspec_exercise_5/lib/exercise.rb
UTF-8
459
3.515625
4
[]
no_license
def zip(*arrays) length = arrays.first.length zipped = [] (0...length).each do |i| zipped << arrays.map {|arr| arr[i]} end zipped end def prizz_proc(arr, prc1, prc2) arr.select do |ele| (prc1.call(ele) == true && prc2.call(ele) == false) || (prc1.call(ele) == false && prc2.cal...
true
7c17298b3bb27a01c2bc9aa98928a0d245bf58e3
Ruby
jhund/rails-data-explorer
/lib/rails_data_explorer/statistics/rng_category.rb
UTF-8
1,571
3.109375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- class RailsDataExplorer module Statistics # Responsibilities: # * Provide random categorical data. Useful for testing and demo data. # class RngCategory # @param categories [Array<Object>] the pool of available categories. # @param category_probabilities [Array,...
true
f04ad92d154c60f7c1091d9b307feba40f759770
Ruby
Tambi-Mat/oystercard
/spec/station_spec.rb
UTF-8
301
2.515625
3
[]
no_license
require 'station' describe Station do subject(:station) { described_class.new("Paddington",1)} it 'has a name attribute on initialization' do expect(station.station_name).to eq "Paddington" end it 'has a zone attribute on initialization' do expect(station.zone).to eq 1 end end
true
c17ecf10614e4df0feefa153d54787b0e5754081
Ruby
tarun-pacifica/wdi6
/angela_mikulasev/mta1/mta_multi.rb
UTF-8
1,115
3.59375
4
[]
no_license
# given that I am on Line N # and I am at station 28th # When I change to station 6th on line L # I should have stopped at 3 stations lines = { 'n' => ['Times Square', '34th', '28th', '23rd', 'Union Square', '8th'], 'l' => ['8th', '6th', 'Union Square', '3rd', '1st'], '6' => ['Grand Central', '33rd', '28th', 'Un...
true
32f6cba67c9ada274b9d4b71e2733a3d2abbb7ef
Ruby
scotdalton/ceely
/lib/ceely/scales/ptolemaic.rb
UTF-8
1,265
2.84375
3
[ "MIT" ]
permissive
module Ceely module Scales module Ptolemaic # A Ptolemaic::Note is a Pythagorean Note # but tweaked class Note < Ceely::Scales::Pythagorean::Note def octave_adjusted_factor @octave_adjusted_factor ||= case index when -5, -4, -3 syntonic_comma * super ...
true
ec413261e9d34baa06a3dd157d0fef4ee8f64bfc
Ruby
VidgarVii/Thinknetica
/Base Ruby/lesson_3_OOP/lib/cargo_wagon.rb
UTF-8
479
3.328125
3
[]
no_license
class CargoWagon < Wagon attr_reader :free_volume, :occupied_volume alias free free_volume alias occupied occupied_volume def initialize(volume = 86.4) super('cargo') @free_volume = volume @occupied_volume = 0 end def take_volume(volume) check_free_volume!(volume) @free_volume -= volum...
true
af3667f613f10a55a6e4d5b4b4adbca27130a06d
Ruby
failure-driven/remote-button
/lib/tasks/quote_fake.rake
UTF-8
1,446
3.046875
3
[]
no_license
# rails fetch_quotes[https://source.of.quotes.url] desc "fetch quotes" task :fetch_quotes, %i[quote_url] => :environment do |_, args| quote_url = args[:quote_url] doc = Nokogiri::HTML(URI.parse(quote_url).open.read) quotes = doc.search("ol").map do |ol| ol.search("li span") .map(&:text) .map(&:str...
true
867fe5d1a1213c619997eea428f3ee29bc135cfe
Ruby
Far-Traveller/THP_projects
/w04_d1_gossip_project_sinatra/lib/gossip.rb
UTF-8
1,486
3.3125
3
[]
no_license
require 'csv' class Gossip attr_accessor :author, :content def initialize(author, content) @author = author @content = content end def save #append mode (ab) : permet d'ajouter CSV.open("./db/gossip.csv", "ab") do |csv| csv << [@author,@content] end end def self.all all_gossips...
true
1973bb013a8f939ac3cf3270c1d66e88e6bb9b49
Ruby
Vishal0203/really-simple-history-api
/parse-wikipedia.rb
UTF-8
3,663
2.53125
3
[]
no_license
#!/usr/bin/env ruby require "rubygems" require "bundler/setup" require 'rest_client' require 'media_wiki' require 'json' mw = MediaWiki::Gateway.new('http://en.wikipedia.org/w/api.php') span = Date.new(2000, 1, 1)..Date.new(2000, 12, 31) span.each { |x| actual_date = x.strftime("%m-%d") wiki_date = x.strftime...
true
871aa5b371ccad702ac5829b018c1f90fa7126f1
Ruby
nanoaguayo/IIC3103-2017-G4
/IIC3103-G4-API/app/controllers/concerns/banco.rb
UTF-8
2,663
2.640625
3
[]
no_license
require 'rails/all' require 'openssl' require "base64" require 'httparty' module Banco BANK_URI = Rails.env.development? && "http://integracion-2017-dev.herokuapp.com/banco/" || Rails.env.production? && "https://integracion-2017-prod.herokuapp.com/banco/" CUENTA_URI = Rails.env.development? && "https://integracion...
true
711336b4c2277bd067177e108cd842dedc5e1449
Ruby
state-machines/state_machines
/test/unit/branch/branch_with_multiple_implicit_requirements_test.rb
UTF-8
1,826
2.53125
3
[ "MIT" ]
permissive
require 'test_helper' class BranchWithMultipleImplicitRequirementsTest < StateMachinesTest def setup @object = Object.new @branch = StateMachines::Branch.new(parked: :idling, idling: :first_gear, on: :ignite) end def test_should_create_multiple_state_requirements assert_equal 2, @branch.state_requir...
true
9e5c215a36dc28afe3fb598b78f119af0f92d2e1
Ruby
ThomasRoest/ruby-practice
/ruby-basics/loops_iteration/iteration2.rb
UTF-8
420
4.09375
4
[]
no_license
puts 23 array = %w(dog cat giraf bob) array.each do |a| rev = a.reverse if rev == a puts a + " is a palindrome!" else puts a + " is not" end # puts "this is the word #{a} in reverse\n" # puts a.reverse # if end def fizz_buzz(num) num.times do |n| if n % 2 == 0 puts n p...
true
913babfda842138866c6b995dfc784722b850d0e
Ruby
nixworks/big-o
/lib/big-o/exceptions.rb
UTF-8
1,055
3.171875
3
[ "MIT" ]
permissive
module BigO # The function could not be run more than X times (where X is a configurable value). # # This exception happens if the function is too slow to run, or if the timeout is too short. class SmallResultSetError < StandardError # Sets default message. # # @param [Integer] resultset_size number...
true
4f11939d6ad07c5810f8ec868210b6214dbe6221
Ruby
cmarion-mq/S03-J1
/tests-ruby-master/lib/02_calculator.rb
UTF-8
346
3.40625
3
[]
no_license
def add(x,y) return x.to_f + y.to_f end def subtract(x,y) return x.to_f - y.to_f end def sum(array) sum=0 return array.sum end def multiply(x,y) return x.to_f * y.to_f end def power(x,y) return x.to_f ** y.to_f end def factorial(n) if n == 0 return 1 else return (1.....
true
3672792d10ee964774c5a9edbe364f0a7750c326
Ruby
molenzwiebel/lambda
/lib/λ/ast.rb
UTF-8
2,147
3
3
[]
no_license
module Lambda class Visitor def visit_any(node) nil end end class ASTNode attr_accessor :filename, :line def self.attrs(*fields) attr_accessor *fields define_method "==" do |other| return false unless other.class == self...
true
c0cb0c672c197301d31262d8d16ef53bb673e2cd
Ruby
lvivdev/lesson2
/app3.rb
UTF-8
188
3.921875
4
[]
no_license
print "Enter your name: " myname = gets.chomp puts "Hello " + myname print "Enter your age: " age = gets.chomp puts "Your age is " + age print "Hello #{myname} your age is #{age} "
true
a83c998775fc712e8fc5b2b0924cd61d269d5f2a
Ruby
RavensKrag/rubyOF
/bin/projects/livecode2/lib/UI_model.rb
UTF-8
893
2.625
3
[]
no_license
class UI_Model def initialize super() @step_delay = 10 @step_i = 0 end state_machine :update_mode, :initial => :manual_stepping do state :manual_stepping do end state :auto_stepping do end state :running do end # -----...
true
87c79592aaf486357a36ea4cbb11969c3fad70e8
Ruby
SuelyBarreto/slack-cli
/lib/workspace.rb
UTF-8
1,240
3.203125
3
[]
no_license
require_relative 'user' require_relative 'channel' class Workspace # Generator attr_reader :users, :channels, :selected # Constructor def initialize @users = User.list_all @channels = Channel.list_all @selected = nil end # Method to select a channel def select_channel(param) raise Ar...
true
e07f85336f5a426b68acb5118456e62f3b162f25
Ruby
schacon/retrospectiva
/vendor/plugins/wiki_engine/lib/wiki_engine/engines.rb
UTF-8
5,799
2.796875
3
[ "MIT", "MIT-0" ]
permissive
module WikiEngine class AbstractEngine def markup_examples examples = ActiveSupport::OrderedHash.new examples[_('Paragraphs')] = [] examples[_('Headers')] = [] examples[_('Formats')] = [] examples[_('Blocks')] = [] examples[_('Lists')] = [] examples[_('Links')] = [] ...
true
a1428059bf60265ae5515af7cbe8ac69b487bbe7
Ruby
tstrachota/hammer-tests
/lib/utils.rb
UTF-8
87
2.53125
3
[]
no_license
class Hash def slice(*keys) Hash[select { |k, v| keys.include?(k) }] end end
true
79ccfe32ef09690df9d79d622f63ab4e05a5c428
Ruby
xldenis/dynamit
/app/models/user.rb
UTF-8
984
2.53125
3
[]
no_license
class User include Mongoid::Document has_many :sources has_many :posts def self.find_or_create_by_hash(auth_hash) @user = nil @source = Source.where(:provider => auth_hash["provider"], :identifier => auth_hash["uid"]) if @source.first #assert only one source @user = @source.first.us...
true
486d34c1106492a10a78656b1100d1db08a7c984
Ruby
johnfelipe/dashboard
/test/models/user_test.rb
UTF-8
1,929
2.671875
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
require 'test_helper' class UserTest < ActiveSupport::TestCase test "validations" do good_data = { email: 'foo@bar.com', password: 'foosbars', username: 'user.12-34', name: 'tester'} user = User.create(good_data.merge({email: 'foo@bar'})) assert user.errors.messages.length == 1 user = User.create(g...
true
a5dae337a4ab7f4320ad4d7337bf49500ecfbde8
Ruby
pj0616/download-archive-2
/CONTAINER/App-Academy-master/Intro To Programming/Array Methods/abbreviate_sentence.rb
UTF-8
724
4.78125
5
[]
no_license
# Write a method abbreviate_sentence that takes in a sentence string and returns a new sentence # where every word longer than 4 characters has all of it's vowels removed. def abbreviate_sentence(str) words = str.split(" ") new_words = [] words.each do |word| if word.length > 4 new_word = "" wor...
true
a864e7a74bfb19e2c53b3f45f3c56f10070ca422
Ruby
johnbagley/ruby
/change_calculator.rb
UTF-8
479
3.421875
3
[]
no_license
quarter = 25 dime = 10 nickel = 5 penny = 1 cash = 1234.23 * 100 number_of_quarters = (cash / quarter).floor cash = cash - number_of_quarters * 25.0 number_of_dimes = (cash / 10).floor cash = cash - number_of_dimes * 10.0 number_of_nickels = (cash / 5).floor cash = cash - number_of_nickels * 5.0 number_of_pennies ...
true
2c4fa02be04b85083d4522dff78026ae233f0287
Ruby
sesposito/bowling-api
/app/interactors/update_game_status.rb
UTF-8
1,403
2.546875
3
[]
no_license
# frozen_string_literal: true class UpdateGameStatus def initialize( game:, throw:, current_frame:, frame_repository: FrameRepository, game_repository: GameRepository, frame_status_class: FrameStatus ) @game = game @throw = throw @current_frame = current_frame @frame_reposit...
true
8007545d3bb735c8be4fbb933cb1b45b24a22785
Ruby
magas4891/test_w
/lib/rule.rb
UTF-8
575
3.203125
3
[]
no_license
class Rule def apply(basket, **args) total_price = basket.inject(0) { |sum, item| sum += item[:price] } if args.has_key?(:item) multi_price(basket, args) elsif args.has_key?(:basket_total) return args[:discount] if total_price >= args[:basket_total] 0 end end def multi_price(ba...
true
0374454b7e284a1a4810275de65884ba0c846835
Ruby
siuying/mtrupdate_analyze
/lib/mtrupdate/raw_importer.rb
UTF-8
1,880
2.78125
3
[]
no_license
require 'twitter' module Mtrupdate # Import raw mtrupdate data from twitter class RawImporter attr_reader :twitter, :path attr_reader :username def initialize(twitter, path, username="mtrupdate") @twitter = twitter @path = path @username = username end # Find the maximum twe...
true
fd98f70afa73093b6d2766a59b9bc87c2c4968ab
Ruby
jsoong1962/prime-ruby-nyc-web-080618
/prime.rb
UTF-8
283
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! def prime?(int) array = Array (2...int) value = true if int < 2 value = false elsif int == 2 value else index = 0 while index < array.size if int % array[index] == 0 value = false end index += 1 end end value end
true
33230c66b6d7cf15497867f9b30d04116c73791d
Ruby
jjgutierrez0314/CSC600-Ruby-HW
/Question2.rb
UTF-8
977
4.0625
4
[]
no_license
class Array def limited(amin,amax,array) if amin <= array.min && amax >= array.max return true else return false end end def sorted(array) count1 = 0 count2 = 0 0.upto(array.length-2) { |index| if array[index] == ar...
true
a87b9950454e63e707726c1930216423c349e02e
Ruby
Jhowden/chess
/spec/board_setup_commands_spec.rb
UTF-8
3,052
2.640625
3
[]
no_license
require 'spec_helper' describe BoardSetupCommands do let(:board) { double() } let(:player) { double() } let(:piece) { double() } let(:user_commands) { double() } let(:game) { Game.new( board, user_commands ).extend( described_class ) } describe "#set_player_team" do it "instantiates a player object" ...
true
694af82da32c50540d016fd7c2cd7811b036d013
Ruby
burke/coderetreat
/session3/lib/universe.rb
UTF-8
719
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Universe def initialize @grid = {} end def get_cell_at(x, y) return nil unless @grid[x] @grid[x][y] end def set_alive_at(x, y) @grid[x] ||= {} @grid[x][y] = Cell.alive end def evolve @grid.each do |x, hash| hash.each do |y, cell| cell.tick(number_of_liv...
true
40bd9d729778f1849f1010259f153dd46e0ee413
Ruby
ideeli/ideeli_spinup
/spec/hostname.rb
UTF-8
950
2.703125
3
[]
no_license
require 'ideeli_spinup' describe IdeeliSpinup::Hostname do context "normal" do let(:hostname) { IdeeliSpinup::Hostname.new('foo12.bar.com') } describe '#to_s' do it "should return the hostname string" do hostname.to_s.should == "foo12.bar.com" end end describe '#each' do ...
true
a11174b6d19e88a864e3779be8b966f62421871e
Ruby
Plasmarobo/f.ragment
/app/helpers/fragment_api_helper.rb
UTF-8
2,862
2.71875
3
[]
no_license
module FragmentApiHelper COMMON_FRAGMENT_TYPES = [ "Data access", "Data read", "Data clear", "Data validate", "Conditional", "Log/Print", "Thread Start", "Collision", "Loop", "Scope", "End", "Push", "Pop", "Insert", "Remove", "Index" ] PLAYER_FRAGM...
true
4b3f8ba1b375f9283e03ecebd52601c8455ca77a
Ruby
stemkit-collection/stemkit-util
/scripts/sk/subordinator.rb
UTF-8
3,913
3.03125
3
[ "MIT" ]
permissive
=begin vim: sw=2: Copyright (c) 2008, Gennady Bystritsky <bystr@mac.com> Distributed under the MIT Licence. This is free software. See 'LICENSE' for details. You must read and accept the license prior to use. Author: Gennady Bystritsky =end require 'set' require 'pp' module SK class Subordinator a...
true
4646717e28abe8b2633c18c4a83e339185492c27
Ruby
GeekG1rl/learn_to_program
/ch11-reading-and-writing/safer_picture_downloading.rb
UTF-8
476
3.203125
3
[]
no_license
# your code here # Safer picture downloading. Adapt the picture-downloading/file-renaming # program to your computer by adding some safety features to make sure you # never overwrite a file. A few methods you might find useful are File.exist? # (pass it a filename, and it will return true or false) and exit (li...
true
432269464ce6e40655b60c9428021a894a4edbca
Ruby
tangyz007/hw-ruby-intro
/lib/ruby_intro.rb
UTF-8
2,195
3.84375
4
[]
no_license
# When done, submit this entire file to the autograder. # Part 1 def sum arr # YOUR CODE HERE return arr.inject(0, :+) end def max_2_sum arr # YOUR CODE HERE return 0 if arr.empty? == true return arr[0] if arr.size == 1 def sum arr return arr.inject(0, :+) end return sum(arr.max(2)) end def sum_...
true
60c8ff66e6b5ad105b4c1f4e5de7e2cea20f5b81
Ruby
tsmsogn/exercism
/ruby/pangram/pangram.rb
UTF-8
146
2.828125
3
[]
no_license
module BookKeeping VERSION = 6 end class Pangram def self.pangram?(phrase) ('a'..'z').all? { |s| phrase.downcase.include?(s) } end end
true
0347ed5bf457000573713288714c644b3c1e6481
Ruby
christophermanahan/tictactoe-ruby
/lib/game.rb
UTF-8
446
3.234375
3
[]
no_license
class Game attr_reader :board def initialize(board) @board = board end def over? win? || tie? end def win? board.combinations.any? do |in_a_row| unique = in_a_row.uniq !unique.first.nil? && unique.size == 1 end end def tie? !win? && board.full? end def move(symbo...
true
c601ae54b31b22161f418138b442c41fb34a2f6d
Ruby
mdeepak98/blockchain_database
/app/block_chain/database.rb
UTF-8
934
2.578125
3
[]
no_license
class Database include ActiveModel::Model mattr_accessor :block_chain # def initialize # @@block_chain = BlockChain.new # @@block_chain.create_transactions # end @@block_chain = BlockChain.new class << self def initialize_block_chain return if @@block_chain.present? create_t...
true
4b8e1f101c04c870bf9dcfa23309068ff8f8e885
Ruby
dontpanic917/ruby-class-variables-and-class-methods-lab-web-022018
/lib/song.rb
UTF-8
670
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_reader :name, :artist, :genre @@count=0 @@genres=[] @@artists=[] def initialize(name, artist, genre) @genre=genre @name=name @artist=artist @@artists<<artist @@genres<<genre @@count += 1 end def self.count @@count end def self.genres @@genres.uniq ...
true
e2f19ac6dd3e226aca1f31b762b633dc5135fa60
Ruby
cmloegcmluin/AppAcademy-exercises-archive
/minesweeper/board.rb
UTF-8
4,924
3.5
4
[]
no_license
require 'colorize' class Board attr_accessor :cursor, :is_over def initialize(size = 9, difficulty = 5) @size = size @difficulty = difficulty @tiles = Array.new(size) { Array.new(size) { Tile.new } } @is_over = false @cursor = [@size / 2, @size / 2] end def [](pos) x, y = pos[0], pos[...
true
857286e22e23f726f0140d4b6e7c8636edb26f80
Ruby
vinhnglx/dupco
/lib/dupco/raw.rb
UTF-8
1,589
3.140625
3
[ "MIT" ]
permissive
class Raw attr_reader :body attr_accessor :client # Public: Create constructor # # Parameter # # body - array of Html elements # # Example # # Raw.new([#<Nokogiri::XML::Element:0x3fe1b19d4dec name="div" ... ]) # # Returns nothing def initialize(body, client) @body = body @client...
true
a193ff928d2290af0fede871a3acb9556e74a92a
Ruby
kim2214/Datastructure
/atcoder/20_03_01/B - Bingo.rb
UTF-8
1,913
3.703125
4
[]
no_license
# A = Array.new(3) # # for num1 in 0..2 do # A[num1] = gets.chomp.split(' ').map(&:to_i) # end # # N = gets.chomp.to_i # # arr = Array.new(N) # # for num1 in 0..N - 1 do # arr[num1] = gets.chomp.to_i # end # # for num1 in 0..2 do # for num2 in 0..arr.size - 1 do # if A[0][num1] == arr[num2] # A[0][num1]...
true
1dfcd325ad268277900ccbffafff29d21a18ea55
Ruby
bengus101/ruby-rio-grande
/starter-code/lib/Book.rb
UTF-8
182
2.84375
3
[]
no_license
require_relative 'Item.rb' class Book < Item def initialize name, price super(name,price) end def properties(pages, author) @pages = num @author = author end end
true
63e50b2b01ebdc4b1d1dab9645440a8cad03a62e
Ruby
skotchpine/qwerty
/src/qwerty/models.rb
UTF-8
1,479
2.625
3
[]
no_license
# # Models # class User < Sequel::Model one_to_many :submissions plugin :secure_password end class Lesson < Sequel::Model one_to_many :exercises %i[complete accurate fast].each do |m| define_method m do |user_id| return false unless exercises.any? ret = true exercises.each do |ex...
true
b864a14ea94e04c6ea89665b9361fd714d7759e8
Ruby
ezzye/borisBikes
/spec/feature_spec.rb
UTF-8
719
3
3
[]
no_license
# require './lib/docking_station' # require './lib/bike' # docking_station = DockingStation.new # bike1 = Bike.new # 20.times do # bike = Bike.new # docking_station.dock(bike) # end # p docking_station.bikes # begin # docking_station2 = DockingStation.new # docking_station2.release_bike # rescue Exception...
true
9bdd0e422ae6a4e14dd8ba2923206910298c4c50
Ruby
chathhorn/soco
/app/models/cis_subject.rb
UTF-8
867
2.625
3
[]
no_license
class CisSubject < ActiveRecord::Base has_many :cis_courses #static method which finds a course written textually def self.search_for_course(name) name.upcase! (subject, white, number) = name.scan(/^([A-Z]*)(\s*)(\d*)$/)[0] if subject == nil return [] end if number.blank? && wh...
true
fe9d191eafeff662f4fbc0c49a100f563b70cf2e
Ruby
Austin2016/chess
/dialogue.rb
UTF-8
163
3.140625
3
[]
no_license
class Dialogue def self.prompt(board) puts "#{Color.to_s(board.turn)}, it's your turn!" user_entry = gets.chomp user_entry end end
true
154989e121af685a02a57de5f1d6f3b31aa75f95
Ruby
chrissschin/introtoruby
/loops_iterators/perform_again.rb
UTF-8
289
3.703125
4
[]
no_license
# perform rb # loop do # puts "Do you want to do that again?" # answer = gets.chomp # if answer != 'y' # break # end # end # ranges x = gets.chomp.to_i x_x = [1,3,4,5,6,7,8] for i in 1..x do puts i end puts "done" # collection for i in x_x do puts i end puts"done"
true
1dfed352a47cc5754d9a372bfb2ebc85c5965171
Ruby
leequarella/VirtualMerchant-Ruby
/lib/virtual_merchant/amount.rb
UTF-8
466
2.78125
3
[ "MIT" ]
permissive
module VirtualMerchant class Amount attr_accessor :total, :tax, :next_payment_date, :billing_cycle, :end_of_month def initialize(info) @total = sprintf( "%0.02f", info[:total]) if info[:tax] @tax = sprintf( "%0.02f", info[:tax]) else @tax = "0.00" end @next_payme...
true
d8beadd97517c15389639cc4d16d4f971bb7f9f2
Ruby
ManojParmar93/cs_integration
/app/services/non_rss_feeds/dow_jones/articles_downloader.rb
UTF-8
4,254
2.75
3
[]
no_license
# frozen_string_literal: true module NonRssFeeds module DowJones # Downloads the Articles # and transforms them # for the ArticlesToRssFeeder. class ArticlesDownloader # rubocop:disable ClassLength def initialize(headlines) @headlines = headlines end def articles ret...
true
8c91de7815ee09d9b47f006172ffc4bbd47de955
Ruby
mukarramali/dynamize_factories
/dynamize_factories.rb
UTF-8
1,911
3.078125
3
[]
no_license
class DynamizeFactories def initialize file @file = file @content = File.read file end def decomment val left = val[0..(val.index('#'))] right = val[(val.index('#'))..-1] not_comment = left.count('\'') != 0 && left.count('\'') == right.count('\'') && left.count('"') == right.cou...
true
070e608e992f64e90cf8fa57c80bc5e39b31f4f3
Ruby
Sid-ah/hk-bc
/database-drill-one-to-many-schema-challenge/spec/screen_spec.rb
UTF-8
1,367
2.59375
3
[]
no_license
require_relative '../screen' describe Screen do let(:casablanca_screening) { double('screening', { movie_title: 'Casablanca', start_time: '11:00' }) } let(:gone_with_the_wind_screening) { double('screening', { movie_title: 'Gone with the Wind', start_time: '18:00' }) } let(:screen) { Screen.new(number: 1, screen...
true
1aab817d83271ee184aedc01b41306af5e4f53a3
Ruby
yasmineezequiel/Vanilla_Ruby
/Section_15_Time_Object/Predicate_Methods_for_the_Time_Object.rb
UTF-8
427
2.953125
3
[]
no_license
# Predicate methods for the Time object beatles_first_album = Time.new(1963, 03, 22) p beatles_first_album.monday? # false p beatles_first_album.tuesday? # false p beatles_first_album.wednesday? # false p beatles_first_album.thursday? # false p beatles_first_album.friday? # true p beatles_first_album.saturday? # fals...
true
b47ab22339f0f93594f8ffb8bf3341111584a7a6
Ruby
JoaoCardoso193/TutorX
/app/models/student.rb
UTF-8
1,654
3
3
[]
no_license
class Student < ActiveRecord::Base has_many :appointments has_many :tutors, through: :appointments #creates and returns an hour long appointment, uses 24hr format ## work hours defined, if outside that range, drop error. also drop error if appointment already taken def create_appointment(tutor, ye...
true
9fe3641edfed33aa0e4f30d4173fda8968fb79e2
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/grade-school/8252cf4928d7462f8657599343ef7634.rb
UTF-8
319
3.265625
3
[]
no_license
class School def initialize end def db @db ||= Hash.new { |hash, key| hash[key] = [] } end def add(student, grade) db[grade] << student end def grade(grade) db[grade] end def sort sorted_array = db.sort.each do |array| array[1].sort! end Hash[sorted_array] end end
true
bc5eb0cda387e92e10f1ff0dc03e4e80d2fc7acb
Ruby
DilyaZaripova/sinatra_di
/sinatradi.rb
UTF-8
1,655
2.515625
3
[]
no_license
require 'sinatra' require 'sinatra/base' require 'sequel' require 'sequel/extensions/seed' require 'sinatra/namespace' require 'pg' require 'json' require 'multi_json' #подтягивание всех файлов из перечисленных папок-сборка # Sequel ORM для работой с БД DB = Sequel.connect( adapter: :postgres, database: 'sinatra_di...
true
0f7428eb400ae0f0efac1dfc064dd744a131531d
Ruby
evoloshchuk/production-facility-challenge
/app.rb
UTF-8
362
2.65625
3
[]
no_license
require_relative "lib/runner" require_relative "lib/producer/greedy" require_relative "lib/producer/rational" strategy = ARGV[0] STRATEGIES = { "greedy" => Producer::Greedy, "rational" => Producer::Rational } producer_class = STRATEGIES.fetch(strategy) capacity = ARGV[1].to_i if ARGV[1] runner = Runner.new(producer_c...
true
049c3e9d1944c125b38097b572201dad0bfa9f72
Ruby
Raudy2/Ruby
/crack.rb
UTF-8
445
3.3125
3
[]
no_license
require 'csv' require 'awesome_print' planets = [ [1, "Mercury", 0.55, 0.4], [2, "venus", 0.815, 0.7], [3, "Earth", 1.0, 1.0], [4, "Mars", 0.107, 1.5] ] headers = ["id", "name", "mass", "distance"] CSV.open("planet_data.csv", "w") do |file| file << headers planets.each do |planet| file << planet end end CS...
true
259e178851544b97029b2b8b10cffc7d4fc5490e
Ruby
thoughtsynapse/precisionFDA
/app/services/copy_service/file_copier.rb
UTF-8
3,009
2.671875
3
[ "CC0-1.0" ]
permissive
class CopyService class FileCopyError < StandardError; end # Copies files to another scope. class FileCopier class << self # Creates db copy of a file with another scope and project. # @param file [UserFile] A file to copy. # @param scope [String] A destination scope. # @param destina...
true
4050a60205a0970aa0baf03f506e3c657a9a5e6c
Ruby
umadesai1/kwk-l1-reading-arrays-lab-kwk-students-l1-la-070918
/reading_arrays.rb
UTF-8
626
3.765625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
STUDENT_NAMES = [ "Adele", "Beyoncé", "Cardi B", "Lady Gaga", "Nicki Minaj", "Rihanna" ] def first_student_by_index puts STUDENT_NAMES[0] end puts first_student_by_index def fourth_student_by_index puts STUDENT_NAMES[3] end puts fourth_student_by_index def last_student_by_index puts STUDENT_NAM...
true
16d752d7c8cb05d9a120dd1830d0268b29e30ff8
Ruby
ryanburnette/vfrmap
/lib/vfrmap/location.rb
UTF-8
624
2.8125
3
[ "MIT" ]
permissive
require 'geo/coord' require 'airports' class Vfrmap::Location def self.factory(location_string) coordinates = try_coordinates(location_string) return coordinates if coordinates airport = try_airport(location_string) return airport if airport end private def self.try_coordinates(location_stri...
true
e74d830857bd28d55b4324b80adbb7fc19d3b28d
Ruby
JazziJazz/ruby-projects
/Exercícios/[048] — Ímpares multiplos de três.rb
UTF-8
232
3.703125
4
[ "MIT" ]
permissive
sum_odd = 0 count = 0 (1 .. 500).each do |value| if value.odd? and value % 3 == 0; sum_odd += value count += 1 end end puts("A soma total dos números é de #{sum_odd}, foi um total de #{count} números.")
true
32bb1f5941fdfe896953fee9b2819e2873c58806
Ruby
smintz93/Sublist-Sinatra-2
/controllers/GameController.rb
UTF-8
759
2.546875
3
[]
no_license
class GameController < ApplicationController # Json Body Filter before do payload_body = request.body.read if(payload_body != "") @payload = JSON.parse(payload_body).symbolize_keys puts "----------------------- HERE IS Payload" pp @payload puts "----------------------- HERE IS Payload" end ...
true
d3513554b133cca8a492494b89881989fdaa1f98
Ruby
dewinterjack/familyTree
/person.rb
UTF-8
157
2.6875
3
[]
no_license
class Person attr_accessor :first_name, :last_name, :other_names attr_reader :id def initialize @id = 0 #Will be set to next available id end end
true
dd86b67b6c56a4af13822aa832e1f8afee7d674c
Ruby
alessandrogurgel/codility
/cyclic_rotation.rb
UTF-8
171
2.6875
3
[]
no_license
def solution(a, k) return a if k == 0 || a.empty? offset = a.length - (k % a.length) return a if offset == 0 a[offset..a.length - 1].concat(a[0..offset-1]) end
true
ea0752f83f40fcdce84ce39d0ab0b6230d28a185
Ruby
SebastianDelima/programming-univbasics-4-array-concept-review-lab-dc-web-091619
/lib/array_methods.rb
UTF-8
507
3.46875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_element_index(array, value_to_find) a = 0 while a < array.length if array[a] == value_to_find return a end a += 1 end end def find_max_value(array) max_value = 0 a = 0 while a < array.length if array[a] > max_value max_value = array[a] end a += 1 end return max_value end def find_mi...
true
30a6dbde4c364ed43ec03d434a63fdc1e127c4a7
Ruby
nicholasspencer/koans
/hackerrank/synchronous.shopping.rb
UTF-8
2,884
3.28125
3
[]
no_license
#!/usr/bin/env ruby class Shop attr_accessor :wares attr_accessor :graph def initialize(wares = []) @wares = wares end def connect_roads graph.roads.select { |road| road.source == self } end def connect_shops connect_roads.map do |roads| graph.shops.select { roads.destination en...
true
172535775fe5a8d46eb27790bbb3ee316b6b81f3
Ruby
tied/DevArtifacts
/master/bookofruby_code/ch05/enum2.rb
UTF-8
444
3.75
4
[ "MIT" ]
permissive
# The Book of Ruby - http://www.sapphiresteel.com h = {'one'=>'for sorrow', 'two'=>'for joy', 'three'=>'for a girl', 'four'=>'for a boy'} y = h.collect{ |i| i } p( y ) p( h.include?( 'three' ) ) p( h.include?( 'six' ) ) # Note a Hash is not ordered numerically # and min and max return the ASCII order # of ...
true
940aa743607232071aa89e4f48a0d49d3fb6d686
Ruby
jenmei/whats_up
/app/models/tweet.rb
UTF-8
756
2.59375
3
[]
no_license
class Tweet < ActiveRecord::Base validates_presence_of :content validates_presence_of :author validates_presence_of :date validates_presence_of :url validate :unique_tweet def self.pull_tweets search = Twitter::Search.new search.containing("Corvallis Oregon State").result_type("recent").per_page(10).each do...
true
525dbe5aa2abac0f579736d73e23b06f84b766b7
Ruby
savonarola/pulse_meter_core
/spec/pulse_meter/sensor/base_spec.rb
UTF-8
3,057
2.6875
3
[ "MIT" ]
permissive
require 'spec_helper' describe PulseMeter::Sensor::Base do let(:name){ :some_sensor } let(:description) {"Le awesome description"} let!(:sensor){ described_class.new(name) } let(:redis){ PulseMeter.redis } describe '#initialize' do context 'when PulseMeter.redis is not initialized' do it "raises R...
true
1c4e0eabea43e9cc0df198d2ba0e95c41c9ce8d5
Ruby
Zainab-Omar/my-collect-onl01-seng-pt-070620
/lib/my_collect.rb
UTF-8
335
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) i=0 collection=[] while i<array.length collection << yield(array[i]) i+=1 end collection end array = ["Tim Jones", "Tom Smith", "Jim Campagno"] my_collect(array) do |name| name.split(" ").first end collection = ['ruby', 'javascript', 'python', 'objective-c'] my_collect(collection) do...
true
96156db496e78fbdbc969a3308213512c1ca8b09
Ruby
trizoza/CodeClan_Project1_ayeWallet
/aye_wallet/models/specs/transaction_spec.rb
UTF-8
513
2.65625
3
[]
no_license
require ('minitest/autorun') require_relative ('../transaction') class TransactionSpec < MiniTest::Test def setup() @transaction01 = Transaction.new({"item" => "Saturday shopping", "merchant" => "Tesco", "value" => 30}) end def test_transaction_item() assert_equal("Saturday shopping", @transaction01.it...
true
8f3970053c592029b4eb4a9a7feca94ea5e23a14
Ruby
KyungGon-Lee/kakao_bot
/app/controllers/kakao_controller.rb
UTF-8
2,058
2.875
3
[]
no_license
require 'parser' # 헬퍼에다가 모듈화 해놧음 class KakaoController < ApplicationController # AIzaSyALWzqL8t1VXLVxCSIChKKGCv-UVHqvbQQ # 구글 커스텀 서치 api def keyboard # home_keyboard = { :type => "text"} home_keyboard = { :type => "buttons", :buttons => ["메뉴", "고양이", "영화", "로또"] } render json: home_keyboard end def ...
true
5769d284cf69e6e5a71549686e2df9ee6644d0cc
Ruby
nishimat/Euler
/p042.rb
UTF-8
278
3.171875
3
[]
no_license
require 'csv' csvdata = CSV.read("p042_words.txt") name_list = csvdata[ 0 ] count = 0 name_list.each{ |strname| val = strname.split(//).map{ |c| c.ord - 'A'.ord + 1 }.inject(:+) chkval = Math.sqrt( val * 2 ).to_i count += 1 if val * 2 == chkval * (chkval + 1) } puts count
true
3123e51dc3625e45adc3a49d46ce438b6f8a0575
Ruby
tamu222i/ruby01
/tech-book/5/5-34.rb
UTF-8
106
2.75
3
[]
no_license
# ブロックを取る場合 a = 'abcdefg-abcdefg' a.sub(/abc/){|str| 'xyz'} a.gsub(/abc/){|str| 'xyz'}
true
082c2f5e5d26e25fac5409b532ea1085f3f09553
Ruby
jordansissel/experiments
/ruby/retry/simple-retry.rb
UTF-8
739
3.328125
3
[]
no_license
$count = 0 # Mock a crappy remote API call that could toss an exception # on some upstream error. It also mocks a return value of ':pending' # when it's not complete and returns ':happy' when it's complete. def crappy_api_call $count += 1 # First two calls fail raise "OH SNAP" if $count < 3 # Next few calls ...
true
8e1a4076a89e60a2381484264fc344d36eef4fb9
Ruby
LenyTroncoso/Emprendimiento
/Ruby/curso068/clase.rb
UTF-8
604
3.984375
4
[]
no_license
class Usuario # en la clase se puede definir solo metodos #Setters para asignar el valor a un atributo def nombre=(val) @nombre = val #@nombre es el atributo end #getter retorna el valor def nombre return @nombre end end #instancia ...
true
5acfbc662988348cbd94ce0d9e1878d4749da00d
Ruby
djurre/advent_of_code_2020
/day14/puzzle1.rb
UTF-8
475
2.921875
3
[]
no_license
input = File.readlines("input.txt", chomp: true) mem = {} input.slice_before { |l| l.include?("mask") }.each do |m| mask = m[0].sub("mask = ", '') instructions = m[1..-1].map { |i| i.match(/mem\[(\d+)\] = (\d+)/).captures } instructions.each do |address, value| value_string = '%036b' % value mask.each_...
true
a61b884ddecfa6a28dd4626f73ec058a84e65c5a
Ruby
ngs-archives/sinatra-webdav
/lib/dav/property_accessors.rb
UTF-8
1,213
2.71875
3
[ "MIT" ]
permissive
module DAV module PropertyAccessors def self.included(base) raise RuntimeError, 'This module only extends classes.' end def property(mapping) mapping.each do |method_name, node_name| accessor = PropertyAccessor.new(method_name) do |rw| rw.instance_eval(&Proc.new) if block_...
true
3461b365f0e4fa9dfb4db2d4992be6d800245d22
Ruby
katryc/wyn-works
/data_types2.rb
UTF-8
1,355
4.125
4
[]
no_license
##Ex. 1 #Iterate, display data correspondingly beatles = [ { name: nil, nickname: "The Smart One" }, { name: nil, nickname: "The Shy One" }, { name: nil, nickname: "The Cute One" }, { name: nil, nickname: "The Quiet One" } ] name = nil beatles.each do |member| # case-...
true
9babf402e8304b340754bcdbda1e458446cbf72a
Ruby
tiburce01/Chasse_aux_monstres
/app.rb
UTF-8
732
2.953125
3
[]
no_license
require_relative 'lib/dofus' stack_exchange = StackExchange.new("dofus", 1) monstre_larve = stack_exchange.questions("Larves") monstre_caverne = stack_exchange.questions("Monstres des cavernes") monstre_plaine_herbeuse = stack_exchange.questions("Monstres des Plaines herbeuses") #creation et edition du fichier sur le...
true
a2a9df62cb1184fd6931f06e5df3a792e8b941de
Ruby
Tomoyanoda/kadai-microposts
/app/models/micropost.rb
UTF-8
482
2.515625
3
[]
no_license
class Micropost < ApplicationRecord belongs_to :user validates :content, presence: true, length: { maximum:255 } has_many :favorites, dependent: :destroy has_many :liked_users, through: :favorites, source: :user def like(user) self.favorites.find_or_create_by(user_id: user.id) end def unlike...
true
cf2dc9a49ce92dcd1b1fa0bc0574d89531671819
Ruby
JuanmaLambre/myhealth-serv
/app/errors/my_health_error.rb
UTF-8
292
2.625
3
[ "MIT" ]
permissive
class MyHealthError < StandardError attr_reader :error attr_reader :error_message attr_reader :status_code def initialize(error, error_message, status_code = 400) super "#{error}: #{error_message}" @error = error @error_message = error_message @status_code = status_code end end
true
5d307b28101bcfc12c4eeb445a248e76289461d2
Ruby
ToTenMilan/Well-Grounded-Rubyist
/ruby/part2/concat.rb
UTF-8
127
2.96875
3
[]
no_license
class Person attr_accessor :name def to_s name end end david = Person.new david.name = "Dawid" puts "Witaj #{david}"
true
24d22095c419350ccf8adeabf9a158e962fff163
Ruby
yubrew/projecteuler
/problem14.rb
UTF-8
339
3.6875
4
[]
no_license
def collatz_sequence(n) sequence = 0 while n != 1 n = (n % 2 == 0) ? (n / 2) : (3 * n + 1) sequence += 1 end sequence + 1 end sequence = 0 starting_n = 0 (1..999999).each do |n| new_sequence = collatz_sequence(n) if new_sequence > sequence sequence = new_sequence starting_n = n end end puts sequen...
true
354adff7f67e8764bfed11635458f19e06ae60eb
Ruby
jahonora/E9CP2A1
/ejercicio2.rb
UTF-8
1,326
3.78125
4
[]
no_license
require 'Date' class Courses attr_reader :name def initialize(name, init_date, final_date) @name = name @init_date = Date.parse(init_date) @final_date = Date.parse(final_date) end def to_s "#{@name}, #{@init_date}, #{@final_date}" end def start_before?(date) date = Date.today if date.nil? raise Exce...
true
94d1d95c5f7d4e93eaebc2911999c1c469c29fe3
Ruby
yard/viddl-rb
/spec/integration/youtube/cipher_guesser_spec.rb
UTF-8
937
2.703125
3
[]
no_license
YOUTUBE_PLUGIN_PATH = File.join(File.dirname(File.expand_path(__FILE__)), '../../..', 'plugins/youtube') require 'minitest/autorun' require 'yaml' require_relative File.join(YOUTUBE_PLUGIN_PATH, 'cipher_guesser.rb') class CipherGuesserIntegrationTest < Minitest::Test def setup @cg = CipherGuesser.new @cip...
true
1abfa73398b9e3c20a9c125996f70c2028195a6b
Ruby
EvgenyKungurov/codenamecrud
/binary_search/bst.rb
UTF-8
1,317
3.6875
4
[]
no_license
require './node' class BTS attr_accessor :root def initialize(root = nil) @root = Node.new(root) end def build_tree(arr) @root = Node.new(arr.shift) if @root.value == nil arr.each { |v| @root.insert(v) } end def breadth_first_search(v) queue = [root] until queue.empty? node = q...
true
5ee3d4fdde94175bcb066c72d245b82e0b29614e
Ruby
coreyamano/arrays_select_practice
/arrays_select.rb
UTF-8
3,805
4.3125
4
[]
no_license
# 1. Start with an array of numbers and create a new array with only the numbers less than 20. # For example, [2, 32, 80, 18, 12, 3] becomes [2, 18, 12, 3]. numbers = [2, 32, 80, 18, 12, 3] less_than_twenties = [] numbers.each do |number| if number < 20 less_than_twenties << number end end p less_than_t...
true
d954b82d0013b4e528d0905220464cfde2ba94cb
Ruby
JustinLove/ruby_closure_examples
/first_class_spec.rb
UTF-8
521
2.890625
3
[]
no_license
require 'rubygems' require 'spec' describe "First Class Functions" do it "may be named by variables" do x = lambda {:soul} x.call.should == :soul end it "may be stored in data structures" do x = [lambda {:soul}] x.first.call.should == :soul end it "may be passed as an argument" do def s...
true
f574bfe486c4a3c57b4aa2cbdf34597d8d28b2dc
Ruby
linda-le1/pantry_1909
/lib/recipe.rb
UTF-8
637
3.453125
3
[]
no_license
class Recipe attr_reader :name, :ingredients def initialize(name) @name = name @ingredients = Hash.new end def ingredients_required @ingredients end def add_ingredient(name, amount) @ingredients[name] = amount end def amount_required(ingredient) ingredients_array = ...
true
0403c6e8cce3886c55927c6d03d79ebd8fd807a2
Ruby
neeraji2it/workshop
/app/models/recommendation.rb
UTF-8
803
2.578125
3
[]
no_license
class Recommendation < ActiveRecord::Base attr_accessible :name, :user_id has_many :recommended_songs has_many :songs, :through => :recommended_songs belongs_to :user validates_presence_of :name validates_presence_of :user_id def to_s self.name end def find_recommended_song(song) self.reco...
true
f1b9067b641f1bc2b81e5c80f0d1c683b6a57415
Ruby
snebel29/challenge
/flatten_array/lib/core_ext/array.rb
UTF-8
153
3.140625
3
[]
no_license
class Array def my_flatten(memo=[]) self.each {|element| element.kind_of?(Array) ? element.my_flatten(memo) : memo << element } memo end end
true
93dabfa8dbbdf8192dcc0629d89ee117f3b2d3a6
Ruby
karthickpdy/CP
/a20j/before_exam.rb
UTF-8
553
3.109375
3
[]
no_license
n,actual_time = gets.split(" ").map(&:to_i) min = [] max = [] n.times do a,b = gets.split(" ").map(&:to_i) min << a max << b end min_sum = min.inject(0,:+) max_sum = max.inject(0,:+) ans = false ans_arr = [] if min_sum <= actual_time && actual_time <= max_sum ans = true rem_sum = actual_time - min_sum n.times do ...
true
916c3c593d35a7c8e51aadbc9c4949529cf68173
Ruby
BerilBBJ/scraperwiki-scraper-vault
/Users/A/abulafia/phone-country-codes.rb
UTF-8
1,284
2.578125
3
[]
no_license
require 'nokogiri' url = "http://en.wikipedia.org/wiki/List_of_country_calling_codes" basepath = ".//*[@id='bodyContent']/div[4]/table[5]/tr" html = ScraperWiki.scrape(url) doc = Nokogiri::HTML(html) unique_keys = ['cc'] doc.xpath(basepath).each do |row| cname = row.xpath("./td[1]").text codes = row.xpath(...
true
a35dd5c8bc4b280d93a1b599478b3baa7c9e7346
Ruby
kmb5/ruby_exercises
/substrings.rb
UTF-8
426
3.8125
4
[]
no_license
def substrings(word, array) array.reduce(Hash.new(0)) do |result_dict, substr| if word.downcase.include? substr result_dict[substr] += 1 end result_dict end end dictionary = ["below","down","go","going","horn","how","howdy","it","i","low","own","part","partner","sit"] put...
true