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
ed8307a299868f344bdd776a57fe2cbdc35a0c66
Ruby
zaldabus/currency_convertor
/merchants_guide_to_the_galaxy.rb
UTF-8
428
2.9375
3
[]
no_license
require_relative 'lib/input_parser' require_relative 'lib/roman_convertor' require_relative 'lib/currency_map' require_relative 'lib/question_parser' if __FILE__ == $PROGRAM_NAME if ARGV.empty? puts 'Please select an input text file for conversion.' else input = InputParser.new(ARGV[0]) qp = QuestionParser.new...
true
f2916cf4f292942d6a39e7f2c9c84c3957d6693c
Ruby
sugaryourcoffee/syc-spector
/inspector/lib/inspector/runner.rb
UTF-8
893
2.859375
3
[ "MIT" ]
permissive
require_relative 'options' require_relative 'separator' # Module Inspector contains functions related to running the application module Inspector # Processes based on the provided command line arguments the scan of the # file or shows the last processed files. class Runner # Initializes runner and invokes O...
true
f06b4d1a37ffc55b26bab0c06b76e7f414e64418
Ruby
avila22/prueba
/numeros/numespa2.rb
UTF-8
3,935
3.5
4
[]
no_license
def numeroEnEspanol numero if numero < 0 # No numeros negativos return 'Por favor ingresar un numero que no sea negativo.' end if numero == 0 return 'cero' end # No más casos especiales! No más returns! numeroDeTexto = '' # Este es el texto que se devolverá. primeraPosicion = ['uno', ...
true
2c278eb9bff3c4992cfbe0bc4458a61432b6f966
Ruby
zenm/RB101
/RB101/exercises_small_problems/easy06/e06_05_reversed_arrays_part_2.rb
UTF-8
717
4.5
4
[]
no_license
# Write a method that takes an Array, and returns # a new Array with the elements of the original list # in reverse order. Do not modify the original list. # You may not use Array#reverse or Array#reverse!, nor may you use the method you wrote in the previous exercise. def reverse(array) array.length reverse_i...
true
7c2be480044525b68acb5bedfed490fe6cd66181
Ruby
jeffreyroy/phase-0-tracks
/ruby/alias_manager.rb
UTF-8
2,843
4.375
4
[]
no_license
# Alias generator ## Pseudocode # Define method to swap first and last names # def first_to_last(name) # convert name into array # l is the last element of the array # temp = array[0] # array[0] = array [l] # array[l] = temp # convert array back into new string # return new string # end of method ...
true
3d2e3d13829e083d62345dcfe7e09bc918540066
Ruby
wyhaines/kansas
/test/benchmark.rb
UTF-8
1,237
2.59375
3
[ "MIT" ]
permissive
require 'rubygems' require 'kansas' require 'dbi' require 'benchmark' @params = Hash.new begin IO.foreach('tests.conf') do |line| if m = /^\s*(\w+)\s*=\s*(.*)$/.match(line) @params[m[1].downcase] = m[2] end end rescue Exception raise "There was an error opening tests.conf. Please verify that it exists and i...
true
ce85bbc22f0298eb5b3a4cc161eb01f8d61b6825
Ruby
jappleba/workout_tracker
/app/models/populaters/schedule_generator.rb
UTF-8
3,771
3.140625
3
[]
no_license
require "./config/environment" require 'pry' class GenerateSchedule attr_accessor :handstand_starting_exercise, :prep_starting_exercise, :knuckle_starting_exercise, :rock_starting_exercise, :fingertip_starting_exercise, :number, :days, :workout, :workout_date, :schedule, :time #set starting point for each answer in...
true
80a92af5a694c4895b81495f7cb5b7842a61c3e5
Ruby
10KD/CourseWork
/W1D3/w1d3/recursion_exercises.rb
UTF-8
4,426
3.6875
4
[]
no_license
require 'byebug' def range(start,last) return [] if start >= last range_array = [start] range_array + range(start+1,last) end # p range(1, 5) # def sum_array(array) # return array[0] if array.length == 1 # array[0] + sum_array(array[1..-1]) # end def sum_array(array) array.reduce(:+) end # p sum_arra...
true
0c36626df98f01880aab2fa2c313804b15a890d8
Ruby
aisleypay/orm-mapping-to-tables-web-040317
/lib/song.rb
UTF-8
2,229
3.609375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :album, attr_reader :id def initialize(attribute = {}) @id = attribute['id'] @name = attribute['name'] @album = attribute['album'] end # When we create a new song with the Song.new method, we do not set that song's id. A song gets an id only when it gets saved in...
true
5f98ec959099b6d7d202e5708320413d30b6e98b
Ruby
learn-co-curriculum/hs-ruby-oo-assessment
/1_dog.rb
UTF-8
939
4.6875
5
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog # 1. Create reader and writer methods for name and happiness # 2. Write a method called bark that makes the dog say (puts) its name and woof! # 3. Write an ear_scratch method that increases the dogs happiness by 1 each time he gets an ear scratch # 4. Write a tail_wag method that makes the dogs ...
true
1b277f6abef88ff049cd7ce6345ac812c4eb9d52
Ruby
jliangDS/ruby-enumerables-generalized-map-and-reduce-lab-prework
/lib/my_code.rb
UTF-8
405
3.390625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def map(source_array) new = [] i = 0 while i < source_array.length do new.push(yield(source_array[i])) i += 1 end return new end def reduce(source_array, starting_point = 0) new = 0 i = 0 if source_array[i].class == Integer while i < source_array.length do new += source_array[i] ...
true
e8570e5a4ab134bb1bc3200978104a1506e143ea
Ruby
pz0995/scraping-kickstarter-v-000
/fixtures/kickstarter_scraper.rb
UTF-8
1,552
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# file: kickstarter_scraper.rb require 'nokogiri' require 'pry' # # projects: kickstarter.css("li.project.grid_4") # title: project.css("h2.bbcard_name strong a").text # image link: project.css("div.project-thumbnail a img").attribute("src").value # description: project.css("p.bbcard_blurb").text # location: project.c...
true
ae3aae3348e428f7a2328eb7c24d25065fdf3377
Ruby
VictoriaMeng/ruby-music-library-cli-v-000
/lib/concerns/concerns.rb
UTF-8
251
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
module Concerns module Findable def find_by_name(words) all.find { |song| song.name == words } end def find_or_create_by_name(words) self.find_by_name(words) ? self.find_by_name(words) : self.create(words) end end end
true
1b6bf7cf7a070355ab40fa416972622007a3c12a
Ruby
Sairoden/cinema-booking-api
/app/graphql/mutations/create_booking.rb
UTF-8
1,075
2.5625
3
[]
no_license
module Mutations class CreateBooking < BaseMutation field :booking, Types::BookingType, null: true field :message, String, null: true argument :seat_number, Integer, required: true argument :time_slot, String, required: true argument :movie_id, ID, required: true def resolve(seat_number...
true
8d1ba063b3e503572980458ab9b4439ab1fa97e2
Ruby
elct9620/tamashii-agent
/lib/tamashii/agent/master.rb
UTF-8
2,790
2.53125
3
[ "Apache-2.0" ]
permissive
require 'tamashii/agent/connection' require 'tamashii/agent/buzzer' require 'tamashii/agent/card_reader' require 'thread' module Tamashii module Agent class Master < Component attr_reader :serial_number def initialize(host, port) super() logger.info "Starting Tamashii::Agent #{Tama...
true
15b1763c25451d45076a454b787de51812e8ba89
Ruby
christophermanahan/tictactoe-ruby
/lib/formatter.rb
UTF-8
1,370
3.484375
3
[]
no_license
class Formatter def initialize(colorizer:, symbols:) @colorizer = colorizer @symbols = symbols end def format(board) flattened = flatten(board) symbols_or_positions = nil_to_position(flattened) colored = color(symbols_or_positions) rows = colored.each_slice(board.size).to_a rows_and_d...
true
d6ea76b2ee8806763236795daca8f557926857cd
Ruby
halowarrior/game_spy_ruby
/lib/game_spy/challenge.rb
UTF-8
949
2.578125
3
[]
no_license
class GameSpy::Challenge extend FFI::Library ffi_lib FFI::Compiler::Loader.find("game_spy") GTI2_CHALLENGE_LEN = 32 GTI2_RESPONSE_LEN = 32 attach_function "gti2GetChallenge", [:pointer], :pointer attach_function "gti2VerifyChallenge", [:pointer], :int attach_function "gti2GetResponse", [:pointer, :poin...
true
5af028dfe0e5a219da9e719134f23c1d0ed1251c
Ruby
DuncanYe/note
/ruby_lesson/guess.rb
UTF-8
1,298
3.734375
4
[]
no_license
number = rand(0..9) puts "請在0~9之中輸入一個數字" puts number guess = gets.chomp.to_i if guess==number else while (guess!=number) puts "猜錯囉!請在0~9之中輸入一個數字" guess = gets.chomp.to_i end end puts "猜對囉!" # =========== number = rand(0..9) puts number puts "Please Guess the Number between 0 to 9" guess = gets...
true
7f8813f64d49ff37261b6f4c9b05b51fc0766950
Ruby
neddy/Launch-School
/Exercises/120_Object_Oriented_Programing_(Round_4)/medium_1/ex_7.rb
UTF-8
1,177
4.40625
4
[]
no_license
# ex_7.rb class GuessingGame def initialize(low, high) @low = low @high = high @game_range = (low..high) @guesses_allowed = Math.log2(high - low).to_i + 1 end def play @secret_num = @game_range.to_a.sample outcome = user_guess if outcome == :won puts "\nYou won!" else ...
true
08e25347556ff1af0c2588aed4459cbc51426dad
Ruby
RodrigoRGRB/Codewars
/ucoder/1136.rb
UTF-8
166
3.046875
3
[]
no_license
m = gets.to_f latas = (m / 54.0) if latas > latas.round() latas = latas.round()+1 else latas = latas.round() end valor = latas * 80 puts "#{latas} #{valor}"
true
1458642e5e8627bc0630f3d75b989bc642e50405
Ruby
Invoca/aggregate
/lib/aggregate/bitfield.rb
UTF-8
2,558
3.140625
3
[ "MIT" ]
permissive
# frozen_string_literal: true # A string representation of a fixed length array of values defined in a provided mapping of characters # to values. # A length limited version of the class is created by calling the limit method. module Aggregate class Bitfield include Comparable class << self def with_o...
true
f5ec2dec7bd2a911fd3183b90cca1cb133a36ad6
Ruby
joshmrallen/programming-univbasics-nds-nds-to-insight-raw-brackets-lab-nyc-web-030920
/lib/nds_extract.rb
UTF-8
1,425
3.3125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'directors_database' def directors_totals(nds) # Remember, it's always OK to pretty print what you get *in* to make sure # that you know what you're starting with! remember it's an AofHofAofH # pp nds # The Hash result be full of things like "Jean-Pierre J...
true
3d3e706fef7c6722bffe036329117cc456ee7b06
Ruby
ErinReames/ruby-oo-fundamentals-instance-variables-lab-sea01-seng-ft-042020
/lib/dog.rb
UTF-8
333
4.0625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog #setter - takes in argument of a name and sets it equal to a variable #(this_dogs_name) def name=(dog_name) @this_dogs_name = dog_name end #getter - reads the name given by the setter def name @this_dogs_name end end lassie = Dog.new lassie.name = "Lassie" puts...
true
3bbda4b51a766e231ecde72794ddaa9eb0544ee0
Ruby
mango79/skillcrush
/pets.rb
UTF-8
889
3.8125
4
[]
no_license
class Pet def set_name=(ferret_name) @name = ferret_name end def get_name return @name end def set_owner=(owner_name) @owner_name = owner_name end def get_owner return @owner_name end end class Ferret<Pet def squeal return "squeeeeee" end end class Chincilla<Pet def squeek return "eeee...
true
c846fb69004109d43affb925534ef6f709b4b21d
Ruby
neurofen/bubble
/spec/thumb_bucket_spec.rb
UTF-8
1,948
3.109375
3
[]
no_license
require "spec_helper" describe ThumbBucket do before :all do @bucket = ThumbBucket.new end describe "#new" do it "returns a ThumbBucket instance" do @bucket.should be_an_instance_of ThumbBucket end it "instance limit and remaining default to 10" do @bucket.limit.should eql 10 ...
true
84d522a014b93c4bf7e6b6808a3a6bcc15f7e0a3
Ruby
akiinyo/Ruby-no-Tutorial
/diamond.rb
UTF-8
409
3.25
3
[]
no_license
midpoint = ARGV[0].to_i 1.upto(midpoint - 1) do |i| print ' ' * (midpoint - i) print '*' * ((i * 2) - 1) puts '' end midpoint.downto(1) do |i| print ' ' * (midpoint - i) print '*' * ((i * 2) - 1) puts '' end def line(n, hight) ('*' * ((n * 2) - 1)).center((hight * 2) - 1) end 1.upto(midpoint - 1) do ...
true
be2d2c6ab9a512e70d8680bc5a719b9135d576d5
Ruby
vito/atomy
/lib/atomy/code/pattern.rb
UTF-8
327
2.578125
3
[ "Apache-2.0" ]
permissive
module Atomy module Code class Pattern attr_reader :node def initialize(node) @node = node end def bytecode(gen, mod) mod.compile(gen, @node) end # [value, pattern] on stack def assign(gen) end def splat? false end end e...
true
388fbd6e2d5584b9223056d2539f4179155c34b9
Ruby
muriloime/exercism
/ruby/circular-buffer/circular_buffer.rb
UTF-8
500
3.625
4
[]
no_license
class CircularBuffer BufferEmptyException = Class.new(ArgumentError) BufferFullException = Class.new(ArgumentError) def initialize(size) @size = size clear end def read raise BufferEmptyException unless @data[0] @data.shift end def write(value) raise BufferFullException if full? ...
true
160611af04c6fcd2fb0b727c96b491082998ecd4
Ruby
skrepkoed/Black-Jack
/black_jack.rb
UTF-8
2,889
3
3
[]
no_license
# frozen_string_literal: true require_relative 'current_player' require_relative 'diller' require_relative 'bank' require_relative 'card_deck' require_relative 'evaluation_score' require_relative 'hand' class BlackJack include EvaluationScore def self.new_game @current_player ||= CurrentPlayer.new @diller ...
true
a03cf49fba98c443f3995d96e3d5e4b31bfaa0cb
Ruby
hack4reno/hack4reno2011
/mashup_workshop/examples/tropo/applications/tropo-transcriptions/.gems/gems/dm-core-0.10.0/lib/dm-core/query/path.rb
UTF-8
4,351
2.859375
3
[ "MIT" ]
permissive
# TODO: instead of an Array of Path objects, create a Relationship # on the fly using :through on the previous relationship, creating a # chain. Query::Path could then be a thin wrapper that specifies extra # conditions on the Relationships, like the target property o match # on. module DataMapper class Query c...
true
7d9d55da31737bd7431b3a5015ab076ab48e76ae
Ruby
JordanStafford/Ruby
/PDP/Classes/initializing_objects.rb
UTF-8
68
2.609375
3
[]
no_license
class Person def initialize(name) end end Person.new("Jordan")
true
44207147d7eb4285335135c59642ded9438f93c3
Ruby
smoline/LRTHW
/ex05.rb
UTF-8
675
3.75
4
[]
no_license
my_name = 'Sherilyn Moline' my_age = 42 # not a lie in 2017 my_height = 64 # inches my_weight = 140 # lbs - maybe a lie my_eyes = 'Blue' my_teeth = 'White' my_hair = 'Blonde' puts "Let's talk about #{my_name}." puts "She's #{my_height} inches tall." puts "That is #{my_height * 2.54} centimeters" puts "She's #{my_weigh...
true
79965d737e0ffecb77ca46ce372cff72e6a6ace2
Ruby
chillicoder/compartment
/features/step_definitions/content_steps.rb
UTF-8
1,585
2.609375
3
[ "MIT" ]
permissive
# content area steps Then /^I should see a content area$/ do find '.compartment_content_area' end Then /^I should see an "(.*?)" button within the content area$/ do |button| find_button(button) end When /^I click the "(.*?)" button within the content area$/ do |button| within '.compartment_content_area:first-o...
true
ec0145d5260983c70adb14db117cf26ec2f5632e
Ruby
codejoe/AkademiRails
/Data_Sharing/flashcard2.rb
UTF-8
705
3.328125
3
[]
no_license
class Soal def initialize(soal) @soal = soal end def get_soal @soal end end class Jawaban def initialize(jawaban) @jawaban = jawaban end def get_jawaban @jawaban end end class Flashcard def read_deck soal_temp=[] jawaban_temp=[] data = File.read("flashcard2.txt") ...
true
52726243ff8c1355ec944676beabe6c95e2fb745
Ruby
bcurren/unison
/spec/unit/retainable_spec.rb
UTF-8
16,873
2.546875
3
[]
no_license
require File.expand_path("#{File.dirname(__FILE__)}/../unison_spec_helper") module Unison module RetainableSpec describe Retainable do attr_reader :child, :array_children, :hash_children attr_reader :subscribed_child_1, :subscribed_child_2, :subscribed_child_3 attr_reader :retainable_instance, ...
true
8048c9feaca799d14e421540033411264b7ae827
Ruby
purlak/ttt-ruby
/lib/players/human.rb
UTF-8
171
2.734375
3
[]
no_license
require_relative '../get_input.rb' class Player::Human < Player def move(_game) puts 'Enter board position [1-9]:' GetInput.get_input # gets.chomp end end
true
e3403f94c5090759d598e8d8244723d2f03440fa
Ruby
danlyman/tts
/ruby/mcrib.rb
UTF-8
490
3.734375
4
[]
no_license
class Product attr_accessor :product, :quantity def initialize(product, quantity) @product = product @quantity = quantity end def purchase puts "How many McRibs would you like to buy on this fine day?" amount = gets.chomp.to_i if amount <= @quantity puts "Sure thing! Would you like fries with that?" ...
true
fbba80c01436a91d54e2dcc6f5759fef206a5a6c
Ruby
ludwiggj/ruby-pickaxe
/ch07-regular-expressions/08_repetition.rb
UTF-8
2,009
3.953125
4
[]
no_license
require_relative 'show_regexp' a = 'The moon is made of cheese' # r+ matches one or more occurrences of r; by default the match is greedy puts show_regexp(a, /\w+/) # => ->The<- moon is made of cheese # ? makes the match lazy puts show_regexp(a, /\w+?/) # => ->T<-he moon is made of cheese # r* matches zero or more...
true
1d80a927cf8dc7c3508562b09ecd29ee490524f0
Ruby
jonhoman/real-simple-weather
/weather.rb
UTF-8
754
2.796875
3
[]
no_license
require 'rubygems' require 'sinatra/base' require 'yahoo-weather' require 'haml' require 'sass' module Weather class App < Sinatra::Base helpers do def get_weather_info(zipcode) client = YahooWeather::Client.new response = client.lookup_location(zipcode) title = response.title condition = respons...
true
e34c20bcd02464e87d465394439bac446fe03e38
Ruby
joffitzer/ruby-boating-school-nyc-web-102819
/app/models/student.rb
UTF-8
1,167
3.4375
3
[]
no_license
class Student attr_accessor :first_name @@all = [] def initialize(first_name) @first_name = first_name @@all << self end def add_boating_test(boating_test_name, boating_test_status, instructor) BoatingTest.new(self, boating_test_name, boating_test_status, instructor) ...
true
8249b28c444ffe74db3660c08c5d7bb3472e5d77
Ruby
AANtoso/PoliceStation_List
/lib/Scraper.rb
UTF-8
868
2.78125
3
[ "MIT" ]
permissive
class PoliceStationScraper BASE_URL = 'https://www.policeone.com/law-enforcement-directory/' def self.scrape_station_list pg = open(BASE_URL) doc = Nokogiri.HTML(pg) station_list = doc.css(".Table-body .Table-link").map(&:text) link_list = doc.css(".Table-row").map{|link| link["href"]} station_...
true
fc723f2a883373aedc1308c73bc916dd27d5d0a8
Ruby
kosen-robocon-db/kosen-robocon-db
/db/seeds/advancement_history.rb
UTF-8
2,132
2.796875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "csv" csv_file_path = "db/seeds/csv/advancement_histories.csv" bulk_insert_data = [] if FileTest.exist?(csv_file_path) then csv = CSV.read(csv_file_path, headers: true) csv.each do |row| bulk_insert_data << AdvancementHistory.new( contest_nth: row[0], region_code: row[1], cam...
true
b2e67a2128bbf880657a7cf4c454fc129ba9b050
Ruby
github/platform-samples
/api/ruby/working-with-comments/comments_on_an_entire_diff.rb
UTF-8
464
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "CC0-1.0" ]
permissive
require 'octokit' # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! # Instead, set and test environment variables, like below client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] client.pull_request_comments("octocat/Spoon-Knife", 1176).each do |comment| username = comment[:user][:login] ...
true
644b14f1d4d87c15c6bf3d1608076a6369a8762a
Ruby
manaka/adventofcode2020
/09_02.rb
UTF-8
921
3.25
3
[]
no_license
#!/usr/bin/env ruby # frozen_string_literal: true input_commands = File.open('input_09_01.txt').read.split("\n").map(&:to_i) def find_buggy(input_commands, preamble = 25) for i in preamble..(input_commands.length - 1) do unless input_commands[i-preamble..i-1].combination(2).to_a.select{|e| e.red...
true
d16cf08b7b439ea0087b6f7851ab5dfa755f9342
Ruby
Miguel-Bit-Debug/Exercicios-Ruby
/calc.rb
UTF-8
205
3.859375
4
[]
no_license
print('Digite o primeiro numero inteiro: ') n1 = gets.chomp.to_i print('Digite o segundo numero inteiro: ') n2 = gets.chomp.to_i addition = n1 + n2 puts("O resultado de #{n1} + #{n2} = #{addition}")
true
a1820e2117b560ccd0a8008f30d493c95e5dccbe
Ruby
armakuni/forecasting-example
/spec/distribution/uniform_spec.rb
UTF-8
483
2.71875
3
[ "MIT" ]
permissive
describe Distribution::Uniform do describe '.random' do it 'returns a random number within bounds' do expect(described_class.random(10.0, 5.0, 15.0)).to be_between(5.0, 15.0) end it 'distributes evenly for large sample sizes' do sum = [0.0] * 10 10_000.times do sum[described_cla...
true
5e9d2bc08596175081f94ddf6ade144d11471a0b
Ruby
mbenitezm/meetings-app
/lib/finder/time_slot_finder.rb
UTF-8
2,518
2.921875
3
[]
no_license
module Finder class TimeSlotFinder MIN_SLOT_SIZE = 15 def initialize(params) @calendars = params['calendars'] @from = DateTime.parse(params['from']).beginning_of_hour() @to = DateTime.parse(params['to']) @slot_type = params['time_slot_type'] @duration = params['duration'].to_i ...
true
5d5c3d73390550105e9fe15f0a993ffa40366ff8
Ruby
mytram/adventofcode
/2018/lib/day_05_solver.rb
UTF-8
595
2.921875
3
[]
no_license
class Day05Solver < SolverBase # def call react(input) end def call2 ('a'..'z').map do |unit| react(input.gsub(/#{unit}/i, '')).size end.min end private def react(polymer) loop do old_size = polymer.size polymer = react_regexs.reduce(polymer) do |p, regex| p.gs...
true
c6e4d4938eb37146fcfe7de22940b3dc7750f149
Ruby
michellejanosi/coffee-and-code
/coffee_code.rb
UTF-8
160
2.84375
3
[]
no_license
# Coffee and code with emojis 🙎 == 😴 until 🙎 == 🙆 return ☕️ 🙎 += 🙂 end puts 🙎 # Output => # 🙎: 😴 # 🙎: 😐 # 🙎: 🙆
true
682c29557238b0bf2f311cb355b34635b8c05460
Ruby
molit-korea/main
/Pages/2017 국토교통 빅데이터 해커톤 참가작/molit_HAB-master/elastic/logstash-5.5.2/vendor/bundle/jruby/1.9/gems/sequel-4.49.0/lib/sequel/extensions/pg_loose_count.rb
UTF-8
997
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
# frozen-string-literal: true # # The pg_loose_count extension looks at the table statistics # in the PostgreSQL system tables to get a fast approximate # count of the number of rows in a given table: # # DB.loose_count(:table) # => 123456 # # It can also support schema qualified tables: # # DB.loose_count(:schema_...
true
f79dcdfe3994febbb36a84b2e355285a9eee6e17
Ruby
rcasias/enigma2021
/spec/offsetable_spec.rb
UTF-8
990
2.59375
3
[]
no_license
require 'simplecov' SimpleCov.start require 'rspec' require './lib/keyable' require './lib/offsetable' require './lib/enigma' RSpec.describe Enigma do enigma = Enigma.new it 'exists' do expect(enigma).to be_instance_of(Enigma) end context 'offset methods' do it 'can find date' do allow(Time)....
true
e86083dad45cf8ebf0cfaf983ea9d8db343a0d73
Ruby
rabbitrunning2/prisoner_game_v0.2
/app/room.rb
UTF-8
220
2.6875
3
[]
no_license
require_relative 'screen.rb' class Room attr_accessor :description, :game_state, :items def initialize(description, items, game_state) @description = description @items = items @game_state = game_state end end
true
3115604f88c2ced28cdbffbd6cd2f80568b3d7b1
Ruby
Varsion/CloudMusicApi
/app/models/phone_validator.rb
UTF-8
451
2.75
3
[]
no_license
=begin 自定义数据验证器 尝试按目录放置 目前该文件在 app/models 下 =end class PhoneValidator < ActiveModel::Validator # 自定义验证器 def validate record if record.phone unless record.phone =~ /^[1](([3][0-9])|([4][5,7,9])|([5][4,6,9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$/i record.errors[:phone] << 'is not an phone...
true
023625b02c4e9e4534eb3ef62bd21990ed5adc28
Ruby
Jake0Miller/jungle-beat
/test/linked_list_test.rb
UTF-8
1,414
3.171875
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/node' require './lib/linked_list' require 'pry' class LinkedListTest < MiniTest::Test def setup @list = LinkedList.new end def test_it_exists assert_instance_of LinkedList, @list end def test_head_node_defaults_to_nil assert_nil...
true
5a491f047832812c42bae63eb2b4ebb1e6fe19b0
Ruby
ButeraMV/open_mic
/test/joke_test.rb
UTF-8
932
2.90625
3
[]
no_license
require 'minitest' require 'minitest/autorun' require 'minitest/pride' require './lib/joke' class JokeTest < Minitest::Test def test_joke_exists joke = Joke.new({id: 1, question: "Why did the strawberry cross the road?", answer: "Because his mother was in a jam."}) assert_instance_of Joke, joke end ...
true
491e27db5ae265f82ed7ed001fabf82b01132b95
Ruby
borkabrak/binfiles
/weather
UTF-8
728
3.4375
3
[]
no_license
#!/usr/bin/env ruby # encoding: UTF-8 # # Get and display weather data # require 'open-uri' require 'json' require 'pp' class Weather @api = 'http://api.openweathermap.org/data/2.5/weather?q=Nashville,TN' attr_accessor :current def initialize(data) @current_conditions = JSON.parse(open(@api).read) end ...
true
2490e2f213021848d4014eeab9ab9172383ff4db
Ruby
tomoakitomoaki/mykadai
/ex4.rb
UTF-8
506
2.828125
3
[]
no_license
# -*- encoding: UTF-8 -*- #!/usr/bin/ruby -Ke require "rubygems" require "nokogiri" require "open-uri" require "kconv" doc = Nokogiri.HTML(open("http://ja.wikipedia.org/wiki/%E6%97%A5%E6%9C%AC%E3%81%AE%E5%A5%B3%E5%84%AA%E4%B8%80%E8%A6%A7")) puts "検索したい文字列を入力してください" word = gets.chomp doc.search("body").each do |l| ...
true
dba47dc5b9b5ab38f8c7b3388b9efcc5aa39949e
Ruby
Milebet/pico-placa
/app/models/validator.rb
UTF-8
1,455
3.15625
3
[]
no_license
require 'date' require 'time' class Validator < ApplicationRecord VALID_DAYS = { monday: [1,2], tuesday: [3,4], wednesday: [5,6], thursday: [7,8], friday: [9,0] } INIT_MORNING = Time.parse("07:00") END_MORNING = Time.parse("09:30") INIT_NIGHT = Time.parse("16:00") END_NIGHT = Time.parse("19:30") PE...
true
764b1117ef355951778abc61ef1957207f687889
Ruby
DavidGoldwasser/osm2su
/su2osm/geometry.rb
UTF-8
7,072
2.546875
3
[]
no_license
# initial test of moving OpenStudio SketchUp Plugin Experimental Workflow into a light weight stand alone script require 'sketchup.rb' module Sketchup::Su2osm def self.create_sketchup_groups_from_diagram # gather user input prompts = ["Floor to Floor Height?", "Number of Stories?"] defaults = ["10'", ...
true
df7a9e83cc11018a138e65c4509e2c58cb9177cb
Ruby
ElvinEfendi/fullcalendar-with-backend
/app/models/event_collection.rb
UTF-8
359
3.1875
3
[]
no_license
class EventCollection include Enumerable def initialize events @events = events.sort_by &:starts_at end def for_week week events = @events.select do |e| e.starts_at >= week[0] && e.starts_at <= week[1] end EventCollection.new events end def each &block @events.each do |event| ...
true
40e2082049888795c1082ffec8cb221d93d4f2f5
Ruby
burakozdemir32/farmbot-serial
/lib/arduino/outgoing_handler.rb
UTF-8
4,249
2.9375
3
[]
no_license
module FB # Writes GCode to the serial line. Creates messages the travel from the PI to # the ARDUINO. class OutgoingHandler attr_reader :bot def initialize(bot) @bot = bot end def emergency_stop(*) # This message is special- it is the only method that bypasses the queue. bot.o...
true
fe64e62901f2b975980acad8db312d21c08c8b46
Ruby
ElizabethRamos/campus-code
/tradutor/traducao.rb
UTF-8
1,038
4.15625
4
[]
no_license
#nome class Traducao #atributos em ruby comecam com @ attr_accessor :texto_ingles, :texto_portugues #permite leitura e mudanca dos atributos. #attr_reader :texto_ingles, :texto_portugues - permite leitura, mas nao permite mudanca #attr_writer :texto_ingles, :texto_portugues - permite mudar o atributo, mas nao ...
true
fed2c1b851327398a387884ab28b9f15a70d7592
Ruby
carlhauck/advent-of-code-2020
/day-7-handy-haversacks.rb
UTF-8
46,998
3.515625
4
[]
no_license
# --- Day 7: Handy Haversacks --- # You land at the regional airport in time for your next flight. In fact, it looks like you'll even have time to grab some food: all flights are currently delayed due to issues in luggage processing. # Due to recent aviation regulations, many rules (your puzzle input) are being enforc...
true
9cd7ec6f4e1fd5199411e85258174165199a7713
Ruby
sergiuszm/ql-pinger
/lib/ql_pinger.rb
UTF-8
1,030
2.6875
3
[]
no_license
require 'dbi' require 'mysql' require 'dbd' require 'yaml' class QLPinger def initialize(ips, interval) @ips = ips @interval = interval @ping = {} config end def ping set_time @ips.each_pair do |name, ip| begin value = %x( ping -c 5 #{ip} ) ping = value.match(/((\d+...
true
ba3480121ec8ef8ddac2f6726566fb9510db4e58
Ruby
pixelblend/weeknoteabot
/lib/email_response/idle.rb
UTF-8
1,009
2.71875
3
[]
no_license
require 'weeknote_state' require 'template' class EmailResponse class Idle def parse(weeknote, contributors) responses = [] if weeknote.subject.match(/begin weeknotes/i) responses << { :to => :all, :subject => 'Weeknotes please!', :body => Templa...
true
df664b2ab141e2394891f575b3cbce1ab06178e5
Ruby
chrisclc/RB101-Programming-Foundations
/lesson_2/testing.rb
UTF-8
1,431
3.796875
4
[]
no_license
VALID_CHOICES = %w(rock paper scissors lizard spock) def win?(first, second) (first == 'rock' && (second == 'scissors' || second == 'lizard')) || (first == 'paper' && (second == 'rock' || second == 'spock')) || (first == 'scissors' && (second == 'paper' || second == 'lizard')) || (first == 'lizard' && (s...
true
fe1726ee2e28c29a39ff984f07da34beeff2aedd
Ruby
coffeencoke/mince_migrator
/lib/mince_migrator/migrations/loader.rb
UTF-8
1,141
2.671875
3
[ "MIT" ]
permissive
module MinceMigrator module Migrations class Loader def initialize(options) @klass_name = options[:klass_name] @full_path = options[:full_path] end def klass eval "::MinceMigrator::Migrations::#{@klass_name}" end def call if valid? require ...
true
623aecf67331cacbbf888f570156c545b2fac4ef
Ruby
mariuszzak/aasm_light
/spec/aasm_light_spec.rb
UTF-8
4,817
2.625
3
[]
no_license
require "spec_helper" RSpec.describe AasmLight do it "has a version number" do expect(AasmLight::VERSION).not_to be nil end it "allows to include AasmLight module to any class" do expect do Class.new do include AasmLight end end.not_to raise_exception end it "doesn't allow t...
true
e8b6c3c5fc2cd0ab8b372b4dd0e4906e6ee7faea
Ruby
Bcdirito/algorithm_problems
/array_manipulation/halves_are_alike/basic.rb
UTF-8
356
3.328125
3
[]
no_license
def halves_are_alike(s) mid_idx = s.length / 2 split_str = s.split("") first = split_str[0...mid_idx] second = split_str[mid_idx..-1] vowel_hash = {} "aeiouAEIOU".split("").each {|chr| vowel_hash[chr] = ""} first.select {|char| !vowel_hash[char].nil?}.length == second.select {|char...
true
65ffcf20fc266565adec9e207220640196eb42bc
Ruby
wizzywit/Ruby-Training-Session
/Quest06/my_christmas_tree.rb
UTF-8
3,193
3.8125
4
[]
no_license
def my_christmas_tree argv # If argument passed is greater than one which is the allowed number # of argument then output and error message and exit from function if argv.size > 1 print "Only one argument is allowed" return end # If No argument is given output an error message and e...
true
6cdb1f6183c2d4d4fae94d202ddfc89577d9b6de
Ruby
sumoheavy/jira-ruby
/lib/jira/client.rb
UTF-8
9,091
2.515625
3
[ "MIT" ]
permissive
require 'json' require 'forwardable' require 'ostruct' module JIRA # This class is the main access point for all JIRA::Resource instances. # # The client must be initialized with an options hash containing # configuration options. The available options are: # # :site => 'http://localhost:29...
true
cddd2ef04301d1c35a8fef6d8f3d12203bc77bd1
Ruby
AldiHydayat/belajar-ruby
/error_handling.rb
UTF-8
199
3.1875
3
[]
no_license
def pembagian(num1, num2) begin hasil = num1 / num2 rescue ZeroDivisionError => message puts message rescue => message puts "unhandled error: #{message}" end end pembagian(3, 0)
true
6e7fbc557864c646d517b6989d59fce3d8c425c8
Ruby
xababafr/RubyPFE
/tests/semaine11/tests/testNewSimulator.rb
UTF-8
1,721
3.765625
4
[ "MIT" ]
permissive
require "fiber" class Simulator def initialize @mustStop = false @time = 0 @fibers = {} #fiber's name ==> the fiber itself end def add_fiber name, fiber @fibers[name] = fiber end def keep_going ret = false @fibers.each_value do |fiber| if fiber.alive? ret = true ...
true
75c0fcbe13fe8a78f708e34445f1bcf86eca167c
Ruby
hyaminh2303/dashboard
/app/models/currency.rb
UTF-8
360
2.53125
3
[]
no_license
class Currency < ActiveRecord::Base def self.usd(money, currency_code) currency = Money::Currency.new(currency_code) Money.new(money * currency.subunit_to_unit, currency).as_us_dollar end def self.money(money, currency_code) currency = Money::Currency.new(currency_code) Money.new(money * curren...
true
18f7a021ff43e7f316914ff5c2d5dc9bb4f85125
Ruby
mattantonelli/moon-bot
/moon.rb
UTF-8
1,048
2.90625
3
[ "MIT" ]
permissive
class Moon API_URL = 'http://api.usno.navy.mil/moon/phase?date=today&nump=99'.freeze PHASES = { 'New Moon' => '🌑', 'First Quarter' => '🌓', 'Full Moon' => '🌕', 'Last Quarter' => '🌗' }.freeze def initialize fetch_phases end def current_phase while true phase = @phases.first...
true
9f88213c74c8b11fb48035215a5c8c275417c4fd
Ruby
mojotron/algorithms-and-data-structures
/data_structures/G1_word_ladder_problem.rb
UTF-8
3,616
3.875
4
[]
no_license
require_relative "DS16_graph_with_adjecency_list.rb" #using words with 3 letter for faster runtime list_of_words = "english_dictionary/three_letter_words.txt" #first create bucket of words thet differ 1 letter buckets_list = Hash.new() words_file = File.new(list_of_words, 'r') words_file.each do |line| word = line.ch...
true
a7715110704f88966e3c1e6de291aa7f2ef5ff41
Ruby
msoanes/monastery
/lib/router.rb
UTF-8
2,103
2.859375
3
[]
no_license
require_relative 'route' require_relative 'route_resourcable' module Monastery class Router include RouteResourcable attr_reader :routes, :named_paths def self.regex_from_pattern_string(pattern_string) re_pattern = pattern_string.split('/').map do |part| part.gsub(/:(.+)[\/]{,1}/, '(?<\1>\...
true
0830597541ba0f29a5efcf0c38fcf2b302a10351
Ruby
joseph-green/tic-tac-toe
/spec/tictactoe_spec.rb
UTF-8
3,417
2.890625
3
[]
no_license
require "spec_helper" describe "Board" do before :each do @board = Board.new Board.clear end describe "#new" do it "creates a new Board object" do @board.should be_an_instance_of Board end end describe "#display" do context "empty board" do it "displays an empty board" do STDOUT.expect(:put...
true
cd287ec87f156f8d48eae0b831d3cc29794e29f1
Ruby
jamaleh1111/launch_school
/introduction_to_programming/more_stuff/regex.rb
UTF-8
823
3.796875
4
[]
no_license
# regex stands for regular expression. A regular expression is a sequence of characters that form pattern matching rules, and is then applied to a string to look for matches. # check to see if a character exists in a string. # /put_character_here/ # =~ operator or .match method matches the character in the string...
true
c989212a7ab9ad0a5ed078a7884a22a44ddc561b
Ruby
melatran/black_thursday_lite
/lib/sales_engine.rb
UTF-8
261
2.625
3
[]
no_license
class SalesEngine attr_reader :items, :merchants def initialize(data) @items = data[:items] @merchants = data[:merchants] end def self.from_csv(data) SalesEngine.new end def item_collection end def merchant_collection end end
true
2db6d724e70e24c774adc75b49b408f1af3c41cb
Ruby
zhangsu/seal
/win32api/effect_slot.rb
UTF-8
1,223
2.546875
3
[ "WTFPL" ]
permissive
require File.join(File.dirname(__FILE__), 'core') module Seal class EffectSlot include Helper INIT = SealAPI.new('init_efs', 'p') DESTROY = SealAPI.new('destroy_efs', 'p') SET_EFFECT = SealAPI.new('set_efs_effect', 'pp') SET_GAIN = SealAPI.new('set_efs_gain', 'pi') SET_AUTO = SealAPI.new('se...
true
eec5c6b1ffcdaed242b266444d20bff88d3c7d67
Ruby
arleenponce/Animal-Shelter-Group-Project
/spec/models/pet_spec.rb
UTF-8
2,763
2.8125
3
[]
no_license
require 'rails_helper' describe Pet do it "is valid with a name, species, gender, age, weight" do pet = Pet.new( name: 'Killer', species: 'dog', gender: 'female', age: '2', weight: '70') expect(pet).to be_valid end it "is invalid without a name" do p...
true
dcffb2c3e0fe4ef97fa56eb43141f9554f8ca051
Ruby
szhu/rubocop
/lib/rubocop/cop/layout/indentation_consistency.rb
UTF-8
3,585
2.640625
3
[ "MIT", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true module RuboCop module Cop module Layout # This cops checks for inconsistent indentation. # # The difference between `rails` and `normal` is that the `rails` style # prescribes that in classes and modules the `protected` and `private` # modifier keywords...
true
1c954a0ecc14bf0056c122f6a6f5ded290ab6f51
Ruby
elahefler/phase-0-tracks
/ruby/puppy_methods.rb
UTF-8
987
3.875
4
[]
no_license
class Puppy def initialize puts "Initializing puppy instance..." end def fetch(toy) puts "I brought back the #{toy}!" toy end def roll_over puts "Puppy rolls over" end def speak(num) num.times do puts "Woof!" end num end def dog_years(year) puts year*7 year end def pla...
true
04df428b5e12e7512483bf5912b565723c2bde86
Ruby
timurcatakli/awesome-tweet-machine
/db/seeds.rb
UTF-8
1,048
2.71875
3
[]
no_license
# lindsey = User.create(name: 'Lindsey') # tweet = Tweet.create(post: "Hello World") # timur = User.create(name: 'Timur') require 'faker' require_relative '../app/models/user' require_relative '../app/models/tweet' 20.times do name = Faker::Name.name user = User.create( name: name, username: Fak...
true
6f787e08594358b08b2243d1e0391d2d84afc152
Ruby
AlexStoll/Ruby_Intro
/Excercises/rubybasics/User_Input/2.rb
UTF-8
169
4.25
4
[]
no_license
# Ask user for their age, then convert that to months. puts "What's your age in years?" years = gets.chomp.to_i months = years * 12 puts "You are #{months} months old."
true
3562799cd01f9b5b0072d1f1994fb3b84a6a4a6f
Ruby
sds/navo
/lib/navo/logger.rb
UTF-8
3,250
3.0625
3
[ "MIT" ]
permissive
require 'digest' require 'fileutils' require 'logger' module Navo # Manages the display of output and writing of log files. # # The goal is to make the tool easier to read when running from the command # line, but preserving all useful information in log files as well so in-depth # debugging can be performed...
true
afdb2dc6cf94bcaa321a318d501b66869fe49a29
Ruby
Jordaoluveri/Test-First-Ruby
/08_book_titles/book.rb
UTF-8
421
3.578125
4
[]
no_license
class Book attr_accessor :title def title=(title) not_capitalizable = %w[the a an and in of] if title.split(" ").length > 1 cap = title.split(" ") cap[0].capitalize! new_title = "" cap.each do |t| if not_capitalizable.include?(t) new_title += t + " " else new_title += t.capitalize ...
true
212c5d095d8e8111eedb5a3f8edd4c380372e5e0
Ruby
hoshi-sano/reino_otoge
/app/reino_otoge/partial_view.rb
UTF-8
2,566
2.921875
3
[ "Zlib" ]
permissive
module ReinoOtoge # シーン内で表示/非表示が切り替わる画面要素のベースとなるクラス class PartialView SHOW_HIDE_SPEED = 50 attr_accessor :finish_hiding_callback def initialize # 要素の描画先をRenderTargetにすることで、表示する要素を一括で表示/非表示 # 切り替えることを実現する。 # 継承先のクラスでは以下のようなコードを実行する必要がある。 # # some_sprite.target = @render_...
true
b00efc62fbc9b78871109a68d86e4bb42f17b621
Ruby
gleuch/gmail-rb
/lib/gmail-rb/model/message.rb
UTF-8
2,601
2.5625
3
[ "MIT" ]
permissive
module Gmail module Model class Message require 'base64' attr_accessor :id, :thread_id, :labels, :subject, :to, :from, :cc, :bcc, :date, :message_html, :message_text, :attachments, :raw, :snippet def initialize(opts) @id = opts.fetch('id') @thread_id = opts.fetch('threadId') ...
true
bf6447987e440e25e042cf25ba87e76b3a9633bd
Ruby
Gerlane/URI
/1073.rb
UTF-8
93
3.265625
3
[]
no_license
n = gets.strip.to_i 1.upto (n) do |num| puts "#{num}^2 = #{num**2}" if num % 2 == 0 end
true
725883f8c400b8d5e8af7ee99ff5be16e9a8550b
Ruby
spartalisdigital/lotu
/lib/lotu/systems/collision_system.rb
UTF-8
834
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Lotu class CollisionSystem < BaseSystem def initialize(user, opts={}) super @user.extend UserMethods @entities = Hash.new{ |h,k| h[k] = [] } @actions = {} end def add_entity(obj, tag) @entities[tag] << obj end def remove_entity(obj, tag) @entities[tag]...
true
9a9e4a8a036890e11e224a4f5271b11b70b95c97
Ruby
kierarad/patu
/print_stuff.rb
UTF-8
416
3.6875
4
[]
no_license
def print_while_sleeping(num_of_times, counter) until counter > num_of_times puts "********************************" puts "sleeping" puts "..." puts "counter: #{counter}" puts "..." puts "num_of_times: #{num_of_times}" puts "********************************" counter += 1 num_of_ti...
true
74dbcc8853999a03a6a8093faa6a353057faca13
Ruby
hayeah/rubish
/lib/rubish/job_control.rb
UTF-8
1,008
2.5625
3
[]
no_license
# TODO extend this for bg/fg (maybe?) # Assume that job control is used by a single thread... require 'thread' class Rubish::JobControl class << self def current Rubish::Context.current.job_control end end def initialize @mutex = Mutex.new @jobs = {} end def jobs @jobs.values e...
true
6fadbb12446a66cfdb56c75599dc6bbef76efeb4
Ruby
alvingho25/pokemon-rainbow-ukirama
/app/models/pokemon_trainer.rb
UTF-8
1,026
2.8125
3
[]
no_license
class PokemonTrainer < ApplicationRecord belongs_to :trainer belongs_to :pokemon validate :same_pokemon, on: :create validate :five_pokemon, on: :create def win_rate sql = " select case when battle > 0 then win*100/battle else 0 e...
true
6a6dc6d716b7904f1519cc3a70c309b631b48400
Ruby
tylerjharden/rdf_context
/lib/rdf_context/namespace.rb
UTF-8
3,368
2.890625
3
[ "MIT" ]
permissive
module RdfContext # From RdfContext class Namespace attr_accessor :prefix, :fragment ## # Creates a new namespace given a URI and the prefix. # # nil is a valid prefix to specify the default namespace # ==== Example # Namespace.new("http://xmlns.com/foaf/0.1/", "foaf") # => returns...
true
76591f40254bb300d6abce31d9f57ed32f242e3e
Ruby
ramon-84/piedra_papel_tijera
/piedra_papel_tijera.rb
UTF-8
1,280
3.90625
4
[]
no_license
player1 = 0 player2 = 0 puts 'Turno jugador 1:' puts '-----------------' puts '1. Piedra' puts '2. Papel' puts '3. Tijera' puts '4. Salir' puts "\n" puts 'Jugador 1, elije una opción:' player1 = gets.chomp.to_i puts "\n" if player1 == 4 puts 'Saliendo del juego...' puts "\n" elsif player1 == 1 || player1 ...
true
4620f3fd487d2b6aec332675968976481f795022
Ruby
ubeninja77/Hashmap-Questions
/lib/permutations.rb
UTF-8
392
3.515625
4
[ "MIT" ]
permissive
def permutations?(string1, string2) hash = {} if string1.length != string2.length return false end string1.each_char do |letter| if hash[letter] hash[letter] += 1 else hash[letter] = 1 end end string2.each_char do |letter| if hash[letter] && hash[letter] != 0 hash[...
true
6c65ca9577afc45684d66d81b2359ba255e332f9
Ruby
HolyChris/EnterpriseDemo_Backend
/config/initializers/time.rb
UTF-8
86
2.671875
3
[]
no_license
require 'time' class Time def hour_format self.hour * 100 + self.min end end
true
e7fa2cb6c3874f7af49525745443d3478900ebec
Ruby
Blakealtman123/Ixperience
/exercises/d3/list.rb
UTF-8
165
3.65625
4
[]
no_license
puts "Welcome to list builder!\nWhat can I add?" arr = []; while true arr.push(gets.strip) puts "Added! Your list is" puts arr.inspect puts "What can I add?" end
true