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
47a283a3e1571cefd0ff477be59c523c5ab0f489
Ruby
kanpou0108/launchschool
/live-session-beginning-ruby/01/class_attr_accessor.rb
UTF-8
251
3.625
4
[]
no_license
# 15:44 class Person # attr_accessor :name def name=(new_name) @name = new_name end def name @name end end bob = Person.new # bob.name = 'Bob' # here is not assignment. here is method invocation. bob.name=('Bob') p bob.name
true
c221a04a8256372defb0e304ec8bf7593cc46427
Ruby
andyprickett/launch-school
/100-programming-and-back-end-prep/learn-to-program-book/11_try_04.rb
UTF-8
2,902
4.25
4
[]
no_license
def music_shuffle(filenames) # Create a new array where the filename array is mapped so that each # element is now an array that contains: # 1) the full song filename as before # 2) an array of the full path split into individual elements at '/' songs_and_paths = filenames.map do |s| [s, s.split('/')] # [...
true
16718a3965652d99ef4ccdb7c7868f72d5b48291
Ruby
toyhammered/codility_and_project_euler_and_examples
/examples/dynamic_programming/bills_change.rb
UTF-8
3,928
3.984375
4
[]
no_license
require 'rspec/autorun' # You are a cashier working at a register that only contains an unlimited amount of $2, $5 and $10 bills. # Create a function that, given a cash amount, returns the correct change with minimum amount of bills. # If it is impossible to give the correct change, return null, otherwise return an obj...
true
39d4d2eee2c5460161403bc984b80c353edfccfd
Ruby
oumiya/click_rpg
/scripts/Scene_Base.rb
UTF-8
542
2.703125
3
[]
no_license
# ゲーム中の全てのシーンのスーパークラス class Scene_Base # ループ前処理 例えばインスタンス変数の初期化などを行う def start() end # 画面の描画をする ※ このメソッドに描画処理以外の処理を入れてはならない def draw() end # フレーム更新処理 def update() end # ループ後処理 def terminate() end # 次のシーンに遷移 # 遷移しない場合は nil を返す def get_next_scene() return nil end end
true
5e2b25f142ddfbbeed82ca48684be3f0900bac00
Ruby
ericxcross/PDA_codeclan
/Screenshots/02_hashes/hashes.rb
UTF-8
691
2.828125
3
[]
no_license
def find_account_with_most_money(bank_accounts) richest_account_holder = bank_accounts[:users].max_by {|user| user[:account_balance]} return richest_account_holder end bank_info = { users: [ { full_name: "Alexandra Armstrong", account_number: 193575849, pin: 1234, account_balance: 716...
true
05c6272cc2682148fdab3289e17e6a1672517c17
Ruby
banalui/project_dom_tree
/lib/queue.rb
UTF-8
453
3.828125
4
[]
no_license
class Queue def size @values.length end def initialize @values = [] end def enqueue(thing) index_to_push = @values.length @values[index_to_push] = thing @values end def dequeue cur_size = @values.length thing = @values[0] temp_array = [] (cur_size - 1).times do |index| temp_array[index] ...
true
bc91e701f4e21bc17480de8dde92e077c668cb44
Ruby
EMSwank/enigma
/test/enigma_test.rb
UTF-8
2,064
2.765625
3
[]
no_license
require './test/helper_test' require 'minitest/autorun' require 'minitest/pride' require './lib/enigma' class EnigmaTest < Minitest::Test def test_it_exists enigma = Enigma.new assert_instance_of Enigma, enigma end def test_it_can_find_encrypt_values e = Encryptor.new expected = [14, 41, 27, 16...
true
67b5b84db4b9e7be832a1f7806355ef7e7028c26
Ruby
parkr/parkr.me
/app.rb
UTF-8
1,515
2.546875
3
[]
no_license
require 'toml' require 'sequel' require 'mysql2' require 'guillotine' module Parkr class Db attr_accessor :username, :host, :port, :db_name, :password def initialize(file = "db.toml") unless env_database config_file = File.expand_path(file) configs = TOML.load_file(config_file) ...
true
9539f4351a72197c0db12575a5c8c8bd56787e05
Ruby
hipersuperultra/adventofcode
/2017/7/tree.rb
UTF-8
420
2.9375
3
[]
no_license
weights = [] programs = [] parent = {} File.foreach('input') do |line| line = line.strip program, list = line.split(' -> ') _, program, weight = (program.match(/([a-z]*) \(([0-9]*)\)/)).to_a list = list&.split(', ') || [] programs << program weights << weight parent[program] = nil if parent[program].nil...
true
70c72a57e67b8bbd099b55a2aed0d5b0b016a7f8
Ruby
ZulqarnainNazir/impact-sample
/app/models/opening.rb
UTF-8
533
2.671875
3
[]
no_license
class Opening < ActiveRecord::Base belongs_to :location, touch: true def days_and_hours { id: id, days: days, hours: hours } end def days list = [] list.push 'Sun' if sunday? list.push 'Mon' if monday? list.push 'Tue' if tuesday? list.push 'Wed' if wednesday? list.push 'Thu' if thu...
true
5c817a4f868db970f969fd3d43f425fb959cad7b
Ruby
k2nr/dropbox-restore-deleted-files
/db_restore.rb
UTF-8
2,466
2.828125
3
[]
no_license
require 'dropbox_sdk' APP_KEY = 'kdq35jzh5j4phek' APP_SECRET = 'q76tfe53hqd4u6a' def auth flow = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) authorize_url = flow.start() `open "#{authorize_url}"` puts '1. Go to: ' + authorize_url puts '2. Click "Allow" (you might have to log in first)' puts '3....
true
70bc09d05806584ae76a41998cd95f42df1e4d66
Ruby
skarb/skarb
/test/functional/simple-functions.rb
UTF-8
426
3.65625
4
[ "MIT" ]
permissive
#3 #4 #3 #5 #3 #7 #9 #a co to? #a co to? #87 #93 #13 #13 #132 #qweasd #qweasd #3 #4.5 def fun puts 3 end def fun2 puts 4 1235 fun puts 5 end def fun3 puts 7 def fun4 puts "a co to?" end puts 9 fun4 end def fun5(x) puts x end def fun6(a, c, b); puts b; puts a; puts a; end def fun7(x); x; e...
true
08e2a498bfde5153894e163b2e994a252e36cbf3
Ruby
marcsolanadal/search-algorithms
/best-first-search/search_node.rb
UTF-8
6,308
3.796875
4
[]
no_license
class SearchNode attr_accessor :state, :g, :f, :free_index def initialize(state, parent = self) @state = state @g = parent == self ? 1 : parent.g + 1 @h = calculate_h @f = @g + @h @valid_action = ["Move(Black)", "Move(Red)", "Jump(Black)", "Jump(Red)"] @free_index = index_of_free @pare...
true
e99c19961910204bf2e7ac9102a208cd80924713
Ruby
justinbkay/boise_movies
/lib/tasks/omdb.rake
UTF-8
2,241
2.65625
3
[]
no_license
require 'json' require 'uri' require 'net/http' namespace :omdb do desc 'get now playing' task get_movie_data: :environment do movies = Movie.all movies.each do |movie| uri = URI("https://www.omdbapi.com/?i=#{movie.imdb_id}&apikey=#{Rails.application.credentials.omdb_key}") res = Net::HTTP.get_...
true
478f9341fc5b9ff01d61f66c75f6aad8a4db861b
Ruby
gropmor/helloworld_app
/app/models/user.rb
UTF-8
290
3.484375
3
[]
no_license
class User def initialize @name = "mori" @age = 21 @birthplace = "Tokyo" @hobby = "piano" end def introduce <<~EOS 私の名前は#{@name}です。 年齢は#{@age}歳。 出身地は#{@birthplace}で、趣味は#{@hobby}です。 EOS end end
true
028ac74f6e16360a8e2faf500b0db4415fe45158
Ruby
javajigi/minesweeper-ruby
/lib/minesweeper/position.rb
UTF-8
557
3.40625
3
[ "MIT" ]
permissive
require_relative './index_out_of_bound_error' class Position attr_reader :x, :y def initialize(x, y) raise IndexOutOfBoundError.new unless valid?(x, 0) && valid?(y, 0) @x = x @y = y end def ==(other) @x == other.x && @y == other.y end def near_positions arr = Array.new (x-1..x+1)...
true
76541707f55f2640c277024c453d955143a5c663
Ruby
pination/fase1
/lunes/bye.rb
UTF-8
2,936
3.984375
4
[]
no_license
# Muchas veces como programador te pedirán que modeles algún proceso o situación real en código. Esta vez tendrás que modelar y replicar la interacción de dos personas. La situación es la siguiente. # ​ # ​ # Modela una interacción entre una persona y su abuela que esta un poco sorda. Para esto tendrás que echar a vol...
true
b2ace6f68bd7b71fcffa1b948600bfc575c23188
Ruby
Lee-AnnC/Ruby-Exercises
/Chapter-2/exercise two.three.rb
UTF-8
115
3.234375
3
[]
no_license
# name.rb continued puts "What is your name" name = gets.chomp puts "Hello " + name 10.times do puts name end
true
493165b4b95b2b5dcd19b35723e3c3eb5a33b66c
Ruby
tomjmcnamee/ruby-objects-has-many-lab-nyc-web-080519
/lib/artist.rb
UTF-8
475
3.25
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Artist attr_accessor :name, :songs def initialize(name) @name = name @songs = [] end #ends initialize def songs Song.all.select {|song| song.artist == self} end #ends song method def add_song(song) song.artist = self end # ends add_song method def add_song_by_name(song_nam...
true
bd827716326c62aa70f1671848e2d742825b24e8
Ruby
ChristopherDurand/Exercises
/ruby/more-topics/test_easy/equality_assertions.rb
UTF-8
311
2.84375
3
[ "MIT" ]
permissive
require 'minitest/autorun' class MyTest < Minitest::Test def test_value value =3 assert value.odd?, 'value is not odd' end # Write a minitest assertion that will fail if value.downcase does not return 'xyz'. def test_downcase value = 'XyZ' assert_equal('xyz', value.downcase) end end
true
6a53c30b3468cf0d48dec4d192d617bf51773ce3
Ruby
edfigo98/Travis
/spec/alimentos_spec.rb
UTF-8
23,910
2.984375
3
[]
no_license
#Alumno: Edgar Figueroa González require 'spec_helper' RSpec.describe Alimento do before :all do @carnevaca = Alimento.new('Vaca', 50.0, 164.0, 0.0, 21.1, 3.1) @chocolate = Alimento.new('Chocolate', 2.3, 3.4, 47.0, 5.3, 30.0) @tofu = Alimento.new('Tofu', 2.0, 2.2, 1.9, 8.0, 4.8) @lentejas = Alimento...
true
e5a5f22264dec87991164daac15cc9eb22bd6278
Ruby
Warshavski/basiq-sdk
/lib/basiq/filter_builder.rb
UTF-8
3,209
2.984375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Basiq # Basiq::FilterBuilder # # Used to build filters query. # # Filtering a collection resource is conducted via the # filter query parameter using the following notation: # # ?filter=[property].[condition]([value]) # # # NOTE : All filter values...
true
5d210707f1660f89c570c4b9972ad4ac44a51299
Ruby
mn113/adventofcode2017
/ruby/05.rb
UTF-8
358
3.203125
3
[]
no_license
$instr_list = File.open("../inputs/05input.txt", "r").each_line.map(&:to_i) def jump(pos) instr = $instr_list[pos] $instr_list[pos] -= 2 if instr >= 3 # enable this line for Part 2 only $instr_list[pos] += 1 pos += instr end # Parts 1 & 2 n = 0 pos = 0 while pos >= 0 && pos < $instr_list.length do pos = jump(pos...
true
1b01018a57cd2309263ea94d5e7069f291396b31
Ruby
WilliamJGrace/bookmark_manager
/spec/bookmark_spec.rb
UTF-8
2,857
2.78125
3
[]
no_license
require 'bookmark' require 'database_helpers' describe Bookmark do # subject(:book) { described_class.new("text",["bookmark", "bookmark2"])} # it "returns text" do # expect(book.text).to eq("text") # end # # it "returns a list of bookmakrs" do # expect(book.all).to eq(["bookmark", "bookmark2"]) # en...
true
1f37247047cfce60710346abf967a495189181a9
Ruby
JayAchTee/Ruby
/odbc-sequel.rb
UTF-8
578
2.53125
3
[]
no_license
require "sequel"; Sequel.datetime_class = DateTime; sql = "SELECT TOP 100 PERCENT * FROM Lookups WITH (NOLOCK) ORDER BY CASE WHEN ISNUMERIC(value) = 1 THEN CAST(value AS int) ELSE value END ASC"; p sql; p "testing sequel" begin cn = Sequel.odbc('Test', :user => "Test", :password => "1CANhazpazw3rd!"); version =...
true
ca6478f2dde07870d198201cd126186268a8ee7e
Ruby
bheim6/robot_world
/app/models/robot_world.rb
UTF-8
1,716
3.0625
3
[]
no_license
require './app/models/robot' class RobotWorld attr_reader :database def initialize(database) @database = database end def create(robot) database.execute("INSERT INTO robots (name, city, state, avatar, birthdate, date_hired, department) VALUES (?, ?, ?, ?, ?, ?, ?);", robot[:name...
true
a8e64732b02e9012960fb37d5c8d2d7b0d52f227
Ruby
irahey/learning-projects
/ribbit_tp/app/controllers/sessions_controller.rb
UTF-8
776
2.578125
3
[]
no_license
class SessionsController < ApplicationController def new end def create user = User.find_by_username(params[:username]) #We use the find_by_username method on the User class to retrieve the user with the provided username if user && user.authenticate(params[:password]) #we call the authenticate metho...
true
457e90a118475a3391dd5a1fdb9d7402f84cd61c
Ruby
chef/chef
/lib/chef/node/common_api.rb
UTF-8
3,936
2.859375
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#-- # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
true
4ea2bd0f906192006391062bd209438ad53bc4f7
Ruby
thnukid/facebook_data_analyzer
/classes/contact.rb
UTF-8
305
3.09375
3
[]
no_license
class Contact def self.parse(contact_text:) contact_info = contact_text.split('contact: ') Contact.new(name: String(contact_info[0]), details: contact_info[1..3].join(' ')) end attr_reader :name, :details def initialize(name:, details:) @name = name @details = details end end
true
fa6a643fb011584ae5b52f2df3c5f5faa5706b84
Ruby
truetechcode/Enumerable-module-method
/spec/method_spec.rb
UTF-8
1,364
3.640625
4
[]
no_license
require './lib/method' #=> add this require 'rspec' class Array include Enumerable end describe Enumerable do # my_array = [1,2,3,4,5] let(:my_array) { [1,2,3,4,5] } describe '#my_each' do it 'returns the values of each the modified element of an array or hash' do expect(my_array.to_a.my_each { ...
true
28d622b2b5cae9eab3985a57bc25705baa231e35
Ruby
everseinc/analytics
/app/exceptions/mission_flow.rb
UTF-8
1,399
3.328125
3
[]
no_license
## ## ** Singleton ** ## a class for indicating processing flow of all missions in one request ## class MissionFlow ### ## status enum # STATUSE = { success: 1, failure: 0 } ### ## properties # attr_accessor :flash attr_reader :status ## create Singleton ## this singleton is aliv...
true
3787940163bbba4df01eac8d7731b963d3427d75
Ruby
vigneshsarma/puzzles
/gild/tower/tower.rb
UTF-8
1,464
3.515625
4
[]
no_license
#!/usr/bin/ruby class Tower attr_accessor :particp def initialize(text='') @map={} @particp=[] digit="" individ=Array.new text.each_char do |alpha| if alpha==="(" digit="" individ=Array.new elsif alpha===" " #print "next person" elsif alpha==="," ...
true
749a50c788e51dae4accb971786a016828bf5855
Ruby
matthewdias/hummingbird-server
/lib/action/dsl.rb
UTF-8
1,151
2.546875
3
[ "Apache-2.0" ]
permissive
class Action module DSL extend ActiveSupport::Concern included do class_attribute :attribute_names end class_methods do # @param key [#to_s] the key to set up as a parameter # @param cast [Proc,nil] a function to convert an input object before calling # @param load [.find] an...
true
42f35ac5957e8d627038a3366a8f18ff3377cb5c
Ruby
karlyhoffman/general-assembly-projects
/ruby-reps-101/solutions/round3.rb
UTF-8
915
4.21875
4
[]
no_license
## Round 3 # Write a function called `toonify` that takes two parameters, `accent` and `sentence`. # - If `accent` is the string `"daffy"`, return a modified version of `sentence` with all "s" replaced with "th". # - If the accent is `"elmer"`, replace all "r" with "w". # - Feel free to add your own accents as well! #...
true
6acd3a9540baced15828b2388b906808d8ba54f3
Ruby
BryanRunner/Test_Calendar
/lib/calendar/month.rb
UTF-8
610
3.46875
3
[]
no_license
class Month < Calendar attr_accessor :number attr_accessor :date attr_accessor :name attr_accessor :days def initialize(date=DATE) @date = date @number = date.month @name = date.strftime("%B") @days = create_days(self) end def total_days # returns Fixnum of tota...
true
2a04e8fea73cb3639f8cbbe93fe53562729ea5dd
Ruby
PlumpMath/DesignPatterns-424
/Day4/State/person.rb
UTF-8
467
2.71875
3
[]
no_license
require_relative 'person_states.rb' require 'forwardable' class Person extend Forwardable def_delegators :@state , :vote , :apply_for_buspass , :conscript , :apply_for_medical_card attr_reader :state def initialize @age = 0 @state = Child.new end def increment_age @age += 1 case @age ...
true
cee101473d36fef9425983cce915d86130bae954
Ruby
Icicleta/practical_object_oriented_design_in_ruby
/04_Flexible_Interfaces/04.rb
UTF-8
1,207
4.0625
4
[]
no_license
# Law of Demeter # Now that we have a decent domain model, how would you instruct the Customer to start riding a bike? # If you answered: # customer.bike.wheel.rotate # You'd be breaking the Law of Demeter, which basically says that objects should not reach THROUGH other objects to get the code execution they want....
true
4e1635f58d239dcea5998ec46e3d70271675f545
Ruby
betagouv/dossiersco
/app/services/commune.rb
UTF-8
469
2.6875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "csv" class Commune def code_postal(code_postal) return [] unless code_postal villes = [] CSV.foreach("app/services/laposte_hexasmal.csv", col_sep: ";") do |row| villes << row[1] if row[2] == code_postal end villes.uniq end def du_code_insee(cod...
true
34b3e4c7068b91768caef91a8a7268e85fc47de4
Ruby
yenertuz/app_academy_alpha_curriculum
/05_rspec1/lib/02_calculator.rb
UTF-8
315
3.734375
4
[]
no_license
def add(p1, p2) p1 + p2 end def subtract(p1, p2) p1 - p2 end def sum(arr) t = 0 arr.each {|x| t += x} t end def multiply(p1, p2) p1 * p2 end def power(p1, p2) return 1 if p2 == 0 a = p1 (p2 - 1).times do a *= p1 end a end def factorial(p1) return 1 if (0..1).include?(p1) p1 * factorial(p1 - 1) end
true
dbb0b26f59be7a38d18142b58ca0b327e37998ef
Ruby
czak/aoc
/2020/ruby/day23-part1.rb
UTF-8
1,661
3.5625
4
[]
no_license
Node = Struct.new(:value, :next) def make_list(s) cups = s.split('').map(&:to_i) head = nil tail = nil cups.reverse.each.with_index do |n, i| if i == 0 head = tail = Node.new(n, nil) else head = Node.new(n, head) end end tail.next = head head end # current = make_list('389125...
true
9099475c087c6926d398f069ef2b88ffa440336f
Ruby
tilast/ruby2
/calculator_spec.rb
UTF-8
1,359
3.34375
3
[]
no_license
require 'rspec' require_relative 'calculator.rb' describe Calculator do before :each do @calculator = Calculator.new end describe "#new" do it "returns a new calculator object" do @calculator.should be_an_instance_of Calculator end end describe "#get" do it "can get an array of el...
true
9c503d4b5e5973831ee84737fee4869151badd80
Ruby
heroku/so_stub_very_test
/lib/so_stub_very_test.rb
UTF-8
3,512
2.828125
3
[ "MIT" ]
permissive
require "so_stub_very_test/version" require "excon" module SoStubVeryTest extend self class AmbiguousResponseError < StandardError; end class MixedNamespacesError < StandardError; end class NoPathGivenError < StandardError; end def namespace(path, host = nil, &block) validate_host(host) st...
true
8e263a751e9547ee5c6144387ddabdbff2aeba2d
Ruby
kzkaed/mastermind
/lib/mastermind/console.rb
UTF-8
4,256
3.703125
4
[ "MIT" ]
permissive
require_relative 'code_maker' require_relative 'color_string' require_relative 'pegs' module Mastermind class InvalidCode < Exception end class Console attr_accessor :color_string attr_reader :incorrect_color_message, :console_color_pegs, :console_key_pegs COLORS = %w(Red Yellow Blue Green Black ...
true
e8707139001f4fc2c41cd858eeb3234638688f6a
Ruby
kparekh01/text-summarizing-app
/summarize.rb
UTF-8
1,427
3.984375
4
[]
no_license
# Summarize_app text = %q{ Ruby is a great progrramming language. It is object oriented and has many groovy features. Some people don't like it but that's not our problem! It's easy to learn. It's great. To learn more about Ruby, visit the official ruby website today. } sentences = text.gsub(/\s...
true
4a8bc26d813d9f866afc991b0304c3e3cffcca0c
Ruby
fronx/scales
/scales.rb
UTF-8
4,154
3.15625
3
[]
no_license
#! /usr/bin/env ruby def colored? ($*.include?('--colored') || $*.include?('--color-on')) && !$*.include?('--color-off') end class String def green "\033[0;32m" + self + "\033[0m" end def red "\033[0;31m" + self + "\033[0m" end def underlined(char = '=') self + "\n" + char * self.length en...
true
4a4b9bd7743a6e47359771c0201c4c7d2b3f12d1
Ruby
Hobsmod/VictoriaII-Save-Parser
/Extractors/MassExtractCountryFinancials.rb
UTF-8
835
2.640625
3
[]
no_license
require 'oj' require_relative '..\Classes\Pop.rb' require_relative '..\Methods\ExtractCountryFinancials.rb' save_dir = '..\Savegames\\' + ARGV[0] country_array = Array.new Dir.foreach(save_dir) do |file_name| start = Time.now unless file_name =~ /Objectified/ next end this_dir = save_dir + '\\' + file_nam...
true
ef77006415507b51898a2cad42a2e91ea7731abd
Ruby
gglin/project-euler
/ruby_all/169.rb
UTF-8
454
3.96875
4
[]
no_license
# Problem 169: Exploring the number of different ways a number can be expressed as a sum of powers of 2. # http://projecteuler.net/problem=169 # Define f(0)=1 and f(n) to be the number of different ways n can be expressed as a sum of integer powers of 2 using each power no more than twice. # For example, f(10)=5 sin...
true
1ff3fd62f171b2a0a49dce53c0081412c28bb260
Ruby
naoto/cinemastar-api
/bin/animeinfo.rb
UTF-8
2,659
3.09375
3
[]
no_license
#!/usr/bin/env ruby require 'yaml' require 'date' def get_quarter season = case Date.today.month when 0..3 "冬" when 3..6 "春" when 6..9 "夏" when 9..12 "秋" end Quarter.find_by_name(season).id end def get_year...
true
b0090f8697f45b6543b12a9fc48f745cb81224ef
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/proverb/45313b2ebf7c4dafb43323f91d8589bf.rb
UTF-8
578
3.109375
3
[]
no_license
class Proverb def initialize *chain @options = chain.last.is_a?(Hash) ? chain.pop : {} @chain = chain @line = "For want of a %s the %s was lost." @conclusion = "And all for the want of a %s." end def to_s chain_of_events + conclusion end private def chain_of_events @chain...
true
c29eb7797afc0d308d6679a53d0d6821b79c0207
Ruby
wanconglei/ruby-practice
/openOrSenior.rb
UTF-8
1,255
4.09375
4
[]
no_license
=begin The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed. To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croque...
true
537f99d589581825bad1dd01dd4f0cc42946d490
Ruby
9193403494/cleo-vending_machine
/lib/cleo/vending_machine/exchange.rb
UTF-8
746
2.953125
3
[]
no_license
# frozen_string_literal: true module Cleo class VendingMachine # It holds the status of a given operation. # # Its @balance represents the amount of money on favor of the client. # # It will keep a negativa balance until the target product has been paid in full. # # Once the balance reach...
true
034db431bd2c9f35df1e94f3f5560828fa9a296a
Ruby
hatsu38/atcoder-ruby
/math_and_algorithm/003.rb
UTF-8
395
3.484375
3
[]
no_license
# frozen_string_literal: true # 整数 # N と # N 個の整数 # A # 1 # ​ # ,A # 2 # ​ # ,⋯,A # N # ​ # が与えられます。(入力の形式は「入力」セクションを参照) # # A # 1 # ​ # +A # 2 # ​ # +⋯+A # N # ​ # を出力してください。 # # input # 5 # 3 1 4 1 5 # # output # 14 gets.chomp.to_i a = gets.chomp.split.map(&:to_i) puts a.sum
true
0f899a11eb41e04d165c0c0651b1fbdc5c1fbb3a
Ruby
benash/project-euler-solutions
/4.rb
UTF-8
240
3.21875
3
[]
no_license
max = 0 999.downto(100) do |i| 999.downto(i) do |j| prod = i * j # When prod <= max, we shortcut the expensive string manipulation if prod > max && (prod == prod.to_s.reverse.to_i) max = prod end end end puts max
true
3ae43bbc89645c19695b65e8c84920e298a9ec59
Ruby
proiel/proiel
/lib/proiel/citations.rb
UTF-8
3,038
3.46875
3
[ "MIT" ]
permissive
#-- # Copyright (c) 2015 Marius L. Jøhndal # # See LICENSE in the top-level source directory for licensing terms. #++ module PROIEL module Citations # Returns a citation range that spans `cit1` to `cit2`. # # The regular expression `dividers` is used to chunk the strings, and then # the longest common...
true
8ac0b8f7cd7d0227beb99ab121a510f5ec377a3c
Ruby
graygilmore/advent-of-code
/2021/07/program.rb
UTF-8
967
3.453125
3
[]
no_license
require './base' class PartOne def initialize(input = Base.raw_input('2021/07/input.txt')) @input = input end def solution min, max = positions.minmax fuel_payloads = {} (min..max).each do |i| fuel_payloads[i] = positions.map { fuel_calculation(_1, i) }.sum end fuel_payloads.val...
true
d96732cf2d04328a5f46428bac8f1337e409717a
Ruby
anchietajunior/ruby-snake-game
/lib/game.rb
UTF-8
790
3.640625
4
[]
no_license
class Game def initialize @score = 0 @ball_x = rand(GRID_WIDTH) @ball_y = rand(GRID_HEIGHT) @finished = false end def draw unless finished? Square.new( x: @ball_x * GRID_SIZE, y: @ball_y * GRID_SIZE, size: GRID_SIZE, color: 'yellow' ) end T...
true
c9d4cd7196b548e76a5f0863057c3fa4eb1dcb9e
Ruby
r3bo0t/6lock
/app/models/record.rb
UTF-8
3,207
2.671875
3
[ "MIT" ]
permissive
require 'digest/sha2' require 'aescrypt' require 'csv' class Record include Mongoid::Document include Mongoid::Timestamps include AESCrypt embedded_in :folder, inverse_of: :records field :name, :type => String field :username, :type => String, :default => "" field :password, :type => String, :default ...
true
f2948dc1bda3dfaee75f0cdd5e7bf29ce6ee0d2b
Ruby
MigueRobles/NAPAKALAKI-Practicas-PDOO
/Napakalaki Ruby/lib/prize.rb
UTF-8
362
2.953125
3
[]
no_license
# By: Miguel Robles Urquiza # Jesús Sánchez de Lechina Tejada module NapakalakiGame class Prize def initialize(treasures, levels) @treasures = treasures @levels = levels end def getTreasures @treasures end def getLevels @levels end def to_s "T...
true
bcdbd561a1aa68522ef87f26fa28fcc78df321b4
Ruby
aleDVM/Experiencia12
/2 arrays/ejercicio2.rb
UTF-8
780
4.1875
4
[]
no_license
# Dado el array: # 1. Eliminar el ultimo elemento. # 2. Eliminar el primer elemento. # 3. Eliminar el elemento que se encuentra en la posicion media, # si el arreglo tiene un numero par de elementos entonces remover # el que se encuentre en la mitad izquierda, ejemplo: # en el arreglo [1,2,3,4] se removeria el...
true
0148b3b156177a2c513f943517bb8cf54aad0c51
Ruby
rahulvshinde/Ruby-Playground
/Basics/floats.rb
UTF-8
476
3.78125
4
[]
no_license
#Float value Examples num_one = 1.000 # You must put a 0 before your floats num99 = 0.999 # Floating point calculations tend to be accurate puts num_one.to_s + " - " + num99.to_s + " = " + (num_one - num99).to_s # 14 Digits of accuracy is the norm big_float = 1.12345678901234 puts (big_float + 0.0000000000005).to_s...
true
30d4ebc99fe6aa3feba8ee11e0f874616d193225
Ruby
cha63506/euler
/019/sundays.rb
UTF-8
138
3.0625
3
[]
no_license
require 'date' $ans = 0 (1901..2000).each do |y| (1..12).each do |m| $ans += 1 if Date.civil(y,m,1).wday == 0 end end puts $ans
true
5a14bdd1cb57146f7b3dce5d4e19403a3ee993f8
Ruby
Btate712/rails_wine_project
/app/models/wine.rb
UTF-8
688
2.640625
3
[ "MIT" ]
permissive
class Wine < ApplicationRecord validates :name, presence: true, uniqueness: true belongs_to :variety has_many :reviews has_many :wines, through: :reviews def variety_attributes=(attributes) variety = Variety.find_or_create_by(attributes) self.variety = variety if variety.valid? end def self.by_...
true
14576f59f5b3ebb3c0f070fa1ec2b14c0bf37f75
Ruby
richgurney/FormDataGenerator
/services/form_data.rb
UTF-8
446
2.5625
3
[]
no_license
require 'faker' class RandomFormData include Faker def random_first_name Name.first_name end def random_second_name Name.last_name end def random_phone_number num = Number.number(10) '0' + num end def random_username Internet.user_name end def random_email Internet.safe...
true
53e059b0f3ba4d6dc1baec6fb3da062cd22b07e8
Ruby
victorskurihin/ruby
/stepic.org/Discrete_Math/Dainiak/1.8/Step_11/Step_11.rb
UTF-8
1,948
2.921875
3
[]
no_license
#!/usr/bin/env ruby # -*- coding: utf-8 -*- ################################################################################ # $Date$ # $Id$ # $Version: 0.1$ # $Revision: 7$ # $Author: Victor |Stalker| Skurikhin <stalker@quake.ru>$ ################################################################################ # http:...
true
909bfece1905539ec871d546975be8fd42991adf
Ruby
fuzzyjulz/Commstrat-Train
/src/classes/route_list.rb
UTF-8
3,177
3.53125
4
[]
no_license
require_relative "route" class RouteList attr_accessor :routes def initialize(routeFile = nil) setRouteList( routeFile ? loadRoutesFromFile(routeFile) : [] ) end private # load the route list from a file. Int the format SE# where the start station is S, the end station is E # is the distance (one c...
true
977d9de473d11166d6cdbf51af21453f7dee7e97
Ruby
AlexRaubach/AdventofCode2017
/day10.rb
UTF-8
959
3.15625
3
[ "MIT" ]
permissive
@stepsize = [97,167,54,178,2,11,209,174,119,248,254,0,255,1,64,190] @input = '97,167,54,178,2,11,209,174,119,248,254,0,255,1,64,190' @position = 0 @skip_size = 0 @array = [] 256.times do |i| @array << i end def hash_round(hash_array, steps) steps.each do |step| (step / 2).times do |y| has...
true
b03c9816a5348b2bdaeabb78566036c6f3f954a8
Ruby
gzavaglia/rspec-fizzbuzz-online-web-prework
/fizzbuzz.rb
UTF-8
382
3
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Don't forget! This file needs to be 'required' in its spec file # See README.md for instructions on how to do this def fizzbuzz(int) #if 1 if int%3 == 0 #if 1A if int%5 == 0 "FizzBuzz" else "Fizz" end #end of if 1A elsif int%5 == 0 if int%3 == 0 "FizzBuzz" else ...
true
ab31bcc614f0a576ae282843b8443eb64243d4be
Ruby
kayhide/motive_record
/spec/active_record/base_spec.rb
UTF-8
4,242
2.859375
3
[ "MIT" ]
permissive
describe ActiveRecord::Base do use_database describe '.create' do it 'creates' do Book.count.should == 0 Book.create title: 'Book 1' Book.count.should == 1 Book.create! title: 'Book 2' Book.count.should == 2 end end describe '.first/last' do it 'returns nil if no reco...
true
bd3c4a3dc3295ba465909b50329700950cd8194b
Ruby
Rubyc/Project-Euler
/Prob2.rb
UTF-8
479
3.6875
4
[]
no_license
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. se...
true
cc4c8e845a81d22eaecea1ac2537badba7f1ad3d
Ruby
SuperMaltese/ics_bc_s18
/week2/ch08/table_of_contents.rb
UTF-8
308
3.421875
3
[]
no_license
title = 'Table of Contents' page_size = 54 puts puts title.center(page_size) puts array = [['Chapter 1: Getting Started', 'page 1'], ['Chapter 2: Numbers', 'page 9'], ['Chapter 3: Letters', 'page 13']] array.each do |row| puts row[0].ljust(page_size/2) + row[1].rjust(page_size/2) end
true
866569f1e8cbbc20bcebb2122dded2a906c98cec
Ruby
koikezlemma/map_converter
/kml_creator.rb
UTF-8
1,198
2.625
3
[]
no_license
# -*- coding: utf-8 -*- require 'rexml/document' require 'xml' require_relative 'latlon.rb' require_relative 'segment.rb' module KmlCreator module_function def create_kml(file_name, segment_array) str_alt = "0" doc = REXML::Document.new doc << REXML::XMLDecl.new('1.0', 'UTF-8') kml = doc.add_ele...
true
2be5e9ef01e833f2014cb1bfdb97cdc97738fb08
Ruby
CompMike/tts_homework
/homework2/fivequestions_hash.rb
UTF-8
1,012
4.15625
4
[]
no_license
#prompt #create a 5 questions game, that asks a question, collects the answer, compares it to my answers and outputs a score #Introduction to the game. puts "It's time for the 5 questions game! You Ready?\n" puts "Instructions: \nAnswer all questions with Y or N, your score will be output at the end of the game." #defi...
true
59d505f4e0526484314eb7d7cac3cf1df9f2bd28
Ruby
rcjara/visual
/lib/line.rb
UTF-8
2,333
2.984375
3
[]
no_license
require_relative 'background' require_relative 'shared_default_stylings' class Line include Background include DefaultsProcessor CHR_WIDTH = 3.5 CHR_HEIGHT = 5.0 LINE_DEFAULT_STYLING = { mark: :standard, #start/end markings start_mark: nil, end_mark: nil } LINE_DEPENDENT_DEFAU...
true
978744af754999db3f2b8ddffcf23080c40997cb
Ruby
lambdai/iyxzone
/app/models/guild_rule.rb
UTF-8
1,883
2.65625
3
[]
no_license
class GuildRule < ActiveRecord::Base belongs_to :guild ABSENCE = 0 PRESENCE = 1 NORMAL = 2 attr_readonly :rule_type, :guild_id validates_presence_of :reason, :message => "不能为空" validates_size_of :reason, :within => 1..200, :too_short => "不能小于1个字节", :too_long => "不能大于100个字节" validates_uniqueness...
true
4ef4ce41c2f3b647a4c833f3b52c77751b273e80
Ruby
adomokos/light-service
/spec/acceptance/rollback_spec.rb
UTF-8
2,893
2.625
3
[ "MIT" ]
permissive
require 'spec_helper' require 'test_doubles' class RollbackOrganizer extend LightService::Organizer def self.call(number) with(:number => number).reduce( AddsOneWithRollbackAction, TestDoubles::AddsTwoAction, AddsThreeWithRollbackAction ) end end class AddsOneWithRollbackAction exte...
true
e9b47a5c41231a93d03eb48fe2a5b23c73434998
Ruby
IIC2113-2015-2-Grupo1/news-getter
/filters/constitution_filter.rb
UTF-8
445
3.25
3
[]
no_license
# ConstitutionFilter file require 'json' # yet antoher simple filter class class ConstitutionFilter # words to look in the news attr_accessor :key_words # initialize def initialize key_words = File.read('./filters/key_words.json') @key_words = JSON.parse(key_words)['words'] end # filter news de...
true
1bd86f9b6aafa1928b8731aebf6a7a0ce655b17e
Ruby
einarpe/rbvaria
/json/jsonparser.rb
UTF-8
291
2.9375
3
[]
no_license
class JSONParser def self.get_parser(sth) raise "Don't know what to do!" if sth == nil case sth.class when String then return JSONStringParser.new(sth) else return JSONObjectParser.new(sth) end end def parse() raise "Abstract method called" end end
true
787955541a671ee06ac569b2c816f459b55de821
Ruby
hnaseem1/ruby_to_javascript
/autopilot.rb
UTF-8
1,838
4.21875
4
[]
no_license
def get_new_car { city: 'Toronto', passengers: 0, gas: 100, } end def add_car(cars, new_car) cars << new_car "Adding new car to fleet. Fleet size is now #{cars.length}." end def pick_up_passenger(car) car[:passengers] += 1 car[:gas] -= 10 "Picked up passenger. Car now has #{car[:passengers]}...
true
ec74e1f73fc85c117f314fba9f1cf3f6139910ce
Ruby
epitron/scripts
/wp-db
UTF-8
1,264
2.5625
3
[]
no_license
#!/usr/bin/env ruby require 'epitools/lcs' require 'pry' require 'sequel' class WP def mysql_connect_params @mysql_connect_params ||= begin vars = {} open("wp-config.php").each_line do |line| if line =~ %r{define\(['"]DB_(NAME|USER|PASSWORD|HOST)["'], ["']([^["']]+)["']\)} vars[$1...
true
1af4420d2127b56db03d4bae90803e7b30a4e4b0
Ruby
dsarkozi/COP2016
/Framework/Application/feature_definition.rb
UTF-8
1,887
2.6875
3
[]
no_license
require 'singleton' require_relative 'actived_entities_counters' require_relative 'feature' require_relative 'entity_definition' require_relative 'parser' # Class FeatureDefinition in module Application # # authors Duhoux Benoît # Version 2016 module Application class FeatureDefinition < EntityDefinition incl...
true
7809d3705d5884c7bdb4ccb54b91e859ea33132c
Ruby
Tabby-cell/github
/lib/github_api/client/orgs/members.rb
UTF-8
4,810
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# encoding: utf-8 require_relative '../../api' module Github class Client::Orgs::Members < API # List members # # List all users who are members of an organization. A member is a user # that belongs to at least 1 team in the organization. # If the authenticated user is also a member of this orga...
true
1edbe5d8d96482c4851f5364d35e4e6e03d5a3df
Ruby
mattbeedle/rango
/lib/rango/environments.rb
UTF-8
860
2.625
3
[ "MIT" ]
permissive
# encoding: utf-8 # http://wiki.github.com/botanicus/rango/environments-support require "rubyexts/attribute" module Rango class << self # @since 0.0.1 # @return [String] Returns current environment name. attribute :environment, "development" # clever environments support attribute :development...
true
3195a15aba6b1c8ba81c3c1c20d2971702e07972
Ruby
nurlywhirly/Solar-System
/ss_program.rb
UTF-8
3,503
3.734375
4
[]
no_license
require_relative 'planet' require_relative 'solar_system' # New up some planets mercury = Planet.new("Mercury",0.055,3.7,0.4,"terrestrial","42% oxygen") venus = Planet.new("Venus", 0.815, 8.87, 0.7, "terrestrial", "96.5% carbon dioxide") earth = Planet.new("Earth", 1, 9.807, 1, "terrestrial", "78.08% nitrogen") mars =...
true
cf1710aabe36d03c93c29d8f2a2074930206d755
Ruby
arseny-emchik/sem8_vksis
/lab2/main.rb
UTF-8
3,486
3.0625
3
[]
no_license
require 'optparse' require 'socket' require 'colorize' class Node OWN_PORT = 2000.freeze # use this constant if you not on localhost BUSY = 1.freeze NOT_BUSY = 0.freeze def initialize puts 'Enter NODE NUMBER to connect to: ' @node_number = gets.chomp.to_i # puts 'Enter OWN IP to connect to: ' ...
true
d21e57c23a0e9cc992da3948bde93f8a349c5be3
Ruby
carmen0208/ruby-idiomatic
/blog/delegation_and_inheritance.rb
UTF-8
773
3.109375
3
[]
no_license
class CustomList <Array def to_s join(" | ") end def +(other) mid = super(other) self.class.new(mid) end end # cLists = CustomList.new # cLists << "test with" << "a" << "list" # # p cLists.to_s cl1 = CustomList.new(%w[macbook ipad]) cl2 = CustomList.new(%w[iphone macbookpro]) p cl1 p cl1.to_s p...
true
6a7d28c3e162636c303001e4ee1f0f893f871239
Ruby
aconstandinou/ls-exercises
/101_109_small_problems/easy_1/stringy_strings.rb
UTF-8
261
3.625
4
[]
no_license
def stringy(num) string = '' (1..num).each do |ii| if ii.odd? string << '1' else string << '0' end end string end puts stringy(6) == '101010' puts stringy(9) == '101010101' puts stringy(4) == '1010' puts stringy(7) == '1010101'
true
77858b1f798c0a532d5a923db9640c50b8bab947
Ruby
arthurkronier/EuP
/Ruby/Aufgaben/aufgabe3.rb
UTF-8
373
3.21875
3
[]
no_license
name1 = "Larry" name2 = "Curly" name3 = "Moe" health = [60,125,100] puts "#{name1} has a health of #{health[0]}" puts "#{name2} has a health of #{health[1]}" #*************Moe has a health of 100.************* puts "#{name3} has a health of #{health[2]}." .center(40, '*') puts Time.now.strftime("%A %d/%m/%G at %R%P"...
true
81829e7c9838fb3afc6f894da7d16d41d0e23b46
Ruby
bhb603/old-stuff
/active-record-lite/lib/active_record_lite/01_mass_object.rb
UTF-8
665
3.1875
3
[]
no_license
require_relative '00_attr_accessor_object.rb' class MassObject < AttrAccessorObject def self.my_attr_accessible(*new_attributes) self.attributes.concat(new_attributes) end def self.attributes raise "must not call #attributes on MassObject directly" if self == MassObject @attributes ||= [] end d...
true
23ab01d4bf5fe1a510eb74351cbda541ae76e8a9
Ruby
azzahrafz99/codewars
/kyu7/friend_or_foe.rb
UTF-8
64
2.53125
3
[]
no_license
def friend(friends) friends.find_all { |a| a.length == 4} end
true
053cf8cbc0764ffc9b8e41253dd7f23e06dc48ca
Ruby
ambikavaisag/api.goodcity
/lib/classes/designator.rb
UTF-8
1,605
2.59375
3
[]
no_license
class Designator attr_accessor :package, :params, :order_id, :orders_package def initialize(package, package_params) @package = package @params = package_params @order_id = package_params[:order_id].to_i @orders_package = @package.orders_packages.new @existing_designation = OrdersPackage.find_b...
true
4bdc510f3f3206047d5604459dec00cae240d65e
Ruby
jbreeden/net-snmp2
/lib/net/snmp/mib/mib.rb
UTF-8
2,583
2.5625
3
[ "MIT" ]
permissive
module Net module SNMP module MIB # Configures the MIB directory search path (using add_mibdir ), sets up the internal # MIB framework, and then loads the appropriate MIB modules (using netsnmp_read_module # and read_mib). It should be called before any other routine that manipulates # o...
true
bae19270146c047051cc9e120d3e965cd4b64b1d
Ruby
newsdev/stevedore-uploader
/lib/parsers/stevedore_blob.rb
UTF-8
1,815
2.6875
3
[ "MIT" ]
permissive
require 'json' require 'digest/sha1' module Stevedore class StevedoreBlob attr_accessor :title, :text, :download_url, :extra def initialize(title, text, download_url=nil, extra={}) self.title = title || download_url self.text = text self.download_url = download_url self.extra = extra ...
true
eb3b3f2a482b6ad166e8362857a0fb8e6ad57454
Ruby
pyramiddig/webservices
/app/importers/trade_event/ustda_data.rb
UTF-8
3,111
2.546875
3
[]
no_license
require 'open-uri' require 'csv' module TradeEvent class UstdaData include Importable include ::VersionableResource ENDPOINT = 'http://www.ustda.gov/events/USTDATradeEvents.csv' COLUMN_HASH = { id: :id, event_name: :event_name, description: :descript...
true
260be63da15cb054c115c617a76ba846a757b6b2
Ruby
jamaspy/sei31-homework
/patricia_nunes/week04/warmup/warmup02/raindrops.rb
UTF-8
314
3.40625
3
[]
no_license
def raindrops num string = "" if num % 3 == 0 string += "Pling" end if num % 5 == 0 string += "Plang" end if num % 7 == 0 string += "Plong" end if string.length == 0 string = num.to_s end string end puts raindrops 28 puts raindrops 1755 puts raindrops 34 puts raindrops 105
true
5b8ca1c16eec3b34d8326398c077bb69ca36486c
Ruby
kanakiyajay/euler
/problem20.rb
UTF-8
402
3.84375
4
[ "Apache-2.0" ]
permissive
=begin n! means n × (n − 1) × ... × 3 × 2 × 1 For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, Find the sum of the digits in the number 100! and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. =end product = 1 (2..100).each do |number| product = product * number end sum =...
true
c4a9e1236a11b46f224e1793e668b4d8285537cd
Ruby
plemanach/quickfixruby
/test/test_parser.rb
UTF-8
869
2.640625
3
[]
no_license
require 'minitest/autorun' require 'minitest/unit' require 'parser' require 'fixmessage' include QuickFixRuby::Fix class TestParser < Minitest::Test GOOD_MESSAGE = "8=FIX.4.1\x019=61\x0135=A\x0134=1\x0149=EXEC\x0152=20121105-23:24:06\x0156=BANZAI\x0198=0\x01108=30\x0110=003\x01" def test_parse_with_bad_message...
true
edd15591ccfd9f926342d47f369134ee4d44658d
Ruby
yzn/thread-patterns
/05-producer-consumer/eater_thread.rb
UTF-8
239
2.9375
3
[ "Zlib", "MIT" ]
permissive
class EaterThread < Thread def initialize(name, table) self.name = name @table = table super() do execute end end private def execute loop do cake = @table.take sleep rand end end end
true
1948428b72cd28af4f8175d659b4d1f87f450374
Ruby
pcorliss/nand_tetris
/11/lib/symbol_table.rb
UTF-8
871
3.3125
3
[]
no_license
require 'set' class SymbolTable Symbol = Struct.new(:name, :type, :kind, :offset) do def write_symbol "#{KIND_LOOKUP[kind]} #{offset}" end end KIND_LOOKUP = { 'ARG' => 'argument', 'STATIC' => 'static', 'FIELD' => 'this', 'VAR' => 'local', } VALID_KINDS = Set.new(['ARG', 'STATIC...
true
b380ba70700a73217918c8b75d7d2a8ce50b9675
Ruby
Phase-0-Redo/phase-0-tracks
/databases/kitten_maker/drinker.rb
UTF-8
4,035
3.921875
4
[]
no_license
require 'pp' class Drink attr_reader :name, :decaf attr_accessor :drink_size, :iced, :number_of_shots def initialize puts "Warming up robobarista..." @name = "" @decaf = false end def name puts "Hi I'm robobarista Hal 9000.\n What is your name?\n" @name = gets.chomp end def decaf ...
true
3c23db729b1c509335ad3ffc9756b90dd11aa9d8
Ruby
bshain/learn_ruby
/03_simon_says/simon_says.rb
UTF-8
596
3.84375
4
[]
no_license
def echo(word) return word end def shout(word) word.upcase end def repeat(string, num=2) ([string] * num).join(' ') end def start_of_word(word, num=0) array = word.split(//) (array[0..(num-1)]).join end def first_word(word) array = word.split array[0] end def titleize(sentence) small = ["and", "over", "the...
true