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
90b26a945ad3590abb4e6a791b20d0f60cbdade8
Ruby
Ichaelus/scripts_slower_in_truffle
/revcomp.rb
UTF-8
1,205
2.90625
3
[]
no_license
require 'benchmark' # The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org # # Contributed by Peter Bjarke Olsen # Modified by Doug King # Modified by Joseph LaFata # Modified by Michael Leimstädtner CODES = 'wsatugcyrkmbdhvnATUGCYRKMBDHVN' COMPLEMENTS = 'WSTAACGRYMKVHDBNTAACGRYMKVHD...
true
d1855f17b90d71a0aab4c837c1bfb17596b24aac
Ruby
thebluber/textanalysis
/app.rb
UTF-8
1,698
2.875
3
[]
no_license
#encoding:utf-8 require "sinatra" class Text attr_accessor :text, :w_list, :frequency def initialize(file) @text = file.read.force_encoding("utf-8") @w_list = @text.split.map(&:downcase).map{|w| w.gsub(/\p{Punct}/, "")}.reject{|i| i == ""} @frequency = self.count_rel.reverse end #Häufigkeit zählen...
true
fbfd3ae674e83fc6e4c104c0dda9c3c065d60f30
Ruby
tcurley42/uva-basketball-scraper
/lib/uva_basketball/game.rb
UTF-8
187
2.65625
3
[ "MIT" ]
permissive
class Game attr_accessor :home_team, :away_team, :id, :score, :outcome, :date def initialize(attributes_hash) attributes_hash.each {|attr, val| send("{#attr}=", val)} end end
true
17ad79036386e03d6fc88082a6be9434084cf144
Ruby
alextmk/Project-Odin-Ruby-Programming
/Hangman/Dictionary.rb
UTF-8
579
3.640625
4
[]
no_license
class Dictionary def initialize(min,max) @words=open_file("./5desk.txt") @select_words_min_max=@words.select do |i| i.length>=min&&i.length<=max end end def get_a_word return @select_words_min_max[get_random] end private def get_random #returns randomly a number between 0 and select_words.length-1 ...
true
8a9a3afe2696717a88f1b269678b531a1f07af50
Ruby
JTorr/RubyKatas
/each_cons.rb
UTF-8
46
2.8125
3
[]
no_license
puts (1..10).each_cons(3) { |array| p array }
true
f79e125c744192ea4606577bf7f494864dccc789
Ruby
osak/Contest
/IPSC/2012/k.rb
UTF-8
682
2.96875
3
[]
no_license
#!/usr/bin/env ruby gets.to_i.times do r, c, d = gets.split.map(&:to_i) height, width = r, c field = Array.new(r){Array.new(c, 0)} step = 1 loop do break if height.zero? or width.zero? if height > width width.times do |col| [height,d].min.times do |row| field[r+row][c+col] = ...
true
271078ec32198f33f2883879099ed35aacad4e41
Ruby
joneshf/scrapyard
/lib/scrapyard/key.rb
UTF-8
651
2.6875
3
[ "BSD-3-Clause" ]
permissive
require 'pathname' require 'digest' module Scrapyard class Key def initialize(key) @key = key end def checksum!(log) @key = @key.gsub(/(#\([^}]+\))/) do |match| f = Pathname.new match[2..-2].strip if f.exist? log.debug "Including sha1 of #{f}" Digest::SHA1...
true
7e2a674d26ada7a42bb45c93c2cac8e74d1de9fe
Ruby
wazuh/wazuh-chef
/cookbooks/wazuh_manager/libraries/helpers.rb
UTF-8
2,084
2.75
3
[ "Apache-2.0", "GPL-2.0-only" ]
permissive
# # Cookbook Name:: ossec # Library:: helpers # # Copyright 2015, Opscode, Inc. # # 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 # # Unless r...
true
5d1d1d4117165b2bbfa611b235f9f53a2c8c5c41
Ruby
GuiMarcelino/onebitcode
/IteracaoEmCollections/map.rb
UTF-8
438
4.0625
4
[]
no_license
array = [1,2,3,4] puts "\n Executando o .map multiplicamos cada item por 2" # .map não altera o conteúdo do array original new_array = array.map do |a| a * 2 end puts "\n Array original" puts array puts "\n new array" puts new_array puts "\n Executando .map! com o simbolo de exclamação" # dessa forma com o simlo...
true
35c2b9bbadba9ff323ef7cf7146992812f9e1bab
Ruby
zapalagrzegorz/app-academy-open
/III-SQL/projects/2_AA_Questions/lib/question_like.rb
UTF-8
2,085
2.828125
3
[]
no_license
# frozen_string_literal: true require 'byebug' require_relative 'questions_database.rb' # Obiekt użytkownika serwisu class QuestionLike attr_reader :user_id, :question_id def initialize(props) @question_id = props['question_id'] @user_id = props['user_id'] end def self.find_by_id(id) question_li...
true
669601722a54563e81457909280e2942978f3268
Ruby
ibuta/isabelSpartaDocs
/Week4/RubyDay3/Sinatra/controllers/posts_controller.rb
UTF-8
1,128
2.640625
3
[]
no_license
class PostsController < Sinatra::Base #::is a module, inside are the class. to access them you have to call module-class-functions configure :development do register Sinatra::Reloader end #sets root as the parent-directory of the current file set :root, File.join(File.dirname(__FILE__), '..') # sets the ...
true
c074caf97ff37a36ee0541808ab3c093000aa08b
Ruby
mobalean/galakei
/lib/galakei/spacer.rb
UTF-8
1,430
2.65625
3
[ "MIT" ]
permissive
module Galakei module Spacer # :nodoc: GIF_DATA_PREFIX = ['47494638396101000100f70000'].pack('H*') GIF_DATA_POSTFIX = ['f'*1530 + '2c000000000100010000080400010404003b'].pack('H*') NAMED_COLORS = { 'maroon' => '800000', 'red' => 'ff0000', 'orange' => 'ffA500', 'yellow' => 'ffff00...
true
f68fb29df1aa8e1c54f5cbc9800e9bfb768fe629
Ruby
eliotpiering/WorkoutTrackerServer
/db/seeds.rb
UTF-8
2,630
2.828125
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # ...
true
f61c6f96d3b3f3fd0a140c3557b88e3dd13001df
Ruby
marinar578/ga-project2
/server.rb
UTF-8
10,226
2.515625
3
[]
no_license
require "sinatra/base" require "pg" require "bcrypt" require 'digest/md5' require "pry" require "active_support/all" require "redcarpet" class Server < Sinatra::Base enable :sessions set :method_override, true def db if ENV["RACK_ENV"] == "production" @db ||= PG.connect( dbname: ENV["POSTGRES...
true
362f3aaca7e2e4e48edaaef4f8e5dea92e9a8aab
Ruby
avifoxi/impj_ride4reform_fundraising_app
/app/models/mailing_address.rb
UTF-8
1,475
2.8125
3
[ "MIT" ]
permissive
class MailingAddress < ActiveRecord::Base belongs_to :user has_many :rider_year_registrations, through: :user validates_presence_of :user validates_associated :user, on: :create validates_presence_of :line_1, :city, :state, :zip validates :zip, length: { is: 5 } validate :zip_num_length_check, if: :zip ...
true
94578238ce071f2a0525f849234382bd737b018e
Ruby
tejasgowdaki/e-cart
/lib/tasks/setup_data.rake
UTF-8
2,684
2.53125
3
[]
no_license
task :setup_data => :environment do # Creating roles Role.create(name: "admin") Role.create(name: "user") # Creating users and assign roles user = User.create(email: "admin@gmail.com", username: "Admin", password: "9900176115") user.roles.push(Role.first) #assign admin role user.roles.push(Role.last) #assign ...
true
5f05ea1dab950665ca28d57340ebde11e8c85ff5
Ruby
waihon/enumerable
/find_all.rb
UTF-8
421
3.8125
4
[]
no_license
# find_all { |obj| block } → array # find_all → an_enumerator # # Returns an array containing all elements of enum for which the given block # returns a true value. # # If no block is given, an Enumerator is returned instead. # # find_all and select are two names for the same method. require 'pp' pp (1..10).find_al...
true
f236bcea4a938a62d34bcd0921bf1e9a30b41a92
Ruby
cmr119/find_a_school_in_pa
/db/seeds.rb
UTF-8
7,292
2.625
3
[]
no_license
# scrape for the school district rankings begin SchoolDistrict.delete_all sd_ranks = %i(rank_2013 rank_2012 name rank_11th rank_8th rank_7th rank_6th rank_5th rank_4th rank_3rd) sd_details = { :statewide_rank => "Statewide rank", :economic_disadvantaged_rank => "Economic disadvantaged rank", :ov...
true
70d94ba33c7ae6b04d8b33ae9af213e71febb97f
Ruby
wesleye2003/vending-machine
/views/display.rb
UTF-8
271
2.859375
3
[ "MIT" ]
permissive
module Display def show_inserted_value if self.inserted_value > 0 self.display = self.inserted_value/100.to_f else self.display = "INSERT COIN" end end def not_enough_for(item) self.display = "PRICE \n #{item.price/100.to_f}" end end
true
738e356dacccffcd0a253f4dcdae8ea1c6954b9e
Ruby
gitlaura/cheap_tourist_fast_tourist
/spec/runner_spec.rb
UTF-8
957
3
3
[]
no_license
require 'runner' describe "Runner" do let(:file) {"sample-input.txt"} let(:departure_city) {"A"} let(:arrival_city) {"Z"} it "gets the cases from the flight parser" do file = "sample-input.txt" departure_city = "A" arrival_city = "Z" expect(File).to receive(:open) expect(FlightRouteCalculator).to rec...
true
98426a093e245e89751fdc156bd4c7338e1d254b
Ruby
khEYVILLkh/terminator
/volumator.rb
UTF-8
10,717
2.671875
3
[]
no_license
#!/usr/bin/env ruby # Author: Peter Schroeter (peter.schroeter@rightscale.com) # require 'rubygems' require 'ruby-debug' require 'rest_connection' require 'time' require 'logger' require 'trollop' opts = Trollop::options do version "0.1.0" banner <<-EOS Delete old volumes and snapshots across all clouds. Will d...
true
fe2702f481dce1e3c1426a571d724cd21d90a674
Ruby
jinp6301/appacademy-exercises
/w1d2/rpn_calculator.rb
UTF-8
2,107
4.3125
4
[]
no_license
## NOTE: I wrote the code to pass the tests, regardless of what I thought the 'spirit' of the question was. # The code is written to pass the tests minimally, rather than to pass them 'well'. I noted places where I did more than the tests required to pass. class RPNCalculator attr_accessor :stack def initialize ...
true
f61e05a9036a8b3a83e3bdb8f33599dc211799e7
Ruby
alexombre/Muscle_ta_POO
/app_03.rb
UTF-8
591
3.046875
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' puts "------------------------------------------------" puts "|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |" puts "|Le but du jeu est d'être le dernier survivant !|" puts "------------------------------------------------" ...
true
852b8721d0631057d061eb930fd1f5dafd51a9e2
Ruby
cavellerson/Ruby_Project_4
/app/models/entry.rb
UTF-8
2,693
2.59375
3
[]
no_license
class Entry < ApplicationRecord if(ENV['DATABASE_URL']) uri = URI.parse(ENV['DATABASE_URL']) DB = PG.connect(uri.hostname, uri.port, nil, nil, uri.path[1..-1], uri.user, uri.password) else DB = PG.connect(host: "localhost", port: 5432, dbname: 'to_do_api_development') end def se...
true
b0a9ec7bce29aac2b5a5aa9452a028129ae8a6a4
Ruby
pozorvlak/Pivotal-Tracker-IRC-bot
/user.rb
UTF-8
1,810
2.8125
3
[ "MIT" ]
permissive
require 'set' require 'yaml' require 'rubygems' require 'pivotal-tracker' class User class << self attr_accessor :save_location attr_accessor :users attr_accessor :logger end attr_accessor :current_story attr_accessor :current_tracker attr_reader :token attr_reader :initials attr_reader :c...
true
b499eb9ca2440ed6dcfd543e07bf9c5c91f2a656
Ruby
BaReinhard/github-awards
/extras/models/open_street_map_client.rb
UTF-8
558
2.65625
3
[ "MIT" ]
permissive
class OpenStreetMapClient def initialize(proxy_opts={}) @proxy_opts = proxy_opts end def geocode(location) response = HTTParty.get("http://nominatim.openstreetmap.org/search?q=#{URI.encode(location)}&format=json&accept-language=en-US&addressdetails=1", @proxy_opts) result = JSON.parse(response.body...
true
568c151edf64634e5fadbb1d4a0fc4896312b0e9
Ruby
gmallard/stompserver_ng
/test/test_0001_conn.rb
UTF-8
976
2.765625
3
[ "MIT" ]
permissive
require 'rubygems' require 'stomp' # require 'test/unit' $:.unshift File.dirname(__FILE__) require 'test_0000_base' # # Basic connection tests. # class Test_0001_Conn < Test_0000_Base # def setup super @times = 10 end # Sanity check parameters def test_0000_params check_parms() end # Single...
true
8ac25b968bc984693410815a6c531a0b71d173f4
Ruby
thiagocanto/bowling
/src/helpers/loader.rb
UTF-8
490
3.125
3
[]
no_license
# Extract data from raw file and sets it up # for the game to be started correctly class Loader def self.extract_players(plays) plays .map { |string| string.split.first } .reduce { |memo, name| [*memo].include?(name) ? [*memo] : [*memo, name] } end def self.extract_points_for_players(plays, playe...
true
6914d5d7758be2a9bfd0299856150eef2128eee7
Ruby
TerminalStar/intercom-test
/bin/find_closest_customers.rb
UTF-8
992
2.921875
3
[]
no_license
$LOAD_PATH.unshift(File.expand_path(".", "lib")) $LOAD_PATH.unshift(File.expand_path(".", "services")) require 'customer_locator' puts 'Finding customers...' file_path = CustomerLocator::DEFAULT_FILE_PATH distance = CustomerLocator::DEFAULT_DISTANCE_KM file_arg_index = ARGV.find_index("--filepath") distance_arg_ind...
true
a2826eb5b3f30463b354b0331071fa31a05a9173
Ruby
ryaan-anthony/jamcity
/lib/jamcity/views/step_grid.rb
UTF-8
608
2.59375
3
[]
no_license
# frozen_string_literal: true require 'jamcity/models/elements/step' module Jamcity module StepGrid def draw_steps (0..1).map do |channel| (0..7).map do |step| add_step(step, channel) end end end def steps collection[:step] end def add_step(x, y) ...
true
464ad6657089c50ea651eac1acfd47fce8f2f7ea
Ruby
swiftype/flex_columns
/spec/flex_columns/system/types_system_spec.rb
UTF-8
3,612
2.515625
3
[ "MIT" ]
permissive
require 'flex_columns' require 'flex_columns/helpers/system_helpers' describe "FlexColumns basic operations" do include FlexColumns::Helpers::SystemHelpers before :each do @dh = FlexColumns::Helpers::DatabaseHelper.new @dh.setup_activerecord! create_standard_system_spec_tables! end after :each d...
true
9670c07d7a8fda719a636e037ab8082e07bee39b
Ruby
timlesallen/mao
/lib/mao/filter.rb
UTF-8
5,573
2.984375
3
[]
no_license
# encoding: utf-8 # A mix-in for any kind of filter in a where clause (vis-à-vis # Mao::Query#where). module Mao::Filter # If +obj+ is a Mao::Filter, call #finalize on it; otherwise, use # Mao.escape_literal to escape +obj.to_s+. def self.finalize_or_literal(obj) if obj.is_a? Mao::Filter obj.finalize ...
true
a6d983e292c1e1483f184a6c16d9a98daadc57b3
Ruby
bc-venkata/nexpose
/addToAssetGroup.rb
UTF-8
2,659
2.90625
3
[]
no_license
#!/usr/bin/env ruby # Date Created: 07.21.2017 # Written by: BrianWGray # Borrows heavily from https://github.com/rapid7/nexpose-client/blob/master/scripts/create_asset_group.rb # Generated for https://community.rapid7.com/thread/7584 ## Script performs the following tasks ## 1.) Read addresses from text file ## 2.)...
true
d79cbe9aecd6d6ab4c5f1596a6fb18b80a1867c1
Ruby
beco-ippei/kyotorb
/code0529/lib/bottle.rb
UTF-8
140
3.3125
3
[]
no_license
class Bottle def self.bonus(bottles) return 0 if bottles < 3 bonus = bottles / 3 bonus + bonus(bonus + bottles % 3) end end
true
e024712a56b31800d894f76576c8f473ed59b513
Ruby
sozuuuuu/movie-modeling
/src/main.rb
UTF-8
3,642
2.796875
3
[]
no_license
# frozen_string_literal: true # typed: true require 'date' require 'holidays' require 'holidays/core_extensions/date' require 'sorbet-runtime' class Date include Holidays::CoreExtensions::Date end class ArrayHelper def self.wrap(object) if object.nil? [] elsif object.respond_to?(:to_ary) obje...
true
717ca12af80aaa084a96bdcc1a9b6a4729205b6d
Ruby
kejadlen/katas
/advent-of-code/2018/ruby/day_16.rb
UTF-8
3,240
3.0625
3
[ "MIT" ]
permissive
require "minitest" require "minitest/pride" OPCODES = { addr: ->(a, b, c) { ->(registers) { registers[c] = registers[a] + registers[b] } }, addi: ->(a, b, c) { ->(registers) { registers[c] = registers[a] + b } }, mulr: ->(a, b, c) { ->(registers) { registers[c] = registers[a] * registers[b] } }, muli: ->(a, b,...
true
42bb2e34278cdc160f75ac57d01d452ddc2db689
Ruby
linhbui/Games
/Pong/Ruby/lib/title.rb
UTF-8
2,510
3.1875
3
[]
no_license
require 'rubygems' require 'rubygame' require './lib/shared.rb' require './lib/pause.rb' require './lib/title.rb' require './lib/ingame.rb' class Title def initialize game @game = game @screen = game.screen @queue = game.queue @title_text = Text.new 0, 35, "Pong", 100 @pl...
true
ec202eaad52435df81bf5bd6870dcc29c861bf41
Ruby
timsully/introduction_to_programming
/ruby_basics/hashes/adding_the_year.rb
UTF-8
183
3.171875
3
[]
no_license
=begin Using the code below, add the key :year and the value 2003 to car. =end car = { :type => sedan, :color => blue, :mileage => 80_000, :year => 2003 } # car[:year] = 2003
true
a2b53656662933624f5cc8c53ae797bf913ffae0
Ruby
RubyCamp/rc2019su_g1
/scenes/levels/LevelsManager.rb
UTF-8
3,207
2.84375
3
[]
no_license
module Levels class LevelsManager def initialize @level_img = Image.load("images/background.jpg") @count_sound = Sound.new("sounds/SE/countdown.wav") @start_sound = Sound.new("sounds/SE/start.wav") @FONT_SIZE = 64 @limit_time = 5 @box_img = Image.new(425,300,[255,0,25]) e...
true
7f2548a3c31f8d3272f26fa764e8143777a397a4
Ruby
xdite/disaster-tw-2009
/vendor/plugins/auto_html/test/functional/auto_html_for_test.rb
UTF-8
1,058
2.515625
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + '/../test_helper' class Article < ActiveRecord::Base auto_html_for :body do html_escape youtube(:width => 400, :height => 250) image link(:target => "_blank", :rel => "nofollow") simple_format end end class AutoHtmlForTest < Test::Unit::TestCase def setup ...
true
8850f2beca372ae5275a21c1db94e14f1658fa31
Ruby
kodekaren/ruby-objects-has-many-lab-online-web-sp-000
/lib/post.rb
UTF-8
263
2.921875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Post attr_accessor :title, :author, :author_name @@all = [] def initialize(title) @title = title @@all<<self end def self.all @@all end def author_name if author == nil puts nil else self.author.name end end end
true
867cf066136a667992743e36914b3753d318dc0c
Ruby
ethunk/Launch-Academy
/petflix-night/test.rb
UTF-8
249
4.125
4
[]
no_license
my_array = [1,2,3,4,5] new_array = [] my_array.each do |element| if (element % 2 == 0) new_array << element end end puts new_array #=> [2, 4] # is equivalent to: puts my_array.select { |element| element % 2 == 0 } #=> [2, 4]
true
632984d6401274a85e2a992e8a312cdff5596598
Ruby
haczyslaw/dev-test
/app/services/price_service.rb
UTF-8
229
2.609375
3
[]
no_license
class PriceService attr_reader :body, :price def initialize(uri) @body = download_uri(uri) end def perform raise 'Not implemented' end private def download_uri(uri) Net::HTTP.get(URI(uri)) end end
true
e3110fc1da1fe6be47e8755417974612ba78e8c5
Ruby
feigningfigure/WDI_NYC_Apr14_String
/w01/d03/Jane_Shin/animal_noises.rb
UTF-8
405
4.0625
4
[]
no_license
def animal_noises(input) # while (input != "Q") case input when "cat" puts "Meow!" menu when "dog" puts "Woof" menu end # menu #end end def menu puts "What animal would you like to hear, cat or dog? Type Q if you'd rather not." input = gets.chomp #only exists within the scope of menu fun...
true
431678b7472aae3308eabf4ec2a01cb6704efb2b
Ruby
hannahkwarren/mid-mod1
/spec/course_spec.rb
UTF-8
638
3.15625
3
[]
no_license
require './lib/course' require './lib/student' RSpec.describe do before(:each) do @course = Course.new("Calculus", 2) @student1 = Student.new({name: "Morgan", age: 21}) @student2 = Student.new({name: "Jordan", age: 29}) end it 'exists' do expect(@course).to be_instance_of(Course) end it 'e...
true
825337ee5b0a6fbea14955cabd86cbc8a2872798
Ruby
mfeinLearn/collaborating-objects-tdd-sample
/lib/author.rb
UTF-8
735
3.03125
3
[]
no_license
class Author attr_accessor :name def initialize @stories = [] # has_many stories interface end def stories # has_many stories interface @stories.dup.freeze end def add_story(story) # has_many stories interface raise AssociationTypeMismatchError, "#{story.class} received, Story expected." if !...
true
b65987a0d0817903c857e17def7830100eeb5554
Ruby
philcowans/tracker
/app/models/timestamp_ref.rb
UTF-8
365
3.046875
3
[]
no_license
class TimestampRef attr_reader :timestamp def initialize(value) case namespace(value) when "now" @timestamp = Time.now when "iso" @timestamp = Time.parse(timestamp_value(value)) end end private def namespace(value) value.match(/^([^:]+)/)[1] end def timestamp_value(...
true
05e2303af1e04535d2346eb69af46513e2b55c64
Ruby
mukamimurithi/test_first_ruby2
/03_simon_says/simon_says.rb
UTF-8
389
3.75
4
[]
no_license
def echo(hello) hello end def shout(hello) hello.upcase end def repeat (hello, x = 2) ([hello] * x) .join (" ") end def start_of_word(hello, a=1) hello [0,a] end def first_word(word) word.split.first end def titleize(sentence) little_words = %w(end over and the) sentence.capitalize.gsub(/(\w+)/) do |word...
true
eb1862b0f20c82df20201eecc1b3cd03c0673e52
Ruby
rails/rails
/activesupport/lib/active_support/core_ext/date/calculations.rb
UTF-8
5,848
2.953125
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true require "date" require "active_support/duration" require "active_support/core_ext/object/acts_like" require "active_support/core_ext/date/zones" require "active_support/core_ext/time/zones" require "active_support/core_ext/date_and_time/calculations" class Date include DateAndTime::Cal...
true
8b9b5872b96f36cd9c44c1448f299f23a298db60
Ruby
Billyhelm/programming-univbasics-nds-green-grocer-part-1-hou01-seng-ft-082420
/lib/grocer.rb
UTF-8
726
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def find_item_by_name_in_collection(item, cart) if cart == nil return nil end new_hash = cart.select {|hash| hash[:item] == item} new_hash[0] end def consolidate_cart(cart) new_array = [] cart.map do |hash| if find_item_by_name_in_collection(hash[:item],new_array) index = ne...
true
bcb2ce7232b5fe80e9f85e59dc1addc7f03c66dc
Ruby
turingschool-projects/activerecord-obstacle-course
/spec/models/aroc_week_5_spec.rb
UTF-8
7,708
2.9375
3
[]
no_license
require 'rails_helper' describe 'ActiveRecord Obstacle Course, Week 5' do # Looking for your test setup data? # It's currently inside /spec/rails_helper.rb # Not a very elegant solution, but works for this iteration. # Here are the docs associated with ActiveRecord queries: http://guides.rubyonrails.org/active_recor...
true
4694807d5c78e8ba885819ff8de7003f71ea8ae7
Ruby
billspat/puzzelish
/puzzelish.rb
UTF-8
1,700
3.625
4
[ "WTFPL" ]
permissive
# puzzleish.rb pat@billspat.com # dwtfyw license # # very simplistic cipher/decipher : converts string into numeric code based on alphabetic indexing # uses a starter or base number, a multiplier number, and a list of letters used for indexing that includes # all of the letters in the secret # example # s = 8; m = 38...
true
cc89c949bbc1b82a4f93453db97bc00cd62a13ad
Ruby
dxypher/tic_tac_toe
/spec/computer_first_player_spec.rb
UTF-8
4,394
3.015625
3
[]
no_license
require './lib/computer_player' require './lib/board' describe 'XMoveSequence' do context "Computer Player is 'O' mover in game" do let(:computer_player) {ComputerPlayer.new("computer")} let(:board) {Board.new} it "should make 1 the first move" do move = computer_player.get_next_computer_move(boar...
true
c73e01493d627a03bdf41378ceced7c446634feb
Ruby
mcinello/ruby_fundamentals3
/exercise5.rb
UTF-8
1,418
4.28125
4
[]
no_license
#Hash of 3 cities of the world and their population cities = {Toronto: 2731571, Seoul: 9914381, Tokyo: 13617445} # #Sum total of all the populations total = 0 cities.each do |city, population| total += population.to_i end print "The total population is #{total}" # # -------------------------------------------------...
true
6079b70c04a388f647db2af0822e9d560f271009
Ruby
00derp/vulnscrape
/lib/Page.rb
UTF-8
2,106
2.765625
3
[]
no_license
class Page attr_reader :response, :url, :header @@cookie = nil @@username = nil @@password = nil @@logger = nil def initialize response, url @response = response @url = url @header = response.header.to_hash.map { |k, v| "#{k}: #{v}" }.join('\r\n') end def self.set_cookie cookie @@cookie ...
true
8f7ffccd96247ec1a2fcde7eb81a637a87e0f06c
Ruby
GarySiu/w4-d3-pig-latin
/models/pig_latin.rb
UTF-8
301
3.3125
3
[]
no_license
class Piggy def self.translate word if word[0].match(/[aeiou]/) # word = 'Started with a vowel!' word += 'yay' else # word = 'Started with a consanant!' first_letter = word[0] word.delete! first_letter word = word + first_letter + 'ay' end end end
true
5ef044833eaac420b4e8bcdc638610a66a6bdf32
Ruby
cmounce/give-take
/src/rngtools.rb
UTF-8
5,238
3.578125
4
[]
no_license
require 'digest' require 'securerandom' require 'set' # A collection of random-number utility functions. # All random numbers are securely generated. In this context, "secure" means that past outputs cannot be used # to predict future outputs, and vice-versa. This is overkill, but hey, this whole project is overkill. ...
true
074d4d499a911b0b33c9a902147920a6ed9a8221
Ruby
augustinevt/library_ruby
/spec/patron_spec.rb
UTF-8
1,301
2.640625
3
[]
no_license
require 'spec_helper' describe 'Patron' do describe '#save' do it 'should save patron to library' do new_patron = Patron.new({patron_last: 'Smith', patron_first: 'John', phone: '123-456-7890', id: nil}) new_patron.save() expect(Patron.all()).to eq([new_patron]) end end describe '.find...
true
2f14921b449cc588b614d6660f8d3ceb0c07fb7b
Ruby
martinos/boson-sick
/home/.boson/commands/bash_helper.rb
UTF-8
307
2.578125
3
[]
no_license
module BashHelper def preprocess(preprocessor_command, *command) while filename = $stdin.gets filename.chomp! cmd = "#{preprocessor_command} #{filename} | #{command.join(' ')}" IO.popen(cmd, "r").each_line do |line| print "#{filename}: #{line}" end end end end
true
90d35fa6eef9d643a04fd4bef0fd345eb152df69
Ruby
dmilburn/mvc_lecture
/runner.rb
UTF-8
232
2.5625
3
[]
no_license
require 'csv' require_relative 'shmikea' require_relative 'furniture' require_relative 'furniture_loader' shmikea = Shmikea.new('shmikea.csv') puts "Here's the catalogue!" shmikea.furniture.each do |furniture| puts furniture end
true
a4fb504479d8a08ae6e865bb7eab840aa9f4baba
Ruby
Vetchu/RubyLabs
/Lab1/primes.rb
UTF-8
327
3.6875
4
[]
no_license
require 'prime.rb' def primes(*args) for x in args do tmpx = x.to_c.to_f rescue -1 x = x.to_f rescue 1 newx = x.to_i rescue 0 if tmpx == x if newx == x if Prime.prime?(newx) puts newx end end end end end if ARGV.empty? puts "argumenty?" else primes(*AR...
true
7f7f93d8229dc01ab1f44c4fbc6f5ed7501d2907
Ruby
tuananhnguyen1708/booking_bus
/app/services/bus_services/create_bus.rb
UTF-8
375
2.6875
3
[]
no_license
module BusServices class CreateBus def initialize params = {} @name = params[:name] @model_bus = params[:model] end def perform bus = Bus.new name: name, model_bus_id: model_bus.id, number_of_seats: model_bus.amount_of_seats return true if bus.save false end ...
true
8573acf444a4dc097134b420f99ada72e983dedb
Ruby
sushengloong/gauge
/app/helpers/transactions_helper.rb
UTF-8
350
2.59375
3
[]
no_license
module TransactionsHelper def display_amount(trans) return "" unless trans.is_a? Transaction color = 'red' sign = '-' if trans.trans_type == Category::TYPE_INCOME color = 'green' sign = '+' end "<span style='color:#{color};font-weight:bold'>#{sign}#{number_to_currency(trans.amount)...
true
a6e5aa6d48f2c673beaebf04dcab4202a38f9f1d
Ruby
PritpalSS/Ruby-Projects
/FirstProject/userInput.rb
UTF-8
335
4.3125
4
[]
no_license
puts "This is First Line"; print "This is second Line \n" #puts "Enter your Name"; #name = gets.chomp #puts name.length puts "Enter your Area" area = gets.to_f #convert input string into integer using (to_i), into floating point using (to_f) puts area puts area.class #.class is used to check the data typ...
true
5524f6db6b89e5827430974af771ce325ed90786
Ruby
yakschuss/event_registration
/app/models/create_charge.rb
UTF-8
421
2.796875
3
[]
no_license
class CreateCharge attr_reader :amount, :source def initialize(amount, source) # raise if source.empty? || source.nil? @amount = amount @source = source end def send_request_to_stripe @response = Stripe::Charge.create( amount: amount, currency: 'usd', source: source ) e...
true
6748e6c5b57adfde3bb26970319263aa26ed00bd
Ruby
SamChris/Ice-Cream-Finder
/ice_cream_finder.rb
UTF-8
2,470
3.078125
3
[]
no_license
require 'json' require 'addressable/uri' require 'rest-client' def get_nearby_ice_cream_places(lat, lng, the_key) location_string = "#{lat},#{lng}" address_url2 = Addressable::URI.new(:scheme => 'https', :host => "maps.googleapis.com", :path => "/maps/api/place/nearbysearch/json", :query_values => {:key => t...
true
1d08dcafddf250ea795afc90dcd1487950a3b0aa
Ruby
hyperoslo/heroku-deploy
/lib/heroku/command/deploy/helpers.rb
UTF-8
2,310
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'pty' module Heroku::Command::Deploy::Helpers # Runs given command using a pseudo-terminal to allow streaming of output # # Any given block receives the buffered output and its return value is # evaluated as success (truthy) or failure (falsy). If no block is given, # the actual process exit status ...
true
170edab5edfc575ef4c7513d9c54d36ae7ab5c37
Ruby
Kalakalot/hotel
/lib/date_range.rb
UTF-8
2,517
3.34375
3
[]
no_license
# lib/date_range.rb module Hotel class DateRange attr_accessor :start_date, :end_date def initialize(start_date, end_date) @start_date = start_date @end_date = end_date if end_date < start_date raise ArgumentError.new( "The start date must be before...
true
6bb4cac1e9c10a6598a34ceafebd8ee5dcb9fd17
Ruby
Jnworsley/homework
/firstprogram.rb
UTF-8
226
4.03125
4
[]
no_license
puts "Type in an animal" animal = gets.chomp.to_s if animal == "dog" puts "WOOF!" elsif animal == "cat" puts "MEOW!" elsif animal == "bird" puts "CHIRP!" else puts "I don't know this animal" end
true
fd5f3ab353606380f5d1067acdce96b54cba9f01
Ruby
ClaudioFerreir/Coding-Challenges
/lib/codewars/extract_domain_name.rb
UTF-8
503
3.390625
3
[]
no_license
=begin Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example: domain_name("http://github.com/carbonfive/raygun") == "github" domain_name("http://www.zombie-bites.com") == "zombie-bites" domain_name("https://www.cnet.com") == "cnet" =end #https:/...
true
6ae17a5bbc027acbeb977488e3dd9348b7f770b0
Ruby
TTSAtlanta/Ruby
/person.rb
UTF-8
269
3.890625
4
[]
no_license
class Person def initialize(name, city) @name = name @city = city end def name @name end def city @city end end dude = Person.new("Rich", "Atlanta") puts "The name of the object is #{dude.name}" puts "The city of the object is #{dude.city}"
true
4cfa287d9199e93442dd48c61c99f0d1c2fcaa1d
Ruby
sdanko11/test_scores
/calculate_class_stats_class.rb
UTF-8
1,001
3.265625
3
[]
no_license
class CalculateClassStats attr_reader :class_stats def initialize(grades) @all_students_and_grades = grades @class_stats = [] end def calculate_class_stats @all_students_and_grades.students_and_grades.each do |student| grade_group = {} if student[:grade] >= 90 grade_group = {...
true
07aa71e3a2504e8f8746d819e1b277b7f91045d6
Ruby
framgia/FPH_RubyOnRailsHomework
/ruby.rb
UTF-8
917
4.5
4
[]
no_license
# homework04 # 1. 変数xに'Hello World'を入れ、出力してください。 x = 'Hello World' puts x # 2. 変数yに'こんにちは'をいれ、出力してください。次に同じyに'こんばんは'をにゅうりょくしてください。 y = 'こんにちは' puts y y = 'こんばんは' puts y # 3. 文字の連結 # 変数greetingに'こんにちは'をいれ、変数nameにあなたの名前を入れてください。そしてその文字同士を連結させてください。 greeting = 'こんにちは' name = '佐野' puts greeting + name # 4. gets.cho...
true
eedf473b8edb59a42221ec924a7e13977e66d6d6
Ruby
TylerK64/phase-0-tracks
/ruby/shout.rb
UTF-8
567
3.953125
4
[]
no_license
module Shout def yell_angrily(words) words + "!!!" + " :(" end def yell_happily(words) words + "?!?!" + " :)" end =begin def self.yell_angrily(words) words + "!!!" + " :(" end def self.yelling_happily(words) words + "!?!?" + " :)" end =end end class Referee inc...
true
7d15b004137f2a073ea27ee4bf6048357468ec92
Ruby
sul-dlss/dor-services-client
/lib/dor/services/client/events.rb
UTF-8
2,085
2.59375
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
# frozen_string_literal: true require 'active_support/json' # required for serializing time as iso8601 module Dor module Services class Client # API calls that are about retrieving metadata class Events < VersionedService Event = Struct.new(:event_type, :data, :timestamp, keyword_init: true)...
true
6a509669dd0c1f7c99647f6feb8a2f1d5c533ffb
Ruby
5up3rc/scout_apm_ruby
/lib/scout_apm/slow_request_policy.rb
UTF-8
3,062
3.015625
3
[ "Artistic-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
# Long running class that determines if, and in how much detail a potentially # slow transaction should be recorded in module ScoutApm class SlowRequestPolicy CAPTURE_TYPES = [ CAPTURE_DETAIL = "capture_detail", CAPTURE_NONE = "capture_none", ] # Adjust speed points. See the function ...
true
8d86fba42da88bfe4047581652a025cb4aecd58d
Ruby
fredmp/battleship
/app/models/ship.rb
UTF-8
1,038
3.171875
3
[]
no_license
class Ship attr_accessor :id, :name, :parts def initialize(params = {}) self.id = params[:id] self.name = params[:name] self.parts = params[:parts] end def navigate_to(board, positions) index = 0 positions.each do |position_id| set_part(parts[index], board.element_by_id(position_id)...
true
286b020a9683db9de293252c14fcd0df8a3e447c
Ruby
yogeshbhardwaj11/bot_saves_princess
/spec/bot_save_princess2_spec.rb
UTF-8
1,236
2.703125
3
[]
no_license
# frozen_string_literal: true require_relative '../lib/bot_saves_princess2.rb' describe BotSavesPrincess2 do let(:mario_x) { 1 } let(:mario_y) { 2 } let(:grid_matrix) { ['---', '-p-', '-m-'] } describe 'display_path' do subject { described_class.new.display_path(mario_x, mario_y, grid_matrix) } it {...
true
f0334263bc974e882f23fc74d20709e91dac654c
Ruby
bterkuile/simply_stored
/spec/has_many_spec.rb
UTF-8
15,755
2.53125
3
[ "ISC", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'spec_helper' describe "HasMany" do context "has_many" do context "with has_many" do it "create a fetch method for the associated objects" do user = User.new user.should respond_to :posts end it "raise an error if another property with the same name already exists" do ...
true
650b6ce3b61ff515c9db5843aa399da5a93ded06
Ruby
nomatteus/adventofcode
/2019/day17/day17.rb
UTF-8
3,357
3.71875
4
[]
no_license
require 'pry' require 'matrix' require 'set' require_relative '../day13/intcode_day13' input = IO.read('input') program = Intcode::Helpers.parse_program(input) class ScaffoldGrid SCAFFOLD = '#' OPEN_SPACE = '.' # Find the robot ROBOT_CHARS = { up: '^', left: '<', down: 'v', right: '>', in...
true
ba940e71be22c6f550bd3a263556f00f4dbe01e7
Ruby
SoggyNoose/Lab9-kimsj
/ChatBot-kimsj/chatbot.rb
UTF-8
365
3.515625
4
[]
no_license
STDOUT.sync = true puts 'What is your name?' name = gets.chomp puts "Hello, #{name}!" puts "Choose one of the following games:" puts "1. Chess" puts "2. World of Warcraft" puts "3. Tiddlywinks" puts "4. Global Thermonuclear War" puts "5. A Punch to the Teeth" choice = gets.chomp if (choice != "4") puts "I do not feel l...
true
c318154e0bac1782ce5421224a78c1c3cbf68aa5
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/grade-school/461ee1918e724c26bb9875d0ea532564.rb
UTF-8
362
3.28125
3
[]
no_license
class School attr_accessor :db def initialize @db = {} end def add(student_name, grade_level) @db[grade_level] ||= [] @db[grade_level] << student_name end def grade(level) @db[level] || [] end def sort @db.keys.sort.each_with_object({}) do |grade_level, db| db[grade_level] ...
true
d1aec08d5c23af235e78ccc82e91366db03c5040
Ruby
anicholas4747/Project-Portfolio
/2 - Chess/game.rb
UTF-8
2,398
3.78125
4
[]
no_license
require_relative "display.rb" require_relative "human_player.rb" require_relative "computer_player.rb" class Game attr_reader :board, :display, :player_1, :player_2, :current_player def initialize(board, display, player_1, player_2) @board = board @display = display @player_1, @player_2...
true
903a99dd93074dbbf131d100f2a970b929e8235b
Ruby
anjelicakay/elevator
/elevator_with_tdd.rb
UTF-8
5,942
3.625
4
[]
no_license
require 'rspec' class Elevator attr_reader :number_of_floors attr_accessor :current_floor, :direction, :selected_floors def initialize(input_options) @number_of_floors = 25 @direction = input_options[:direction] @selected_floors = input_options[:selected_floors] @current_floor = input_options[:c...
true
74d7c455b5b8b23f6f66183ae14d69a211b56228
Ruby
mfaraz/whichBus
/app/models/busstop.rb
UTF-8
2,881
2.609375
3
[]
no_license
class Busstop < ActiveRecord::Base #include Distance has_many :route_busstops, :dependent => :restrict has_many :routes, through: :route_busstops belongs_to :admin PI = 3.141592653589793 validates :busStopName, presence: true, format: { with: /\A^[a-zA-Z\d ]+$\Z/i, message: "only a...
true
7389e50340698a072fbe666d06780f4b291a3f4e
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/robot-name/7009468f90ce4ae0a11a75ff7518a69c.rb
UTF-8
294
3.125
3
[]
no_license
class Robot attr_accessor :name def initialize @name = create_new_name end def create_new_name prefix = (Array 'A'..'Z').shuffle[0,2].join("") suffix = (Array '0'..'9').shuffle[0,3].join("") prefix + suffix end def reset @name = create_new_name end end
true
f2c7b9ea77bf92303c69c53a64a3f5589b01f19d
Ruby
noemiekpn/bdd-tdd-cycle
/rottenpotatoes/features/step_definitions/director_steps.rb
UTF-8
1,770
2.71875
3
[]
no_license
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) Given(/^the following movies exist:$/) do |table| # table is a Cucumber::Ast::Table movies = table.raw # Active Record objects can be created from a hash, a block or have their attributes manually set after creation. # Th...
true
f73fb1b00eb271cb03743f80ff7418ec44b0e2af
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz122_sols/solutions/Hirotsugu Asari/ccard.rb
UTF-8
2,080
3.46875
3
[ "MIT" ]
permissive
class CreditCard # Ruby Quiz #122 solution attr_reader :number, :type Initials_for = { # we assume that this list is mutually exclusive 'amex' => %r{^3[47]}, # 'bankcard' => %r{56(10|022[1-5])}, # 'chinaunion' => %r{622(12[6-9]|[2-8]|9([01]|2[0-5]))}, # 'diners' => %r{^3(0[0-5]|6)}, 'discov...
true
9fdb9c97416a7aaa883c08d5c136ebbf9561eb3d
Ruby
Naser2/ruby-advanced-class-methods-lab-dumbo-web-091718
/lib/song.rb
UTF-8
2,559
3.5625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require'pry' class Song attr_accessor :name, :artist_name @@all = [] def initialize(name=nil, artist_name=nil) @name = name @artist_name = artist_name end def self.all @@all end def save self.class.all << self end def self.create # return new_song = Song.new().save new...
true
926c56277859c37ce625a9c07f6a42b88c911bdf
Ruby
Tutor-Mentor/solved_potluck
/test/potluck_spec.rb
UTF-8
2,251
3.03125
3
[]
no_license
require './lib/dish' require './lib/potluck' RSpec.describe Potluck do let(:date) { "7-13-18" } # same as date = "7-13-18" let(:dishes) { [] } let(:potluck) { Potluck.new(date) } let(:cocktail_meatballs) { Dish.new("Cocktail Meatballs", :entre) } let(:summer_pizza) { Dish.new("Summer Pizza", :appetizer) } ...
true
946662582dde4d74f374b0a241053b2f232d53e8
Ruby
macbury/NScript
/lib/nscript/backend/base.rb
UTF-8
844
2.65625
3
[ "MIT" ]
permissive
module NScript::Backend class Base def initialize @fibers = [] end def fiber_count @fibers.size end def http_get(url, options={}) throw "unimplemented" end def stop throw "unimplemented" end def every(time) throw "unimplemented" end def ...
true
ae399849156fd798bc08351e33fdce7325288af6
Ruby
ULL-ESIT-LPP-1718/threads
/13.deadlock.rb
UTF-8
466
3.015625
3
[]
no_license
#! /usr/bin/ruby mutex = Mutex.new cv = ConditionVariable.new a = Thread.new { mutex.synchronize { print "A: Esta en una region critica, esperando por cv\n" cv.wait(mutex) print "A: Esta en la region critica de nuevo!. Sigue\n" } } print "En medio\n" b = Thread.new { mutex.synchronize { ...
true
7d04351a29338b8612e72efcc0d44eefd7263b86
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/nth-prime/588299b5192d4bd3bb41cb4d3020af42.rb
UTF-8
166
3.40625
3
[]
no_license
require 'prime' class Prime def nth(integer) nth_prime = Prime.take(integer).last if nth_prime == nil raise ArgumentError else nth_prime end end end
true
8f89a0a416809468838899280834910f4a6293a1
Ruby
SamWachira1/AppAcademyProjects
/word_chains_proj/word_chains.rb
UTF-8
1,803
3.5
4
[]
no_license
require 'set' class WordChainer attr_reader :dictionary def initialize(filename) @dictionary = File.readlines(filename).map(&:chomp) @dictionary = Set.new(@dictionary) end def run(source, target) @current_words, @all_seen_words = [source], {target => nil} until @current_wo...
true
5a6311eb0bef8fa05f440273e96c68c31733606c
Ruby
valentinowong/OO-Auto-Shop-nyc-clarke-web-071519
/tools/console.rb
UTF-8
1,693
2.515625
3
[]
no_license
require_relative '../config/environment.rb' def reload load 'config/environment.rb' end # Test Data # - CarOwners harry = CarOwner.new("Harry Potter") hermione = CarOwner.new("Hermione Granger") ron = CarOwner.new("Ron Weasley") neville = CarOwner.new("Neville Longbottom") ginny = CarOwner.new("Ginny Weasley") # - ...
true
9fdb53aa9b8833ccb53750bbb1ea305a5ba6d130
Ruby
jtzero/vigilem-x11
/lib/vigilem/x11/event_queue.rb
UTF-8
3,631
2.703125
3
[ "MIT" ]
permissive
require 'xlib' require 'vigilem/support/obj_space' require 'vigilem/core/buffer' require 'vigilem/core/eventable' require 'vigilem/x11/display' module Vigilem module X11 # # class EventQueue include Core::Buffer attr_reader :display extend Support::ObjSpace class << self...
true
85522d2f2860f7425e33b89de4920b0f6a9cd909
Ruby
SalamanderMike/notes
/week_06_ruby_intro/mon_intro/pTimes.rb
UTF-8
195
3.375
3
[]
no_license
# this is a comment # name a file with a <file_name> # and a `.rb` extension def pTimes(statement, num) num.times do puts statement end end statement = gets.chomp pTimes(statement, 10)
true
a1bd77ebbf8db670d3c473c636ac80592367c8e3
Ruby
Ciccillo73/Gym_app
/models/joining.rb
UTF-8
1,761
3
3
[]
no_license
require_relative( '../db/sql_runner' ) class Joining attr_reader :id attr_accessor :member_id, :gym_course_id def initialize(joining) @id = joining['id'].to_i if joining['id'] @member_id = joining['member_id'].to_i @gym_course_id = joining['gym_course_id'].to_i end def save() sql = "INSERT...
true
c1aca3ad9845a74a85619ee80a9dafac811c3207
Ruby
rlew421/book_review
/spec/features/user_can_find_book_by_name_spec.rb
UTF-8
1,608
2.765625
3
[]
no_license
require 'rails_helper' RSpec.describe "user can input a book's title into the form and hit search" do it "and can see the book's info including: - title - author - genres" do visit '/' fill_in :title, with: "The Man Who Saw Everything" click_button "Find Book" expect(current_path).to eq(sear...
true
e7c3da3186b054a268952506af526a2bf817f6c1
Ruby
shadowmaru/merchant
/merchant.rb
UTF-8
304
2.875
3
[]
no_license
#!/usr/bin/env ruby require './lib/merchant' def process_input(file_name) lines = [] File.open(file_name, 'r').each_line do |line| lines << line end puts Merchant.call(lines) end if ARGV.empty? puts 'Please pass input file location as argument' exit 1 else process_input ARGV[0] end
true