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
558acacc93a1839e6ea748c63eff40f0f006edc1
Ruby
tracysteinberg/snakes_and_ladders
/game.rb
UTF-8
618
3.515625
4
[]
no_license
class Game attr_reader :players def initialize(player1, player2) @players = [player1, player2] @player_turn = player1 # @dice = Die.new([1,2,3,4,5,6]) @dice = 4 end def player_turn @player_turn end def player_takes_turn Player.position += 4 end # 1.Who is joining the game? # 2.Determine whose...
true
c2360fd09920d0e481328293afd9441e7492afa0
Ruby
WowzaMediaSystems/wsc-sdk-ruby
/lib/wsc_sdk/model.rb
UTF-8
15,651
2.734375
3
[ "BSD-3-Clause" ]
permissive
####> This code and all components © 2015 – 2019 Wowza Media Systems, LLC. All rights reserved. ####> This code is licensed pursuant to the BSD 3-Clause License. require 'wsc_sdk/modules/api_response' require 'wsc_sdk/modules/loggable' require 'wsc_sdk/schema' require 'wsc_sdk/schema_attribute' module WscSdk # Mod...
true
7b95815b9f72e91100b967220ff5230bc76269f8
Ruby
bambery/card-games
/game.rb
UTF-8
1,134
3.40625
3
[]
no_license
class Game require './player' require './deck' require './blackjack' attr_reader :players def initialize(deck_config: {}, num_decks: 1, num_players: 4, hand_size: 0) @players = get_players(num_players) @deck = Deck.new(deck_config: deck_config, num_decks: num_decks) # if no defined hand size, ...
true
84ddd697de0b9a4b23f6d02a1ef22ac62a22ced6
Ruby
sethgeyer/tuffcookies
/lib/tuffcookies/mark.rb
UTF-8
1,672
3.640625
4
[]
no_license
module TuffCookie class Mark attr_accessor :guess, :current_card, :flipped_card, :difference def initialize(guess, current_card, flipped_card) @guess = guess @current_card = current_card @flipped_card = flipped_card end def evaluate if @guess == "s" answer = "...
true
9d52ab89d937264ad834f0e4154b913e25577933
Ruby
reni0810/ruby
/method_overriding.rb
UTF-8
145
3.015625
3
[]
no_license
class Demo def abc puts "hi am in demo" end end class Demo1 < Demo def abc puts "hi am in demo1" end end obj = Demo1.new obj.abc
true
d888f826d5305abcdf6a282edb05116f6d563f54
Ruby
bloudermilk/github_backup
/backup
UTF-8
752
2.578125
3
[]
no_license
#!/usr/bin/env ruby abort "Usage: backup [username] [path]" if ARGV.length != 2 require "fileutils" require "octopi" include Octopi username, backup_path = *ARGV # Make sure the backup folder is created FileUtils.mkdir_p backup_path FileUtils.cd backup_path authenticated do user = User.find(username) user.rep...
true
46936cc33ae2ede5c6acd5796700eb946b49161a
Ruby
pepeul1191/codeigniter-webpack-backbone
/db/doctors.rb
UTF-8
3,053
2.59375
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'sequel' Sequel::Model.plugin :json_serializer DB = Sequel.connect('sqlite://coa.db') class Branch < Sequel::Model(DB[:branches]) end class Specialism < Sequel::Model(DB[:specialisms]) end class Dentist < Sequel::Model(DB[:dentists]) end class DentistBranch < Sequel::Model(DB[:den...
true
ef4f93b739f0dad95251d4521fa5c7cbd7eb4095
Ruby
luser2/industrializator
/war.rb
UTF-8
8,316
2.9375
3
[]
no_license
require 'controls/battle.rb' $weapon_rating = {nil => 1, :stone_club => 2, :bow => 4} $armor_rating = {nil => 0} $weapon_range = {:bow => 6, :musket => 4} $armor_piercing ={:musket =>true} $explosive = {:granade =>true, :mortar=>true} class Soldier attr_reader :weapon,:armor,:vehicle def initialize(barracks,w = n...
true
2c09de6d44d80944ee9b8f75415ab4db65b62821
Ruby
devinsiphone/RB101
/lesson_2/rock_paper_scissors_lizard_spock.rb
UTF-8
3,831
4.03125
4
[]
no_license
# rock_paper_scissors_lizard_spock.rb # # This game is a variation on the Rock Paper Scissors game that adds two more # options - Lizard and Spock. The full explanation and rules are here. There's # also a hilarious Big Bang Theory video about it here. # # The goal of this bonus is to add Lizard and Spock into your cod...
true
39b1cabd4b63bfdd147c836ded1efe00484b9990
Ruby
bohdanmykytey/Ruby
/firstNonRepeatingChar.rb
UTF-8
430
4.125
4
[]
no_license
=begin Given a string s consisting of small English letters, find and return the first instance of a non-repeating character in it. If there is no such character, return '_'. For s = "abacabad", the output should be firstNotRepeatingCharacter(s) = 'c'. =end def firstNotRepeatingCharacter(s) s.chars.uniq...
true
8eeea7ba4dea3a5842c1f9b85938a57d09c1e85e
Ruby
kenohata/nico_dict
/lib/nico_dict/word.rb
UTF-8
597
2.515625
3
[ "MIT" ]
permissive
class NicoDict::Word attr_accessor :file attr_reader :html def initialize file @file = file end def html @html ||= Nokogiri::HTML(file.read) end def title el = html.at_css("title") and el.text end def word /^(.+)とは \(/ =~ title $1 end def meta_refresh html.at_css("meta...
true
0d45946f9f9405e4da7222df18bff81166b62ba0
Ruby
gaybro8777/TagBot
/changelog/changelog.rb
UTF-8
4,270
2.734375
3
[ "MIT" ]
permissive
# Hacks because github_changelog_generator is a Git dependency. paths = Dir.glob("**/github-changelog-generator-*/lib") $LOAD_PATH.unshift(*paths) require 'github_changelog_generator' require 'json' require 'octokit' require 'tempfile' $ack_regex = /\\\* \*this changelog was automatically generated .*/i $changelog_re...
true
c6e1e48329f527c80a5fcc6b731ef2963aa2188f
Ruby
alexander-zw/ICS-Course
/ch14/log.rb
UTF-8
881
4.40625
4
[]
no_license
# Includes a method that shows when a block begins, ends, and what it returns # Then tests the method # shows when a block begins, ends, and what it returns def log description puts "Beginning \"#{description}\"..." returnVal = yield puts "... \"#{description}\" finished, returning: #{returnVal}" return return...
true
c4af05206a83129dd1836b0a6045a9f8b9ba755d
Ruby
FernandaFranco/programming-foundations
/lesson_2/calculator.rb
UTF-8
1,863
4.34375
4
[]
no_license
def prompt(message) puts "=> #{message}" end def valid_number?(n) n.to_i.nonzero? end def operation_to_message(operation) case operation when "add" "Adding" when "subtract" "Subtracting" when "multiply" "Multiplying" when "divide" "Dividing" end end numbers = {} numbers["first"] = nil...
true
901839528e615824509426b2f4b11738c64cd074
Ruby
jin/algorithms_and_data_structures.rb
/hackerrank/closest_numbers.rb
UTF-8
463
3.84375
4
[]
no_license
# https://www.hackerrank.com/challenges/closest-numbers # Given a list of numbers, find pairs of numbers with the smallest difference between them. If there are multiple pairs, print all. gets arr = gets.strip.split.map(&:to_i) smallest = 2 ** 32 answer = [] arr.sort.each_cons(2) do |x, y| diff = (x - y).abs if di...
true
b78c6d9e65fe4276a718abb66d971e314b22a5f1
Ruby
Odania-IT/odania-varnish
/lib/generators/generate_sites_vcl.rb
UTF-8
614
2.578125
3
[]
no_license
require_relative 'generate_site_vcl' module Varnish class GenerateSitesVcl attr_accessor :domains, :template def initialize(domains) self.domains = domains self.template = File.new("#{VARNISH_BASE_DIR}/templates/varnish/sites.vcl.erb").read end def render Erubis::Eruby.new(self.template).result(bin...
true
359ed6f21116abee3f51c10f4d9f55f1de8fc46b
Ruby
WalterBrito/Ruby
/EstruturaRepetição/ex3.15.rb
UTF-8
476
3.9375
4
[]
no_license
# -*- coding: utf-8 -*- =begin Faça um programa que calcule o fatorial de um número inteiro fornecido pelo usuário. Ex.: 5!=5.4.3.2.1=120 =end puts "=============================================================" print "Digite um numero: " num = gets.chomp.to_i numCalc = num fatorial = 1 while numCalc > 0 fatori...
true
356605a14d0949462541bbbd8103bf1e6918e43b
Ruby
harshdeepkanhai/bubble-sort
/bubble_sort.rb
UTF-8
542
3.359375
3
[]
no_license
def bubble_sort(arr) n = arr.size (0...n).each do |i| swapped = false (0...n - i - 1).each do |j| if arr[j] > arr[j + 1] arr[j], arr[j + 1] = arr[j + 1], arr[j] swapped = true end end break if swapped == false end arr end def bubble_sort_by(arr) n = arr.size (0.....
true
a5b5d15c2bcb3b7a8032eeb2a0cf1e4cb044481f
Ruby
pablotarga/metronom-tictactoe
/lib/player_interface/base.rb
UTF-8
351
2.984375
3
[]
no_license
module PlayerInterface class Base class InvalidBoardError < ArgumentError end attr_reader :player def initialize(player) raise ArgumentError.new('player must be a Player') unless player.is_a?(Player) @player = player end def pick(board) raise InvalidBoardError unless board....
true
31ca0f16b6d832250c14365d328bf76c323b17a0
Ruby
sittercity/bureaucrat
/lib/bureaucrat/widgets/currency_widget.rb
UTF-8
1,298
2.75
3
[ "MIT" ]
permissive
#-- # @copyright This file is copyright (C) 2000-2012 by Sittercity, Inc. # All rights reserved. # All Sittercity source code is CONFIDENTIAL and # not for distribution or unauthorized use. # For license information contact Sittercity, Inc. #++ require 'bureaucrat/widget...
true
8172569eef0e25c4a847133ae3c0916a6fa9c275
Ruby
sgvincentho/introrubycourse
/variables_exercise_5.rb
UTF-8
34
3.109375
3
[]
no_license
x = 0 3.times do x+=1 end puts x
true
1cf41db247b15d41c8db9337ed69f88a9add8619
Ruby
melizhou/session0202_exercises
/MelissaZhou-melizhou/D4/reverse.rb
UTF-8
206
3.578125
4
[]
no_license
def reverse(array) reverse_array = [] array.each do |item| reverse_array.unshift(item) end reverse_array end random_objects = ["apples", 4, "bananas", "kiwis", "pears"] puts reverse random_objects
true
6925e4df30b62ef9c03edfe2a41fac034d67287f
Ruby
poppen/bowling-game-kata-in-ruby
/bowling.rb
UTF-8
734
3.375
3
[]
no_license
class Bowling FRAME_NUM = 10 def initialize @throws = [] end def hit(pins) @throws.push pins end def score score = 0 index = 0 FRAME_NUM.times do if strike?(index) score += strike_score(index) index += 1 elsif spare?(index) score += spare_score(ind...
true
4f98951357093fc16d1b3a8fd910b3e71e3704c9
Ruby
idynkydnk/knight_moves
/knight_moves.rb
UTF-8
1,827
3.953125
4
[]
no_license
class Knight attr_accessor :position, :possible_moves, :board, :parent def initialize(position = nil) @position = position @parent = nil @board = create_board @possible_moves = new_moves(position = [0,0]) end def create_board board = [] 8.times do |x| 8.times do |y| boa...
true
07421c660c8d92650d8d1e804972da9b3e6cc8ac
Ruby
pallygurl/mined_minds_kata
/testminedmindsfunction.rb
UTF-8
687
3.4375
3
[]
no_license
require "minitest/autorun" require_relative "minedmindsfunction.rb" class TestMinedMindsFunction <Minitest::Test def test_1_equals_1 assert_equal(1, 1) end def test_1_returns_1 # the value in the () is the value we're putting in the variable called number in the function file assert_equal(1, mined_minds(...
true
24b0c4c42155ca94a68549daff5924fc8a320f64
Ruby
tmoia/launchschool
/intro_to_programming/the_basics/exo_1.rb
UTF-8
347
4.46875
4
[]
no_license
#Add two strings together that, when concatenated, return your first and last name as your full name in one string. first_name = "Thibaut" last_name = "Moia" # String concatenation puts first_name + " " + last_name # String interpolation puts "My first name is #{first_name} and my last name is #{last_name}. I am #...
true
110d535e7a79dafbc65bd940523db5eeeac4a344
Ruby
nipoko/ruby_practice
/volume0/0046/differential.rb
UTF-8
637
3.6875
4
[]
no_license
#!/usr/bin/ruby =begin AOJ問題 volume0-0046 標高差 今まで登ったことのある山の標高を記録したデータがあります。 このデータを読み込んで、一番高い山と一番低い山の標高差を出力して終了するプログラムを作成してください。 [input] 山の高さ(実数) ... ... [output] 一番高い山と一番低い山の標高差(実数)。出力は0.01以下の誤差を含んでもよい。 =end higher = 0 lower = 0 while line = gets tmp = line.to_f lower = tmp if lower == 0 || lower > tmp higher ...
true
f630abecd673906e7ae28ae721d5c65a8cbd62ee
Ruby
edwinvalles/AvionProjectFolder
/squares.rb
UTF-8
236
4.0625
4
[]
no_license
puts 'Input a number from 1 to 100 to see if it is a square.' input_number = gets.chomp.to_i square_array = [0,1,4,9,16,25,36,49,64,81,100] square_array.each do |num| if (num===input_number) puts "True" break end end
true
1a69c2074e50e51e6c75a65acbee4a12cc7c3b7a
Ruby
Kevin-K/metaprogramming-ruby-v2
/4_blocks/shared_scope.rb
UTF-8
310
3.125
3
[]
no_license
# two methods sharing the closure # "shared" is accesable in both counter and inc def define_methods shared = 0 Kernel.send :define_method, :counter do shared end Kernel.send :define_method, :inc do |x| shared += x end end define_methods counter #=> 0 inc(4) counter #=> 4
true
7486d241205b01e082d29c3d6c8da368cd12053c
Ruby
matthewquinn-accenture/tennis_kata
/spec/tennis_spec.rb
UTF-8
2,020
2.953125
3
[]
no_license
require_relative "../tennis" describe "Initial test" do it "true is true" do expect(true).to eq(true) end end describe "Tennis scoring game" do before(:each) do @tennis_game = Game.new end it "initial score displays love all" do expect(@tennis_game.score).to eq("love all") end it "Playe...
true
867fc754dab6b2d9903afeb891bfd766be309b0f
Ruby
lennhy/scraping-flatiron-code-along-v-000
/lib/course.rb
UTF-8
386
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Course attr_accessor :title, :description, :schedule @@all=[] def initialize @@all << self end def self.all @@all end # this is a class method because it is called directly on the class. We need this to manipulate the instances of the class def self.reset_all #resetting the array that ...
true
6296a75035ba69fc8ce3a2c05c6c877156be7adc
Ruby
logstash-plugins/logstash-input-file
/lib/filewatch/sincedb_value.rb
UTF-8
3,091
2.703125
3
[ "Apache-2.0" ]
permissive
# encoding: utf-8 module FileWatch # Tracks the position and expiry of the offset of a file-of-interest # NOTE: the `watched_file.bytes_read` and this `sincedb_value.position` can diverge # At any given moment IF the `watched_file.bytes_read` is greater than `sincedb_value.position` # then it is larger to acco...
true
dbe999a3ecece19698312ea62ff80baa3065fb3e
Ruby
meldefern/sdet10
/api_testing/postcodes_lab/postcodes.rb
UTF-8
2,144
2.90625
3
[]
no_license
require 'json' require 'httparty' module Postcodes class SinglePostcode include HTTParty base_uri 'http://api.postcodes.io/postcodes' def initialize(single_postcode_string) @get_single_postcode = self.class.get("/#{single_postcode_string}") end def get_single_postcode_headers @get_single_postcode....
true
82a8e8eb3789529937e212d187e4eaf775d6a052
Ruby
mrkn/railsdm2019_demo
/model_learner/plugin/out_learner.rb
UTF-8
1,911
2.578125
3
[]
no_license
require 'fluent/plugin/output' require 'fluent/config/error' require 'arrow' require 'arrow-pycall' require 'pycall' module ModelLearner python_dir = File.expand_path('../python', __FILE__) PyCall.sys.path.append(python_dir) @pymodule = PyCall.import_module('model_learner') def self.update_model(model_filena...
true
257f926cb2a69888abb4a281e9f6cede429af169
Ruby
mzikherman/tricle
/lib/tricle/aggregation.rb
UTF-8
914
2.90625
3
[ "MIT" ]
permissive
require 'active_support/concern' module Tricle module Aggregation extend ActiveSupport::Concern def days_ago(n) start_at = self.now.beginning_of_day.ago(n.days) end_at = start_at + 1.day self.size_for_range(start_at, end_at) end def yesterday self.days_ago(1) end de...
true
ecf1e3590c4365573e767d52d52c79de2c0bf1ff
Ruby
camfindlay/feijoa
/app/services/audited_operations_service.rb
UTF-8
2,931
2.75
3
[ "MIT" ]
permissive
# frozen_string_literal: true # A service which provides a wrapper around business logic which must be audited (record which user took the action) class AuditedOperationsService class ShareRevokedError < StandardError end class UnauthorisedAccessRequestError < StandardError end # constants for User/BirthRec...
true
43b75ec496ea5a6191ad75de66e4568116bdca72
Ruby
Matthewrbowker/school
/CS3300-Software Engineering 1/hw0/mbowker_part4.rb
UTF-8
1,492
3.96875
4
[]
no_license
#!/usr/bin/ruby =begin Define a class Car with setters and getters for make, model, and year - Implement self.num_cars_made, which returns the total number of cars ever instantiated - Implement self.most_popular_make, which returns the most instantiated car maker - Implement self.been_made?(car_make), which determines...
true
fdd9033c62b15a73fb7e01f7720888d51abceb49
Ruby
readyready15728/leetcode-ruby-solutions
/1512.rb
UTF-8
211
2.96875
3
[]
no_license
def num_identical_pairs(nums) ((0...nums.length).map do |i| (0...nums.length).map do |j| nums[i] == nums[j] and i < j end end).flatten.select { |boolean| boolean }.length end
true
7a19a80eb05dd882b286a1d7f5ae0f9d87a3fd90
Ruby
Turing-Repositories/parks_finder
/app/facades/park_facade.rb
UTF-8
242
2.8125
3
[]
no_license
class ParkFacade def self.find_park(state) state_park = get_park_data(state) state_park[:data].map do |park_data| Park.new(park_data) end end def self.get_park_data(state) ParksService.find_park(state) end end
true
f103b606cf671b77b00b34e819bd462a57cc0d7d
Ruby
vermakartik/gui-term
/lib/guit.rb
UTF-8
9,415
2.859375
3
[ "MIT" ]
permissive
# require 'terminfo' require 'io/console' require 'mathn' # require 'mini_mag' # require #TODO and ISSUES # arc function not working properly # printf("\e[?12l") # sync with stdout STDOUT.sync = true module Guit PI = 3.141592653589793238 STYLE_NORMAL = 0x1 STYLE_BOLD = 0x1 << 1 STYLE_ITALIC = 0x1 << 2 STYLE_...
true
5e8857ac79d3841f440dbeafb9055ca8f237fc4e
Ruby
nwise/advent-of-code-2019
/day_2.rb
UTF-8
1,418
3.671875
4
[]
no_license
input = %w(1 0 0 3 1 1 2 3 1 3 4 3 1 5 0 3 2 13 1 19 1 6 19 23 2 23 6 27 1 5 27 31 1 10 31 35 2 6 35 39 1 39 13 43 1 43 9 47 2 47 10 51 1 5 51 55 1 55 10 59 2 59 6 63 2 6 63 67 1 5 67 71 2 9 71 75 1 75 6 79 1 6 79 83 2 83 9 87 2 87 13 91 1 10 91 95 1 95 13 99 2 13 99 103 1 103 10 107 2 107 10 111 1 111 9 115 1 115 2...
true
26b55bdc51b9f542be2dcad3ad1726dd356312f7
Ruby
Jonesyd/launchschool_exercises
/small_problems/z105_tri-angles.rb
UTF-8
425
3.640625
4
[]
no_license
def triangle(a, b, c) ary = [a, b, c] return :invalid if ary.sum != 180 || ary.any? { |ang| ang <= 0 } return :right if ary.one? { |ang| ang == 90 } return :acute if ary.all? { |ang| ang < 90 } return :obtuse if ary.one? { |ang| ang > 90 } end p triangle(60, 70, 50) == :acute p triangle(30, 90, 60) == :right...
true
f6a0a616cf714f5434ff856c8c4162c0465d25bf
Ruby
prrn-pg/Shojin
/Practice/atcoder/ABC/046/src/b.rb
UTF-8
223
3.46875
3
[]
no_license
# なんか図書いてたら思いついた。託宣? # 最初はk種類からえらび、残りは(k-1)種類から選ぶ n, k = gets.chomp.split.map(&:to_i) ans = k (n-1).times do ans *= (k-1) end puts ans
true
127f0d649f1a34bee051d1c2afe887f88bf86e6f
Ruby
primary0/trade-at-hand
/lib/sms.rb
UTF-8
4,454
3
3
[]
no_license
class Sms attr_accessor :message, :command, :response, :valid def initialize(message) # Set variables first @commands = ["reg", "buy", "sell", "find"] @response = {} @message = message @valid = false # Setup words array @words = @message.split(" ") # Initial pr...
true
313353238392f0fa3d515103d3781bc46df8ac82
Ruby
ralfpinheiro/ar-exercises
/exercises/exercise_5.rb
UTF-8
425
2.828125
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' puts "Exercise 5" puts "----------" @stores_revenue = Store.sum(:annual_revenue) @average = Store.average(:annual_revenue) @over_million = Store.where('annual_rev...
true
64639bc91134dbbd225d543dced3c374f5da51ef
Ruby
chrismdp/party_resource
/lib/party_resource/request.rb
UTF-8
844
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module PartyResource class Request attr_reader :verb def initialize(verb, path, context, args, params) @verb = verb @path = path @args = args @context = context @params = params || {} end def path args = @context.parameter_values(path_params - @args.keys).merge(@ar...
true
3c235c3fb47e42d4bde70d3d50bc0141d6b3d42c
Ruby
valefranchi8/loop_project
/perform.rb
UTF-8
725
2.84375
3
[]
no_license
require "./delay_job.rb" require "./queue.rb" require "./jobs/job_instance.rb" def perform_now(arguments) job_instance = JobInstance.new(arguments) execute(job_instance) end def perform_later(arguments) job_instance = JobInstance.new(arguments) enqueue(job_instance) job_instance.object_id end de...
true
921200e3f6cd114bf2cd2326d0783a256c8c0ead
Ruby
gurkankir5501/RubyDenemeleri
/Boy-Kütle Endeksi.rb
UTF-8
574
3.265625
3
[]
no_license
#{Boy-Kütle Endeksi} print " Boyunuzu Giriniz : " boy = gets.chomp.to_i print " Kilonuzu Giriniz : " kilo = gets.chomp.to_i ortalama = kilo * 10000 / boy ** 2 if ortalama > 25 print " Boy-Kütle Endeksiniz : " puts ortalama puts " Zayıfsınız , Kilo Almalısınız " elsif ortalama < 20 ...
true
6dda6e839a60cccc21760df0c8a87eaf5945e81a
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/1df4def1513943f9b21f723e00e1a4fe.rb
UTF-8
300
3.40625
3
[]
no_license
class Phrase def initialize(phrase) @phrase = phrase end def word_count counts = words .group_by(&:downcase) .map{|word, words| [word, words.count]} Hash[counts] end # don't count apostrophe as punctuation def words @phrase.split(/[^A-Za-z0-9']+/) end end
true
e459fe1ac049790b54111a630ec00eec2f0c4ba5
Ruby
kazuph/rokuga
/lib/data_url.rb
UTF-8
709
3.078125
3
[]
no_license
require 'base64' class DataURL attr_reader :content_type def self.parse(uri) syntax = /^data:(?<content_type>[^;]+);(?<is_base64>base64,)(?<body>.*)$/ matched = uri.match syntax raise "not data URI" unless matched self.new matched[:content_type], !!matched[:is_base64], matched[:body] end def s...
true
f837b1a673f77435196a3fa07d4cae4e94f90417
Ruby
yokoyan/rspec_lessons
/lib/calc.rb
UTF-8
157
2.875
3
[]
no_license
class Calc def add(a, b) # 5 # 仮実装(テストコードの間違いがないかをまず確かめる) a + b # 明らかな実装 end end
true
9bddac98e1c354c559b6ca3308ba7ff2a54c7b71
Ruby
FengYue007/sinatra-demo
/hello.rb
UTF-8
198
2.53125
3
[]
no_license
require "sinatra" # 引用 sinatra 模組 get "/" do "Home!" # "你好,世界,現在是 #{Time.now}" end get "/hello" do "go to hello world" end get '/about.php' do "This is php" end
true
edf3a11eab4ebc0548d094cdeaa4e2035b4ef3be
Ruby
ChaseAmy/ruby-challenges
/always_three.rb
UTF-8
186
3.328125
3
[]
no_license
def always_three(get_num) (((((get_num + 5) * 2) - 4) / 2) - get_num) end puts "Quick, give me a number!" get_num = gets.to_i puts "Always " + always_three(get_num).to_s
true
f35fbc9ba88eb976c96d084a12e1514e3db3057a
Ruby
cpm/http_authentication
/lib/http_authentication/digest.rb
UTF-8
7,441
2.5625
3
[ "MIT" ]
permissive
module HttpAuthentication module Digest extend self module ControllerMethods def authenticate_or_request_with_http_digest(realm = "Application", &password_procedure) authenticate_with_http_digest(realm, &password_procedure) || request_http_digest_authentication(realm) end # Authent...
true
d67d2bb0434b319243b5558daffe66521eaed5cf
Ruby
liahhansen/design_patterns
/homework/danS/composite/dirItem.rb
UTF-8
211
3.0625
3
[]
no_license
class DirItem attr_accessor :dirItems def initialize(dirItems=[]) @dirItems = dirItems end def addItem(item) @dirItems << item end def removeItem(item) @dirItems.delete(item) end end
true
ef8355925deb7512cbb42827f47499928e641df5
Ruby
ticho/scrapping_noko
/trader_de_lobscur.rb
UTF-8
521
3
3
[]
no_license
require 'nokogiri' require 'open-uri' require 'pry' def find_all_currencies coin_list_url = "https://coinmarketcap.com/all/views/all/" page = Nokogiri::HTML(open(coin_list_url)) # binding.pry currencies = [] page.css('table#currencies-all tbody tr').each do |x| name = x.css('td.currency-name')[0]['data-s...
true
b965b6656e844c384a0991f230b2f3deb0fc5aa5
Ruby
itggot-Filip-Rakic/storprojekt20
/model.rb
UTF-8
7,024
3.15625
3
[]
no_license
module Model require "sqlite3" require "bcrypt" require 'net/http' require 'byebug' # # Connects to the database # # @return [Hash] Returns the database as a hash # def db() db = SQLite3::Database.new("db/database.db") db.results_as_hash = true return...
true
468ec2e6ae91b12c438b7fd2f7dc5e8d3c285842
Ruby
rcjara/project-euler
/30-Problem/ruby/solve.rb
UTF-8
263
3.6875
4
[]
no_license
max = (9 ** 5) * 10 def sum_pow_of_digits(num, pow = 5) num.to_s.each_char.inject(0) {|s, ch| ch.to_i ** 5 + s } end nums = (10..max).select do |num| sum_pow_of_digits(num) == num end ans = nums.inject(0){|s, n| s + n } puts "#{ans} (#{nums.join(", ")})"
true
2e0d38efa88b94c484dfbf0f266b99c87f35ab2b
Ruby
gchan/advent-of-code-ruby
/2019/day-03/day-03-part-1.rb
UTF-8
627
3.65625
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'set' file_path = File.expand_path("../day-03-input.txt", __FILE__) input = File.read(file_path) def walk(path) visited = Set.new x, y = 0, 0 path.split(",").each do |instr| dir = instr[0] steps = instr[1..].to_i steps.times do case dir when "U" ...
true
3d6c6dc614d9bfad3a00e91bd4bdac5f72e76e10
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/crypto-square/9cb4d12add1b49189bd58d064b14ed09.rb
UTF-8
787
3.21875
3
[]
no_license
class Crypto attr_reader :plaintext, :normalized def initialize(plaintext) @plaintext = plaintext @normalized = normalize_plaintext end def normalize_plaintext plaintext.downcase.gsub(/[^a-z0-9]/,'') end def size sq = Math.sqrt(normalized.size).to_i (sq**2 == normalized.size) ? sq : sq...
true
e897d00dc548e60834dc5c4ded53d0eaa73e3e67
Ruby
collabnix/dockerlabs
/vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/lib/ethon/easy/form.rb
UTF-8
3,448
2.71875
3
[ "MIT", "Apache-2.0" ]
permissive
# frozen_string_literal: true require 'ethon/easy/util' require 'ethon/easy/queryable' module Ethon class Easy # This class represents a form and is used to send a payload in the # request body via POST/PUT. # It handles multipart forms, too. # # @api private class Form include Ethon::...
true
4c59d23b3e244bdf41e096dd576c301232ebb931
Ruby
bryfox/RealPhysicians
/lib/time.rb
UTF-8
632
3.1875
3
[]
no_license
# class DateTime # def self.random from = DateTime., to = DateTime.now # DateTime.at(from + rand * (to.to_time.to_f - from.to_time.to_f)) # end # end class Time def to_datetime # Convert seconds + microseconds into a fractional number of seconds seconds = sec + Rational(usec, 10**6) # Convert a...
true
05f349970f5616cb208124341db55c204f2e4a61
Ruby
larrychen04/robot2
/spec/command_spec.rb
UTF-8
1,523
3.078125
3
[]
no_license
require "command" describe Command do it "Area can not be nil" do expect(Command.new().validateArea(nil)).to eq(false) end it "Area can not be larger than 5" do expect(Command.new().validateArea(6)).to eq(false) end it "Area can not be less than 0" do expect(Command.new().validateArea(-1)).to eq(false) en...
true
80e61f140e7a5d932357be13634e716beb310f9e
Ruby
AvraamMavridis/ruby-exercises
/strongest_tree/strongest_tree.rb
UTF-8
395
3.28125
3
[]
no_license
class Node attr_accessor :r_node, :l_node def initialize(r_node = nil, l_node = nil) self.r_node = r_node self.l_node = l_node end def height if(self.r_node === nil and self.l_node === nil) return 0 else rNode = self.r_node ? self.r_node.height : 0 lNode = self.l_node ? sel...
true
570257fb9439a38783ccf18413cdb00bc7dbef6a
Ruby
ioreka/school-domain-london-web-060418
/lib/school.rb
UTF-8
430
3.640625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# code here! class School attr_accessor :roster def initialize(roster) @roster = {} end def add_student(name, grade) if @roster.include?(grade) @roster[grade] << name else @roster[grade] = [name] end end def grade(grade) @roster[grade] end def sort school_hash = ...
true
aefbf113d5eba85e893b43e37a28bdbffeb5df9e
Ruby
thebravoman/software_engineering_2013
/class14_homework/Danail_Stoianov.rb
UTF-8
1,182
3.390625
3
[]
no_license
require_relative "drawer" require 'csv' class ChartDrawer def initialize d @drawer = d end def columns_chart data draw_columns data draw_legend data draw_graph data end private def loop_months data months = data[0].length - 1 colors = ["black", "red", "green", "orange"] months.times do |n| ...
true
73a5c354773f9a6131fd23e076a71ba757e112eb
Ruby
TheOdinProject/theodinproject
/app/services/courses/mark_completed_lessons.rb
UTF-8
545
2.6875
3
[ "MIT" ]
permissive
module Courses class MarkCompletedLessons def initialize(user:, lessons:) @user = user @lessons = lessons end def self.call(user:, lessons:) new(user:, lessons:).call end def call lessons.each do |lesson| next if completed_lesson_ids.exclude?(lesson.id) l...
true
86c58b85a0cd4621e6eec0b1da7f3484ad616c8c
Ruby
agdsarge/programming-univbasics-nds-nds-to-insight-understand-lab-wdc01-seng-ft-042020
/lib/nds_explore.rb
UTF-8
752
3.0625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'directors_database' # Call the method directors_database to retrieve the NDS require 'pp' directors_database ddb = directors_database def pretty_print_nds(nds) # Change the code below to pretty print the nds with pp pp nds end def print_first_directors_movie_ti...
true
20a00d23eaafae23b63cbd662f5c03c7b637fdce
Ruby
alnorx/countdown-to-midnight-online-web-prework
/countdown.rb
UTF-8
287
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#write your code here def countdown(number) counter=0 while counter<number puts"#{number} SECOND(S)!" number-=1 end "HAPPY NEW YEAR!" end def countdown_with_sleep(number) counter=0 while counter<number puts"#{number} SECOND(S)!" number-=1 sleep number end "HAPPY NEW YEAR!" end
true
d2df985ec388e5a6bb65eb4ef1212749043f3aa8
Ruby
pbaker2018/Codewar_Katas
/Level_8_katas/sum_without_highest_and_lowest_number.rb
UTF-8
603
4.21875
4
[]
no_license
# QUESTION # Sum all the numbers of the array, except the highest and the lowest element. # The highest/lowest element is respectively only one element at each edge, # even if there are more than one with the same value! # # Example: # # { 6, 2, 1, 8, 10 } => 16 # { 1, 1, 11, 2, 3 } => 6 # # If array is empty, null or ...
true
0796580b17d45289418250ecde7ccf33d430bf3f
Ruby
alsummers/ruby_elements_library
/objectMethods.rb
UTF-8
410
3.46875
3
[]
no_license
class Student attr_accessor :name, :favClass, :gpa def initialize(name, favClass, gpa) @name = name @major = major @gpa = gpa end def has_honors if @gpa >= 3.5 return true end return false end end student1 = Student.new("Jessica", "Biolog...
true
ea7fab8be47a0fc28561b159fa6d7d34614553b6
Ruby
device-independent/hue-client
/lib/hue/client/models/configuration.rb
UTF-8
4,636
2.609375
3
[ "MIT" ]
permissive
require File.expand_path('../portal_state', __FILE__) require File.expand_path('../software_update', __FILE__) require File.expand_path('../whitelist_users', __FILE__) module Hue module Client module Models class Configuration # Creates an instance of the Configuration object # # @r...
true
93f9dfd0a17f89d6a9568fe4bbde23075812d896
Ruby
sbcn7/atcoder-by-ruby
/abc038/A.rb
UTF-8
87
3.0625
3
[]
no_license
# http://abc038.contest.atcoder.jp/tasks/abc038_a puts gets[-2] == 'T' ? 'YES' : 'NO'
true
6c0bf71b8f6f4096f952f87d13010c119ed5c32f
Ruby
edraut/clark-kent
/app/models/clark_kent/report_result.rb
UTF-8
859
2.59375
3
[ "MIT" ]
permissive
module ClarkKent class ReportResult include Enumerable def initialize(arel_query, params) @arel_query = arel_query @params = params end def paginated_query if @params.has_key? :page and @params.has_key? :per page = @params[:page] || 1 @arel_query.offset((page.to_i - 1) * @params[:per]).limit...
true
30211209717fad504649296dabf3c3a59ddc5f8c
Ruby
jnraine/munkiserver
/app/models/auto_package.rb
UTF-8
5,160
3.0625
3
[]
no_license
# Auto package takes a file (in the form of a URL or path) and determines if it can automatically package it # and add it to the munki server. # # Cases covered: # => URL to .dmg files # => URL to .zip files # => Firefox download redirect page # # Cases that need to be accounted for: # => Source forge download redire...
true
e7a737e4c24f335820ce261ce8e063a4ca7d4695
Ruby
gabigavric/doctors_patient
/spec/doctor_spec.rb
UTF-8
2,461
2.6875
3
[]
no_license
require('rspec') require('pg') require('doctor') require('spec_helper') DB = PG.connect({:dbname=> 'admin_database_test'}) RSpec.configure do |config| config.after(:each) do DB.exec("DELETE FROM doctors *;") end end describe(Doctor) do describe(".all") do it("is empty at first") do expect(Do...
true
7feb1cd71663ef5d403eeb99655fd61cd29a9398
Ruby
ludwiggj/ruby-pickaxe
/ch04-containers-blocks-iterators/blocks/block_parameter_lists.rb
UTF-8
414
3.734375
4
[]
no_license
proc1 = lambda do |a, *b, &block| puts "a = #{a.inspect}" # => 1 puts "b = #{b.inspect}" # => [2, 3, 4] block.call # => in block 1 end proc1.call(1, 2, 3, 4) { puts "in block1" } # Terse lamba syntax proc2 = -> a, *b, &block do puts "a = #{a.inspect}" # => 1 puts "b = #{b.inspect}" # => [2, 3, ...
true
5f3892a5f544d4ccd820332677b3c71ac0f35a91
Ruby
michelegozzi/Tweet2Rabbit
/main.rb
UTF-8
293
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require_relative 'TweetFetcher' fetcher = TweetFetcher.new collection = fetcher.fetch("mrgomez77") collection.each do |tweet| puts "Twitter: #{tweet.text}" puts "Url: #{tweet.uri}" puts "Source: #{tweet.source}" puts "Retweets: #{tweet.retweet_count}" end
true
3216628ac75de16dd052e3eecf0cb8651a9477a0
Ruby
tseiiti/ruby_diversos
/Dcoder Medium/19m. The ^_^ -_- Strings.rb
UTF-8
945
3.890625
4
[ "MIT" ]
permissive
#ruby 1.9.3 inp = gets.chomp a = 0 b = 0 inp.length.times do |j| a += 1 if inp[j..j + 2] == '^_^' b += 1 if inp[j..j + 2] == '-_-' end if a > b puts 'Cody is happy with Dcoder' elsif a < b puts 'Cody wants to leave job' else puts "Cody doesn't know what to do" end =begin Title: The ^_^ -_- String Problem: Cod...
true
524d80b8cad565e77351ec4a81848e47ad5de95d
Ruby
cruzgerman216/ruby-collaborating-objects-lab-onl01-seng-pt-030220
/lib/song.rb
UTF-8
435
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :artist, :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def self.new_by_filename(file) arr = file.split(" - ") song = self.new(arr[1]) song.artist = Artist.new(arr[0]) song end def self.find(para) sel...
true
acf6ee3219864340579a78d18a1184b4bb6cc9ac
Ruby
hopsoft/field_mapper
/test/standard/field_test.rb
UTF-8
5,076
2.703125
3
[ "MIT" ]
permissive
require_relative "../test_helper" require_relative "plat_example" module Standard class FieldTest < PryTest::Test test "constructor requires type" do begin FieldMapper::Standard::Field.new(:foo) rescue FieldMapper::TypeNotSpecified => e error = e end assert error.present?...
true
8e2d94949c1d86e9c084327a89e72044a462ee0c
Ruby
vicentemundim/tagmar_web_character_generator
/app/models/rules/physical_energy.rb
UTF-8
2,352
2.828125
3
[]
no_license
class Rules::PhysicalEnergy class << self def physical_energy_for(weight, strength, physical) strength_physical_sum = strength + physical weight_range = WEIGHT_RANGES.select { |range| range.include?(weight) }.first strength_plus_physical_range = STRENGTH_PLUS_PHYSICAL_RANGES.select { |range| ran...
true
a18512f87974b20d14f6c786ce4d64e8e68362f1
Ruby
UKGovernmentBEIS/beis-report-official-development-assistance
/spec/services/convert_financial_value_spec.rb
UTF-8
1,476
2.890625
3
[ "MIT" ]
permissive
require "rails_helper" RSpec.describe ConvertFinancialValue do let(:converter) { ConvertFinancialValue.new } it "converts zero" do expect(converter.convert("0")).to eq(BigDecimal("0")) end it "converts an integer" do expect(converter.convert("42")).to eq(BigDecimal("42")) end it "converts a frac...
true
f468b9341122df538c29f22ec1a4e0f80f901ae6
Ruby
alexandreruban/my_factory_girl
/spec/proxy_spec.rb
UTF-8
3,010
2.578125
3
[]
no_license
require "spec_helper" RSpec.describe FactoryGirl::Proxy do context "a proxy" do before do @proxy = FactoryGirl::Proxy.new(Class.new) end it "does nothing when asked to set an attribute to a value" do expect(@proxy.set(:name, "a name")).to be_nil end it "returns nil when asked for an...
true
8c20d45182534c94c0fe8d168579aca6ffad3a17
Ruby
zaki/codejam
/2010/Qualification/problem3.rb
UTF-8
1,559
2.890625
3
[]
no_license
class Array def sum(s=0,e=self.length-1) self[s..e].inject(0) {|sm,i| sm+i} end end def ride(r,k,groups) rides = 0 period = [] lookup = {} queue = groups.dup i = 0 while (lookup[queue].nil? || i > r) next_queue = [] i += 1 key = queue.dup cr = 0 ...
true
074c274bf9468ea3f6cb4180c843d17dbe1ecd13
Ruby
marciofva/Ruby_PropertyFinder
/features/pages/result_search_page.rb
UTF-8
1,902
2.78125
3
[]
no_license
class ResultSearchPage < SitePrism::Page #List of Titles elements :title_list, 'h2 a' #List of Prices elements :price_list, '.price ' #Total Result element :total_result, '.list-count' #SortBy dropdown element :sortby_dropdown, 'div.ms-parent:nth-child(3) > button:nth-child(1)' elements :sortby_li...
true
dc2638317b7656fc932976ab6f34238351bdf510
Ruby
Publicover/exercism.io-exercises
/grains/grains.rb
UTF-8
367
3.59375
4
[]
no_license
# exercism grains class Grains def self.square(number) full_count = 2 raise ArgumentError if number < 1 || number > 64 return number if number == 1 || number == 2 (number - 2).times do full_count *= 2 end full_count end def self.total total_squares = 64 (1..total_squares).in...
true
6d795ad620ed6afc6784ae94669a0390158b345a
Ruby
VarvaraBabkova/ruby-inheritance-lab-houston-web-062419
/lib/student.rb
UTF-8
145
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Student < User attr_accessor :knowledge def initialize @knowledge = [] end def learn (subj) @knowledge << subj end end
true
34dc108cf24728d831cd73401b81966cf7654a86
Ruby
jadin-press/aa-classwork
/w1d4/perilous_procs/phase_3/proc_suffix.rb
UTF-8
1,458
4
4
[]
no_license
# Write a method proc_suffix that accepts a sentence and a hash as arguments. # The hash contains procs as keys and suffix strings as values. The method # should return a new sentence where each word of the original sentence is # appended with a suffix if the original word returns true when given to the # correspon...
true
462185929e02917bc40badb9598f0fec8205396e
Ruby
selfup/mod2-individual-work
/LRTHW/jex33h.rb
UTF-8
958
4.28125
4
[]
no_license
# THINGS are about to get strange... empty = [] puts "Guess a number between 1 and 200"; puts " " puts "I will give you three chances!"; puts " " print "First pick: "; i1 = gets.chomp.to_i; puts " " print "Second pick: "; i2 = gets.chomp.to_i; puts " " print "Third pick: "; i3 = gets.chomp.to_i; puts " " (50..70).eac...
true
162bb7103faa99009fc8235da7021f56461569b4
Ruby
Maxih/classwork
/W2D3/spec/tdd_spec.rb
UTF-8
1,483
3.484375
3
[]
no_license
require 'tdd' require 'rspec' describe Array do describe "#my_uniq" do let(:array1) { [1, 2, 3, 2, 5, -1, 5] } let(:array2) { [6, 2, 7, 1, 2, 6, 8] } it "filters duplicate values" do expect(array1.my_uniq).to eq([1, 2, 3, 5, -1]) expect(array2.my_uniq).to eq([6, 2, 7, 1, 8]) end i...
true
2b45b13b86dd97ea192af4f72f93bf56f5cf47f9
Ruby
Kite0301/movie_review
/app/models/movie.rb
UTF-8
367
2.671875
3
[]
no_license
class Movie < ApplicationRecord has_many :reviews has_many :movies_categories has_many :categories, through: :movies_categories def average_point reviews = self.reviews return if reviews.blank? total_point = 0 reviews.each do |review| total_point += review.point end return (total_...
true
cc3a0722422fc0caddbaeefb3be1bc9e85ff458b
Ruby
mark-himel/fleet-of-vehicles-and-customers
/app/services/csv_importer_exporter.rb
UTF-8
2,091
2.984375
3
[]
no_license
class CsvImporterExporter attr_accessor :file, :export_type def initialize(file=nil, export_type=nil) @file = file @export_type = export_type end def self.import(file) new(file).import end def self.generate_csv(export_type) new(nil, export_type).generate_csv end def import spread...
true
e5ffd93e0d3869cc2308704896459dd66ffd83f8
Ruby
SergejOvsiannikov/shakuro_test_project
/lib/exceptions/book.rb
UTF-8
183
2.515625
3
[]
no_license
module Exceptions module Book class InStockLimitExeeded < StandardError def message 'You want to sell more book than we have in stock' end end end end
true
02d68bfadcef369a9c2add18b2619c0705d24be1
Ruby
tophertoy/broken_window
/app/services/broken_window/status_checker.rb
UTF-8
955
2.859375
3
[ "MIT" ]
permissive
module BrokenWindow class StatusChecker class << self def check_status(metric, measurement = nil) measurement ||= metric.latest_measurement if measurement if value_passes_threshold?(measurement.value, metric.threshold, metric.threshold_type) BrokenWindow::MetricStatus.p...
true
6ab169d8c6723366a5ca3c1624481b26818a2a99
Ruby
cjsweeten101/OdinProjects
/tic_tac_toe/lib/game.rb
UTF-8
1,728
4.09375
4
[]
no_license
class Game require_relative 'board' require_relative 'player' def initialize @board = Board.new puts "Player 1," @player1 = Player.new(get_player, 'X') puts "Player 2," @player2 = Player.new(get_player, 'O') game_loop end def get_player puts "What's your name?" while name = gets.chom...
true
6682476ac401d930bb6643ee933243f5d6d4f0aa
Ruby
Itsindigo/takeaway-challenge
/spec/order_spec.rb
UTF-8
903
2.71875
3
[]
no_license
require 'order' describe Order do let(:menu_klass) {double :menu_klass} let(:menu) {double :menu} subject(:order) {described_class.new} before do allow(menu).to receive(:new) allow(menu).to receive(:duplicate_menu).and_return :item_1 => 2, :item_2 => 2 subject.select_meal(:item_1) subject.se...
true
90011904f1097f5cec5cad37567e8f4e4096b296
Ruby
mobi/resque_background_job_logger
/test/worker_with_status_test.rb
UTF-8
1,549
2.59375
3
[ "MIT" ]
permissive
require 'test_helper' # The standard interface for workers with status is to use # WorkerClass.create instead of Resque.enqueue and pass in # a hash for arguments. The arguments provided through the job # is an array. First element is a UUID, second is the hash # of arguments passed to the worker class WorkerWithStatu...
true
b8595e7c93bb8d188495ff739d896c8a1959e942
Ruby
ccline24/collections_practice-onl01-seng-pt-012120
/collections_practice.rb
UTF-8
669
3.375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def sort_array_asc(array) array.sort end def sort_array_desc(array) array.sort do |a,b| b <=> a end end def sort_array_char_count(array) array.sort do |a,b| a.length <=> b.length end end def swap_elements(array) array[1], array[2] = array[2], array[1] array end def reverse_array(array) array.rev...
true
135f19f112c72e1ddcc3a7d21c7d838d1557e3c4
Ruby
wharah/214
/projects/04/ruby/script.ruby
UTF-8
927
3.515625
4
[]
no_license
Script started on Tue 26 Feb 2019 10:30:43 PM EST smw42@gold10:~/CS214/projects/04$ cat factorial.rb #! /usr/bin/ruby # factorial.rb gives the factorial of an integer n # Author: Sarah Whitten # Date: February 26, 2019 ################################################################ # Input: n, an integer # O...
true