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
a0554650d2d3e393cf8d18035a1c43b966ecab21
Ruby
hdkcoder/Tic-Tac-Toe
/game.rb
UTF-8
1,222
3.96875
4
[]
no_license
require './board' #appel la classe grille require './player' # appel la classe joueur class Game def initialize # initialisation @board = Board.new # Initialisation Grille @player = Array.new # Initialisation array @player << Player.new << Player.new # rempli cases array @turn_idx = 0 puts...
true
53664a6dd8d9d8ad1e92676c24346f8ef38d14db
Ruby
maximmaxim/shop
/app/models/user.rb
UTF-8
1,296
2.828125
3
[]
no_license
require 'digest/sha1' class User < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name validates_presence_of :mail validates_uniqueness_of :mail validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :message => "Почтовый ящик не существует" attr_accessor :passwor...
true
3890e0c2b940ff4831c5cec3e82c3f779766b0a9
Ruby
AlysaB/banana-central
/app/models/sample_model.rb
UTF-8
3,827
3.359375
3
[]
no_license
# back end ruby code class Animals def initialize(params) @params = params @animals = { :aquatic => 0, :desert => 0, :farm_domestic => 0, :savannah => 0, :rainforest => 0, :forest => 0 } end # question 1 results def q1 if @params[:place] == "Central Americ...
true
0ee403076efa8367f002d57eb44ffd68be436070
Ruby
nateie/skyscraper
/app/models/scraper.rb
UTF-8
474
3.125
3
[]
no_license
class Scraper def self.scrape response = HTTParty.get('http://www.brainyquote.com/quotes/authors/t/taylor_swift.html') doc = Nokogiri::HTML(response.body) quotes = [] # Print out each link using a CSS selector doc.css('.bqQuoteLink a').each do |data| quotes << data.content # dumps to screen ...
true
c8e30d4b83bcdec118ac5a866996e27b42cf6586
Ruby
jacknguyen/squid
/manual/squid/basic.rb
UTF-8
319
2.546875
3
[ "MIT" ]
permissive
# Creating graphs with Squid is easy. Just use the <code>chart</code> method. # # The most simple graph can be created by providing only a hash containing # the data of the series you want to plot. # filename = File.basename(__FILE__).gsub('.rb', '.pdf') Prawn::ManualBuilder::Example.generate(filename) do chart end
true
e92be7b9bd9d5ac7d3e735673e80a4cd8267bb74
Ruby
marceloboeira/prezzo
/spec/models/uber/calculators/base_fare.rb
UTF-8
430
2.765625
3
[ "MIT" ]
permissive
module Uber module Calculators class BaseFare include Prezzo::Calculator PRICE_PER_CATEGORY = { "UberX" => 4.0, "UberXL" => 6.0, "UberBLACK" => 8.0, }.freeze def calculate price_for(category) || 0 end def category context.fetch(:catego...
true
f52243e11d38effb1060f662dd166edd777ef0d8
Ruby
mvilrokx/BPAD
/lib/tasks/upload_usecases.rake
UTF-8
1,056
2.5625
3
[]
no_license
desc "Upload Use Cases CSV" task :upload_usecases, [:arg1] => :environment do |t, args| use_cases_file = args.arg1 || "useCasesFile.csv" open(use_cases_file) do |use_cases| puts "\nLoading Use Cases from file " + use_cases_file use_cases.read.each_line do |use_case| if !use_case.blank? busin...
true
10a8c93a764a7e7b5ebbdd7c244198871b1e8bea
Ruby
bliscprojects/ArchivesSpace
/Existing/gems/gems/rrtf-1.3.0/lib/rrtf/node/node.rb
UTF-8
1,602
3.515625
4
[ "LicenseRef-scancode-generic-cla", "ECL-2.0", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
module RRTF # This class represents an element within an RTF document. The class provides # a base class for more specific node types. class Node # Node parent. attr_accessor :parent # Constructor for the Node class. # # ==== Parameters # parent:: A reference to the Node that owns ...
true
fdcd72916b89eab9ce7d4de4e8511cac421c088b
Ruby
Hami5h/week_2_day_2_homework
/river.rb
UTF-8
333
3.5625
4
[]
no_license
class River attr_accessor :fish def initialize(name) @name = name @fish = [] end def river_name return @name end def amount_of_fish return @fish.count end def add_fish_to_river(fish) @fish << fish end def remove_fish_from_river(fish) @fish.delete(fish) amount_of_fis...
true
44ef21ff1490d3efcfadfc2c76d64b66daa70658
Ruby
JeremyVe/prep_ruby_challenges
/power.rb
UTF-8
549
4.1875
4
[]
no_license
def power(base, exponent) result = 1 if (base.is_a? Integer) && (exponent.is_a? Integer) exponent.times do result = result * base end puts "the power of #{base} raised to #{exponent} is #{result} i guess" puts "" else puts "we need integers please!" puts "" end end while true puts "calculate the p...
true
0df6bb8248dac6a0d8465031ccf4ebd75b43bc7f
Ruby
carolinedug/kwk-l1-dance-instructions-kwk-students-l1-dfw-070918
/dance_instructions.rb
UTF-8
1,282
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starting_stance puts "Plant legs far apart, bend knees slightly and keep posture loose" end def base_footwork puts "Lift right foot" puts "Return right foot to the ground" puts "Finishing with a small skip-step backward" end left = "left" def skip_step(left) puts "Lower #{left} foot to the ground" puts "Bounce #{...
true
39f7e0294372b1d478302c633039be7c60b12d22
Ruby
elizabrock/nss-linked-list-implementation
/lib/linked_list_item.rb
UTF-8
392
2.9375
3
[]
no_license
class LinkedListItem attr_reader :next_list_item # attr_reader :payload attr_accessor :payload def initialize( payload ) @payload = payload end def next_list_item= (linked_list_item) raise ArgumentError, "list item cannot be its own next list item" if self == linked_list_item @next_list_item =...
true
b39d856e60a010a2bf755122d43741f4124028bf
Ruby
scottzec/betsy
/test/models/order_test.rb
UTF-8
12,774
2.71875
3
[]
no_license
require "test_helper" describe Order do let(:new_order) { Order.new(status: 'paid', name: "buyer", email: "buyer@email.com", address: "123 Ada Court", credit_card_number: '123456789', cvv: '123', expiration_date: '2/21', total: 20) } it "can be instantiated" do # Assert expect(new_order.valid?).must...
true
4c9b21b2b8b262e5dc925149a3357607ac9d82ab
Ruby
maggiflux/desafio_opcional
/opcional.rb
UTF-8
594
3.359375
3
[]
no_license
#EJERCICIO 4 class Texto attr_accessor :contenido def initialize(contenido) @contenido = contenido end def remplazar_vocales_por(letra_nueva) @contenido.gsub(/[aeiou]/, letra_nueva) end end contenido = Texto.new('Margarita, está linda la mar, y el viento ...
true
0ae46a946e37c56cb81154c504000506048be5d6
Ruby
rabiosman/EstudosRuby
/hangman_game/hangman.rb
UTF-8
2,358
3.328125
3
[]
no_license
require_relative 'ui' require_relative 'ranking' def chooseSecretWord warningChoosingWord text = File.read("dictionary.txt") allWords = text.split "\n" chosenNumber = rand(allWords.size) secretWord = allWords[chosenNumber].downcase warningChosenWord secretWord end def chooseSecretWordWithLessMe...
true
e7d067ceb770bf80f875a1118282379fe9007df9
Ruby
arao99/zenn_scraping
/3rd_article/next_previous2_nokogiri.rb
UTF-8
517
2.765625
3
[]
no_license
require 'nokogiri' html = open('nokogiri_practice.html').read doc = Nokogiri::HTML.parse(html) tr = doc.at_css('tr') pp tr.children # テーブルのヘッダー行の子要素を確認 center_th = tr.at_css('th:nth-of-type(2)') pp center_th # テーブルのヘッダー行の真ん中のセル(通常攻撃魔法) pp center_th.next_element # 次のセル(大魔法) pp center_th.next_sibling # ??? pp center_...
true
0df6ef14117ab6e80e8dbff43ba7ae3a723b7147
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/e3293e6694734af292a23b483130c119.rb
UTF-8
437
3.6875
4
[]
no_license
class Phrase attr_reader :words def initialize(text) @words = Words.new(text.downcase) end def word_count Hash.new(0).tap do |count| words.each { |word| count[word] += 1 } end end end class Words include Enumerable attr_reader :text def initialize(text) @text = text end d...
true
2d7ab939862dcaa4ab1fcf4d4793eaa1e98a9123
Ruby
jofrumki/ruby_practice
/HW_Ruby_1.4/level_3/add_em_up.rb
UTF-8
375
3.46875
3
[]
no_license
=begin Created by: Joshua Frumkin File: add_em_up.rb Date: July 3 2016 Purpose: Asks the user for a number and will provide the total when 'sone' has been entered =end puts "Enter a number:" num = gets.chomp tot = 0 while num != "done" num = Float(num) tot += num puts "Enter a number:" ...
true
c17a0e71b0ffde72d8b2501392a6035796f42264
Ruby
mwagner19446/wdi_work
/w02/d02/Jenn_Dodd/main.rb
UTF-8
2,518
4.0625
4
[]
no_license
require_relative 'happitails_classes' require_relative 'seeds' ################# #### Menu Method ################# def menu puts puts "Choose an option:" puts " 1. Add an animal" puts " 2. Add a client" puts " 3. Create a shelter" puts " 4. List all of the pets for adoption" puts " 5. List all...
true
4884f3f40ec578f476ed7aafae0dffe1ee6cc656
Ruby
copypastel/github_hook_server
/vendor/simplemail-0.3/examples/contact.rbx
UTF-8
937
2.734375
3
[]
no_license
#!/usr/local/bin/ruby # # Send a message # $Id: contact.rbx,v 1.1 2003/07/27 10:06:16 nigelb Exp $ # $Author: nigelb $ # # This is a simple example of using simplemail to send an email resulting from # a typical web contact form. # # Extract details and send confirmation email # Send message to recipient require 'cg...
true
45d67a2018276745008157b4f363c9ada76070f1
Ruby
jeremychan/leetcode_ruby
/lib/303_range_sum_query_immutable.rb
UTF-8
517
3.796875
4
[]
no_license
class NumArray # Initialize your data structure here. # @param {Integer[]} nums def initialize(nums) @nums = nums @cache = Hash.new(0) (0...nums.length).each { |j| @cache[j] = @cache[j-1] + nums[j] } end # @param {Integer} i # @param {Integer} j # @return {Integer} def sum_range(...
true
095d155eec238075a837ec75fae530f01bc94143
Ruby
marcel12bell/simple-live-coding
/main/string_object.rb
UTF-8
3,478
3.390625
3
[ "MIT" ]
permissive
class StringObject #Each line is an object include Processing::Proxy attr_accessor :content, :position def initialize(s) @content = s end def append(key) @content += key.to_s end def delete #last Char @content.chop! end def methode @content.split.to_a[0] end def update_para...
true
93460e5491741b4a292ac17da4c9ebf11d780f6c
Ruby
jmb521/regex-lab-v-000
/lib/regex_lab.rb
UTF-8
655
3.265625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) value = word.scan(/^[aeiouAEIOU]/) if value.length > 0 return true else false end end def words_starting_with_un_and_ending_with_ing(text) x = text.scan(/un\w+ing/) return x end def words_five_letters_long(text) words = text.scan(/\b\w{5}\b/) return words end def ...
true
70efb89ecfc7409ea7f86486aa19d4865677daf1
Ruby
jacooobi/university_projects
/Algorytmy i Struktury Danych/Trees/avl_report.rb
UTF-8
1,068
3.078125
3
[]
no_license
require 'benchmark' require_relative 'Trees/avl.rb' samples = [5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000] round_result = 2 samples.each do |n| define_method("reversed_array_#{n}") do (10...n).to_a.reverse end end def write_to_file(path, result, val) output = File.open(path, 'a') ...
true
7904392ec5f082b9e63f3c5b6267e72eed74c7f0
Ruby
amellors/gamenight
/app/helpers/nights_helper.rb
UTF-8
285
2.671875
3
[ "MIT" ]
permissive
module NightsHelper def finishedCount tempCount = 0 @night.gameplays.each do |gp| tempCount += 1 if gp.finished end end def resetGameplayCounter @count = 1 end def gameplayCount @count end def incGameplayCount @count += 1 end end
true
20d8ca2956a0fa326a7cf0a73a3d2e77232fe43c
Ruby
nieve/mars_rover
/spec/rover_obstacle_detection_spec.rb
UTF-8
529
2.515625
3
[]
no_license
require "spec_helper" describe "Rover" do describe "obstacle detection" do it "should raise an error when hitting an obstacle" do @rover = Rover.new 5,5,:n,10,10, [{x: 5, y: 6}] expect{@rover.send('F')}.to raise_error ObstacleException end it "should stop at the position before the obstacle" ...
true
38189340eb6d9ad368114dbdb1eaaa9b5f986ee0
Ruby
codemilan/old_stuff
/sbs2/ruby_ext/lib/ruby_ext/core/hash.rb
UTF-8
1,680
2.765625
3
[ "MIT" ]
permissive
Hash.class_eval do def subset *keys, &block keys = keys.first if keys.first.is_a? Array h = {} if keys self.each do |k, v| h[k] = v if keys.include? k end else self.each do |k, v| h[k] = v if block.call k end end h end def validate_options! *valid_o...
true
e2038a7daf2c8418d48e2bf2baa42a32d04c17aa
Ruby
alexkurowski/ruby-rogue
/src/world/fov.rb
UTF-8
7,896
2.8125
3
[ "MIT" ]
permissive
module Fov def self.init @width = Map.width @height = Map.height @dirty = true @center = Vector.new @old_center = Vector.new @map = Array.new(@width) { Array.new(@height) { :none } } end def self.update entity = World.player @old_center.x = @center.x @old...
true
ba73476f362017ea26c0b400511cc622a2703f7c
Ruby
Harxy/learn_to_program
/ch10-nothing-new/english_number.rb
UTF-8
1,324
4.0625
4
[]
no_license
def english_number number # take an english number higher than 0 if number < 0 return "higher number please" end if number == 0 return "ZERO" end return_string = '' ones = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] tens = ['ten','twenty','thirty', 'forty', 'fifty', 'sixty',...
true
e408877c76e5bf9a988d143534809e30f8bdf5de
Ruby
dvornikov/bem-on-rails
/lib/bem-on-rails/build/bem_names.rb
UTF-8
3,798
2.65625
3
[ "MIT" ]
permissive
module Bemonrails module BemNames # Resolve directories def path_resolve(essence, builder=options, include_level=true) current_level = builder[:level] ? builder[:level] : BEM[:level] path = include_level ? [current_level] : [] case essence when :mod ...
true
eeba3f00e38a5df0a1e984b39d6434c1dbd3a86b
Ruby
jwhitish/learning-ruby
/age_in_seconds.rb
UTF-8
200
3.734375
4
[]
no_license
def user_age puts "How old are you in years?" age = gets.chomp puts "You are #{age} years old" seconds = age.to_i * 365 * 24 * 60 * 60 puts "You are #{seconds} seconds old." end user_age
true
080d61e542753d057819eca6ab194afc54ebdd04
Ruby
skaggsa3/tealeafacademyprework
/chapter12/birthday.rb
UTF-8
417
3.96875
4
[]
no_license
puts "Please tell me the year you were born" year = gets.chomp puts "Please tell me the month you were born" month = gets.chomp puts "Please tell me the day you were born" day = gets.chomp puts "" current_time = Time.new birth_date = Time.new(year, month, day) age = current_time.year - birth_date.yea...
true
31cecd5143f5c53e743633e2b00cf76782f4c909
Ruby
aschreck/date_night
/lib/binarysearchtree.rb
UTF-8
2,109
3.5625
4
[]
no_license
require_relative '../lib/node.rb' class BinarySearchTree attr_accessor :root, :score, :name def initialize @root = nil end def insert (score,name) #Search Tree looks for leading node if @root.nil? @root = Node.new(score,name, 0) return 0 #root depth is always zero else #If...
true
9f1906f2a645c1adf0e0d1a2cf39422d30119d4e
Ruby
Geopin/geopin
/test/models/pin_test.rb
UTF-8
638
2.546875
3
[]
no_license
require 'test_helper' class PinTest < ActiveSupport::TestCase def setup @pin = Pin.new name: "example pin", position: "48.345317 -78.238746", tags: "camping hiking", description: "sample description", photos: "photo url", ...
true
7e1c30b64f978c686a8a87afaeaee6c20b155d13
Ruby
BlakeStrickland/weather_report
/current_observation.rb
UTF-8
1,003
3.296875
3
[]
no_license
require 'httparty' class CurrentObservation def initialize(zip_code) @zip_code = zip_code @response = get_response end def current_temp @response["current_observation"]["temp_f"] end def current_wind @response["current_observation"]["wind_mph"] end def current_weather @response["cu...
true
5e4e282009a03c761180a1d3fc15249d033d89ce
Ruby
osaboh/understanding_computation
/chapter2/semantics/semantics_operational_bigstep.rb
UTF-8
4,345
3.3125
3
[]
no_license
#!/usr/bin/env ruby2.1 # coding: utf-8 # O'Reilly アンダースタンディング コンピューテーション、 # 2 章の操作的意味論(ビッグテップ意味論)の仮想機械 # * 2015/07/22 23:33:29 # # .irbrc で以下を定義しておくと便利。 # def rr # require "this_code.rb" # end require "pp" # 共通 inspect メソッド module Com_inspect def inspect " <<#{self}>> " end end # 数値 class Number < Struct....
true
0f36eebbb373913c3211b8abbe6aaffb4c34b5eb
Ruby
yjjhu/ROR277
/HW1_02.rb
UTF-8
968
3.953125
4
[]
no_license
#(第一週作業02)剪刀石頭布 #require 'pry' #inding .pry def game (a,b) if a == b puts"<><><><><>> 平手 <<><><><><>" elsif a==0 && b==1 puts"<><>LOSE<>> (輸) <><>WIN><>>" elsif a==1 && b==2 puts"<><>LOSE<>> (輸) <><>WIN><>>" elsif a==2 && b==0 puts"<><>LOSE<>> (輸) <><>WIN><>>" else puts"<>...
true
4d2b437cdc8be97834f232a16aaa6b279e74e670
Ruby
toshikidoi/s3_ftp_example
/vendor/bundle/ruby/2.2.0/gems/happening-0.2.5/lib/happening/s3/request.rb
UTF-8
3,979
2.640625
3
[ "ISC", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
module Happening module S3 class Request include Utils VALID_HTTP_METHODS = [:head, :get, :put, :delete] attr_accessor :http_method, :url, :options, :response def initialize(http_method, url, options = {}) @options = { :timeout => 10, :retry...
true
b4d74b325e5dc19e20ffc3a5a3784007b73d50bb
Ruby
logstash-plugins/logstash-integration-aws
/lib/logstash/codecs/cloudfront.rb
UTF-8
2,277
2.546875
3
[ "Apache-2.0" ]
permissive
# encoding: utf-8 require "logstash/codecs/base" require "logstash/codecs/plain" require "logstash/json" # This codec will read cloudfront encoded content class LogStash::Codecs::Cloudfront < LogStash::Codecs::Base config_name "cloudfront" # The character encoding used in this codec. Examples include "UTF-8" and...
true
bc4aa38c9d5eefd76dc365836fe4b16def22fe5a
Ruby
BenKanouse/katas
/NumberToLCD/led.rb
UTF-8
1,555
3.53125
4
[ "MIT" ]
permissive
class Led def initialize(height=1, width=1) @height = height @width = width end def print(number) number.to_s.chars.inject([""] * total_height) do |memo, i| memo.zip(numbers[i.to_i]).map { |memo_row, new_row| memo_row + new_row } end.join("\n") + "\n" end private def total_height ...
true
5591de2657a54a5aa77651abc5faf5727da5723b
Ruby
ept/flowquery
/lib/flowquery/type.rb
UTF-8
2,657
3.078125
3
[]
no_license
module Flowquery class Type attr_accessor :current_type def initialize(current_type) @current_type = current_type end def unify_with!(other_type) current_type.unify_with! other_type.current_type end class Base attr_accessor :references def self.make(*args) ...
true
9265b70e0ad4e54c11fc9b1dec57551c7bbc2b09
Ruby
brianwlego/key-for-min-value-nyc01-seng-ft-071320
/key_for_min.rb
UTF-8
282
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) output_key = nil name_hash.each do |key, value| if value<11 output_key = key end end output_key end
true
acda6d847d3f70344896c4f57c31c724277cdb87
Ruby
ZABarton/phase-0
/week-6/nested_data_solution.rb
UTF-8
3,373
3.90625
4
[ "MIT" ]
permissive
# RELEASE 2: NESTED STRUCTURE GOLF # Hole 1 # Target element: "FORE" array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]] # attempts: # ============================================================ p array[1][1][2][0] # ============================================================ # Hole 2 # Target element...
true
dbac3a2026df88c6c1dad3630382f0d8854fa6e9
Ruby
yez/random_problems
/spellcheck/key_concern_spec.rb
UTF-8
2,576
3.25
3
[]
no_license
require './key_concern' class TestClass include KeyConcern end describe KeyConcern do let(:test_class) { TestClass.new } describe '#de_duped_letters' do context 'given a string with adjacent duplicates' do it 'removes adjacent duplicates' do expect(test_class.de_duped_letters('aabbcc')).to e...
true
23a7f9becbfdeb3a9f1ff826edfd8bda9afac5a9
Ruby
ianw92/LearningPlatform
/app/models/comment.rb
UTF-8
1,015
2.625
3
[]
no_license
class Comment < ApplicationRecord include ActionView::Helpers::TextHelper belongs_to :week belongs_to :user validates :body, presence: true def edited if created_at != updated_at return true else return false end end def time_since_created return time_since('created') end ...
true
5cf2af7919edf05e2082cb535b992488783f47d2
Ruby
oisin/bikebotser
/lib/bot.rb
UTF-8
1,875
3.015625
3
[ "BSD-2-Clause" ]
permissive
require 'slackbotsy' require 'bikes' module Bot def self.help "free <station> - show number of free bikes at station\n" + "slots <station> - show number of free slots for parking bikes at station\n" + "help - list these commands\n" end def self.sorry(cmd, user) "#{cmd.capitalize}...
true
3e271ee919c094850d1e55d2bc9ef5b793eccfb2
Ruby
krismac/course_notes
/week_01/day_3/array_hash_loop_testing_lab/start_point/specs/my_functions_spec.rb
UTF-8
2,049
3.46875
3
[]
no_license
require( 'minitest/autorun' ) require( 'minitest/rg' ) require_relative( '../my_functions' ) class My_Functions < MiniTest::Test # Write a function that takes has two parameters, array1 and array2 # It should return the sum of the array lengths def test_add_length_of_arrays # arrange citrus_fruits = [ ...
true
1c772340c8ba7ce6f1327cc5acd68d031cedc2f5
Ruby
Krustal/Measurements
/lib/measurements/units.rb
UTF-8
1,646
3.171875
3
[]
no_license
require 'measurements/us_volume' module Measurements # :nodoc: # This module is used to extend the Fixnum and Float # Kernel classes to support more human readible usage # of unit measurements. (e.g. 1.gallons) # # Current Support: # teaspoons, tablespoons, fluid oz, cups, pints, quarts, # gallons # ...
true
66cc0cbdcc027a13040580482e93d0b1430079c1
Ruby
Gawyn/love4movies
/lib/filmaffinity.rb
UTF-8
2,021
2.671875
3
[]
no_license
class Filmaffinity class << self require 'json' require 'nokogiri' require 'open-uri' USER_RATING_URL = "http://www.filmaffinity.com/en/userratings.php?orderby=8" def write_user_ratings(user_id) ratings = get_user_ratings(user_id) File.open("my-fa-ratings.json", "w") do |f| ...
true
3bd16cfc4681b4ed4746acdc8b1f994c41ac8ad7
Ruby
s10018/MI
/app/helpers/movie_helper.rb
UTF-8
700
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- module MovieHelper include ActsAsTaggableOn::TagsHelper def show_date(t) return t.strftime("%Y-%m-%d") end def get_info(movie, type="all") return Movie.get_info(movie,type) end def get_part(part) h = ['0時限目','1時限目','2時限目','昼休み','3時限目','4時限目','5時限目','6時限目'] if...
true
94c88d935d792efbe05568a8c6055fc723e10b5b
Ruby
adam-barton/favorite-wines
/app/models/wine.rb
UTF-8
894
2.75
3
[ "MIT" ]
permissive
class Wine < ActiveRecord::Base has_many :ratings has_many :users, through: :ratings validates :label, :grape, :year, :category, presence: true validates :year, numericality: { only_integer: true }, inclusion: { in: 1900..Time.current.year }, format: { with: /(19|20)\d{2}/i, message: "shou...
true
cf183becafb25005da8402d05433844120b7f5ee
Ruby
mikeadeleke/recipe-hash
/recipe.rb
UTF-8
892
3.65625
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ingredients = {} ingredients[:avocados] = 4 ingredients[:jalapenos] = 2 Recipe = Struct.new(:ingredients, :method) recipe = Recipe.new( {avacados: 4, jalapenos: 2}, ["Peel / Slice Avocados", "Chop jalapenos into small dice"]) puts "ingredients" recipe.ingredients.each do |key, value| puts "* #{key}: #{value}" end ...
true
db93c4491345468d4b3f07d8b0339e770f62d134
Ruby
Watson-Derek/RB101
/Exercises/Easy2/sum_or_product.rb
UTF-8
876
4.5625
5
[]
no_license
def prompt(string) puts ">> #{string}" end def valid_integer?(input) input > 0 end def valid_choice?(input) input.downcase == 's' || input.downcase == 'p' end number = "" prompt("Please enter an integer greater than 0:") loop do number = gets.chomp.to_i break if valid_integer?(number) prompt("Not a val...
true
d2e6533aa7825970839cace116ff3c06c2484ace
Ruby
protonet/linkbot
/linkbot/plugins/search.rb.inactive
UTF-8
1,082
2.515625
3
[]
no_license
class Search < Linkbot::Plugin Linkbot::Plugin.register('search', self, { :message => {:regex => Regexp.new('!search (.*)'), :handler => :on_message, :help => :help} } ) def self.on_message(message, matches) search = matches[0] rows = nil mess = "" rows = Linkbot.db.execute('selec...
true
e59a051e59ae70f5fc246a2b0cf7bd478787672a
Ruby
JJob-ruby/ruby_problems
/Set1/q9_recursion.rb
UTF-8
251
3.640625
4
[]
no_license
puts "Enter q to terminate the program" v = 'c' def rc_count(num) if num>0 puts "#{num}" rc_count(num-1) end end while (1==1) puts "Enter a number" v = gets.chomp if v.eql?("q") break end num = v.to_i rc_count(num) end
true
cc1c7b9849f9482a7f75be8fa61eafa254035175
Ruby
guoyiwang/MyLiterature
/Expertiza_Test_Generate/models_user.rb
UTF-8
1,560
2.640625
3
[]
no_license
require 'digest' class User < ApplicationRecord has_many :credit_cards, dependent: :destroy # credit_cards are the instances in credit_card model has_many :transactions, :dependent => :destroy before_destroy :check_is_admin, prepend: true accepts_nested_attributes_for :credit_cards validates :name, presenc...
true
2adb68784164e35e681813550624511aedf23822
Ruby
lpile/giphy-search
/app/facades/gif_search_facade.rb
UTF-8
299
2.859375
3
[]
no_license
class GifSearchFacade def initialize(q) @q = q end def gif_count gifs.count end def gifs gif_data = giphy_service.search_data(q) gif_data[0..4].map do |gif| Gif.new(gif) end end private attr_reader :q def giphy_service GiphyService.new end end
true
b2406cecf281773e9dc20e23ed973785a613eb43
Ruby
swifthorseman/data_structures
/graphs/UndirectedGraph.rb
UTF-8
288
3.359375
3
[]
no_license
require 'set' class UndirectedGraph attr_reader :V, :E def initialize(num_vertices) @adjList = Array.new(num_vertices) { |i| i = Set.new } @V = num_vertices @E = 0 end def addEdge(v, w) @adjList[v].add(w) @adjList[w].add(v) end def adj(v) return @adjList[v] end end
true
b957813404f420a639fa83f17fc10044e03a9b5d
Ruby
azanar/tremor
/tremor/ingestion/quake.rb
UTF-8
402
2.59375
3
[]
no_license
require 'date' module Tremor module Ingestion class Quake def initialize(line) @id = line[11] @magnitude = line[4] @latitude = line[1] @longitude = line[2] @time = DateTime.parse(line[0]) end attr_reader :id attr_reader :magnitude attr_reader...
true
33f7b6a1bbb53fe03dbf8a06b191549b121e4845
Ruby
igolden/dotfiles
/scripts/remove_itunes_dups.rb
UTF-8
2,530
2.953125
3
[]
no_license
#!/usr/bin/env ruby ### # duplicates remover for iTunes # ============================ # # # Dependencies # # [RubyOSA](http://rubyosa.rubyforge.org/) # # # How to use # # ## for lazy person: # # 1. run this script "ruby itunes-dup-remover.rb" to display duplicated files # 2. run with '-y' option to remove them # ...
true
b4324a454ae732d14d5ce0820105c3cbbca72283
Ruby
looping124/12_mini_jeu_POO
/app_3.rb
UTF-8
748
2.84375
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/player' require_relative 'lib/game' system ('clear') puts "------------------------------------------------" puts "|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |" puts "|Le but du jeu est d'être le dernier survivant !|" puts "---------------------------------...
true
28170650ac80496a1b010bafcea5c0591c10e373
Ruby
leungwensen/70-math-quizs-for-programmers
/zh_CN/q38_01.rb
UTF-8
834
3.015625
3
[ "MIT" ]
permissive
# 设置反转用的掩码 mask = Array.new(16) 4.times{|row| 4.times{|col| mask[row * 4 + col] = (0b1111 << (row * 4)) | (0b1000100010001 << col) } } max = 0 # 保存步骤数目的数组 steps = Array.new(1 << 16, -1) # 从所有方格都为白色开始 steps[0] = 0 # 检查对象的数组 scanner = [0] while scanner.size > 0 do check = scanner.shift ...
true
50ace56feb73c26ec94094fd8760ca53ef295360
Ruby
English-marom/furima-36135
/spec/models/user_spec.rb
UTF-8
4,730
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = FactoryBot.build(:user) end describe 'ユーザー新規登録' do context '内容に問題ない場合' do it 'しっかりと内容が正しければ' do expect(@user).to be_valid end end context '内容に問題がある場合' do it 'nicknameが空では登録できない' do @user.nickname =...
true
daca33262607c0750a653933d473f7423678b1ac
Ruby
manuelcorrea/ruby_code
/euler/1.rb
UTF-8
281
3.59375
4
[]
no_license
sum = 0 (1..999).each do |num| sum = sum + num if num%3==0 || num%5==0 end #puts sum fib = Hash.new {|h,n| h[n] = h[n-1] + h[n-2] } fib sum = 0 n = 1 while true ne = fib[n] if ne < 4000000 sum = sum + ne if ne%2 == 0 n = n + 1 else break end end puts sum
true
fd99aece144c2f7290f7bb998d8b5388465b46b9
Ruby
Atul9/markdown_helper
/bin/markdown_helper
UTF-8
853
2.65625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'markdown_helper' # Confirm that we're in a git project. MarkdownHelper.git_clone_dir_path # Each command foo has a corresponding Ruby executable _foo. def command_keywords dir_path = File.dirname(__FILE__) dirs = Dir.entries(dir_path) command_file_names = dirs.select{ |x| x.start_w...
true
59cc640dae45cf30a21fe005e971fa46370585a8
Ruby
lochnessathome/BudgetPlan
/invoice.rb
UTF-8
580
3.34375
3
[]
no_license
class Invoice include Comparable def initialize() @date = nil @amount = nil end def get_date() @date end def get_amount() @amount end def set_date(date) @date = date end def set_amount(amount) @amount = amount end def <=>(other) get_date <=> other.get_date end...
true
10e0a49dd1b04c14f31bf8ab54649fc1a679b33b
Ruby
jonzingale/Ruby
/craigslist/office_region.rb
UTF-8
1,561
3.390625
3
[]
no_license
class Region require 'matrix' JACKRABBIT = [35.689054,-105.946113] MY_HOUSE = [35.680067,-105.962163] ST_JOHNS = [35.671955,-105.913378] BUCKMAN = [35.698446,-105.9832] # default COORDS = [BUCKMAN,MY_HOUSE,ST_JOHNS].freeze def initialize(lat, long) ; @point = [lat, long] ; end def jordan(miles) ; co...
true
6b909cd5f16def152d552445d18562d82190baca
Ruby
msimonborg/allowable
/lib/allowable/allowable.rb
UTF-8
1,025
3.109375
3
[ "MIT" ]
permissive
# frozen_string_literal: true # Filter hashes by setting allowed or forbidden values for specific keys. # # hash = { one: 'one', two: 'two' } # # hash.forbid(one: 'one') # => { two: 'two' } # # hash.allow(one: 'two') # => { two: 'two' } # # hash.allow(one: ['one', 'two']) # => { one: 'one', two: 'two'...
true
bee6824c70efa021265f547fee62737b38238307
Ruby
AMaleh/glimmer-dsl-swt
/samples/elaborate/stock_ticker.rb
UTF-8
7,197
2.609375
3
[ "MIT" ]
permissive
# Copyright (c) 2007-2021 Andy Maleh # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # d...
true
4ac8cdc57aba2c302cdc2991ef35d646c76a6d6a
Ruby
marcuspereiradev/conhecendo-ruby
/conhecendo_ruby/fibers/fibers2.rb
UTF-8
898
3.75
4
[]
no_license
fib = Fiber.new do x, y = 0, 1 loop do Fiber.yield y x, y = y, x + y end end 10.times { puts fib.resume } # 1. A Fiber é criada com new . # 2. Dentro de um iterador que vai rodar 10 vezes, é chamado o método resume . # 3. É executado o código do início do “corpo” da Fiber até yield . # 4. N...
true
4a8bbb15dbb7633c776963c85006fb5a1318ad8a
Ruby
zgavin/moo2maps
/lib/core/point.rb
UTF-8
587
3.875
4
[]
no_license
class Point attr_accessor :x,:y def initialize x,y=nil if y then @x = x @y = y else @x = Math.cos(x) @y = Math.sin(x) end end def + other Point.new(self.x+other.x,self.y+other.y) end def - other Point.new(self.x-other.x,self.y-other.y) end d...
true
091e6b071585a72d80bf4406f12513f6313e4d58
Ruby
diegoacuna/round_robin_recommendation
/lib/round_robin_recommendation.rb
UTF-8
2,366
3.578125
4
[ "MIT" ]
permissive
# frozen_string_literal: true require 'json' require "round_robin_recommendation/version" module RoundRobinRecommendation class Error < StandardError; end class Recommendation attr_accessor :articles # In this variable we store the max amount of tokens that we want to recommend MAX_RECOMMENDED_ARTICLE...
true
7c9fd756a491c078b8619f973f19874b59116cb3
Ruby
rraghoth/kwk-l1-ruby-strings-teachers-l1
/invitation.rb
UTF-8
758
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Code your prompts here! puts "Hi, you've been invited to a party! What is your name?" guest_name = gets.chomp.capitalize puts "Party Name:" party_name = gets.chomp.split.map(&:capitalize).join(' ') #puts "Month of Party:" #month = gets.chomp.capitalize puts "Date of Party:" date = gets.chomp.capitalize...
true
fd47a7787faf453f12220163315a4bdf311dfefc
Ruby
beepscore/bs_team_ranker
/lib/bs_team_ranker/game.rb
UTF-8
1,151
3.265625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require_relative 'game_team' module BsTeamRanker class Game # Use a collection in order to follow DRY principle # In soccer a game has 2 teams # In some sports such as swimming, an 'game' could be a swim meet and contain more than 2 teams attr_reader :game_teams def initial...
true
a8b877195eabd6447bd88f87c66d11677f216f0f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/robot-name/d2b1625f4eb447e1944b3834015f0c48.rb
UTF-8
427
3.25
3
[]
no_license
class Robot @@used_names = [] def initialize @name = rando_name @@used_names << @name end def rando_name letts = ('A'..'Z').to_a.sample(2).join nums = ('0'..'9').to_a.sample(3).join letts + nums end def reset new_name = rando_name() while @@used_names.index(new_name) != nil ne...
true
0d77ddccb3570220fd0bc95b78d0b4646dfddcf9
Ruby
StephenSanchez05/my-collect-online-web-pt-110419
/lib/my_collect.rb
UTF-8
127
2.96875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) i = 0 monkey = [] while i < array.length monkey << yield(array[i]) i = i + 1 end monkey end
true
e18d095002dfa7b1e8528e0299678564dca361a7
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/0f15d45ffff74fdb9d4d51cbf7eb883d.rb
UTF-8
364
3.40625
3
[]
no_license
class Anagram def initialize(word) @word = word end def match(choices) choices.group_by(&hash).fetch(key, []).reject(&identical) end private def key @key ||= hash.(word) end def hash -> word { word.downcase.split('').sort } end def identical -> match { match.downcase == wor...
true
4ec1c51039f5ea85824ea2e6a26de17184bd2ce7
Ruby
nickpetty/poc-server
/server.rb
UTF-8
3,902
3.21875
3
[]
no_license
#!/usr/bin/ruby require 'socket' require 'yaml' require 'fileutils' require 'colorize' def clear system("clear") system("cls") end clear puts "Starting up server... #{Time.now}" @server = TCPServer.new(2008) class Users attr_accessor :users def users @users end def defaults user ...
true
5c62fc177bf3524f355dc714c6430f2e167fa20b
Ruby
dlenhart/project-farenheit-2
/app/helpers/parsing.rb
UTF-8
407
2.6875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'json' module Parser_helper def self.fix_date(date) d = date.split('-') "#{d[2]}-#{d[0]}-#{d[1]}" end def self.time_parse(line) line.gsub(/\s+/m, ' ').strip.split(' ') end def self.split_time(time) time[1].split(':')[1] end def self.convert_to_jso...
true
18a31e0424db87950406c38e817bfa168c1ed223
Ruby
darrenhardy/homework_assignments
/numbers_letters_and_variables/number_of_seconds.rb
UTF-8
1,020
4.03125
4
[]
no_license
#!/usr/bin/env ruby seconds_per_minute = 60 minutes_per_hour = 60 hours_per_day = 24 days_per_week = 7 weeks_per_year = 52 twenty_years_old = 20 seconds_per_hour = seconds_per_minute * minutes_per_hour lived_life_in_years = 60 * 60 * 24 * 7 * 52 * 100 puts "There are #{seconds_per_minute} seconds in a minute" puts "T...
true
737017639efec6e741011704b5d07e06e2161aa4
Ruby
a6ftcruton/event_reporter
/test/attendee_test.rb
UTF-8
1,335
3.0625
3
[]
no_license
require 'minitest/autorun' require_relative '../lib/attendee' class AttendeeTest < MiniTest::Test def test_it_exists attendee = Attendee.new assert_kind_of Attendee, attendee end def test_it_is_initialized_from_a_hash_of_data data = {:first_name => 'George', :last_name => 'Washington', :phone_numbe...
true
dc319e7b74156262508a1499368e36a822333026
Ruby
fgamador/badger
/spec/models/court_of_honor_spec.rb
UTF-8
921
2.71875
3
[]
no_license
require 'spec_helper' describe CourtOfHonor do describe "first_after" do before(:each) do @jan = CourtOfHonor.create! :name => "Jan", :date => Date.civil(2000, 1, 1) @feb = CourtOfHonor.create! :name => "Feb", :date => Date.civil(2000, 2, 1) @mar = CourtOfHonor.create! :name => "Mar", :date => ...
true
39914e6ef808f06ac2d61a61c3adf72373c30f94
Ruby
windmaomao/adventofcode
/2018/rb/02.rb
UTF-8
653
3.375
3
[ "MIT" ]
permissive
fn = open("2018/input/02") input = fn.each_line.map(&:chomp) # input = ["abcdef", "bababc", "abbcde", "abcccd", "aabcdd", "abcdee", "ababab"] # Part 1 def matches(str) groups = str.each_char.to_a.group_by{ |c| c } groups.values.group_by{ |arr| arr.size } end numMatches = input.map{ |str| matches(str) } n2 = numMa...
true
0ddd07cec57d8f626b53ff1c59aed93fe6db0729
Ruby
xurde/randomuserme
/lib/random_user_me.rb
UTF-8
752
2.765625
3
[ "MIT" ]
permissive
require 'randomuserme/version' require 'random_user' require "httparty" module RandomUserMe class Client include HTTParty base_uri 'http://api.randomuser.me' format :json def self.get_random_user response = get('/') return false if !response.parsed_response response_map(response...
true
e77e9cf023e1c4d40d753c51c2005c3438325b6e
Ruby
kleberkunha/TicTacToe
/lib/app/Board.rb
UTF-8
2,431
3.796875
4
[]
no_license
class Board def initialize @board = [7, 8, 9, 4, 5, 6, 1, 2, 3] @result = Array.new(9) end def play_turn1(player) # TO DO : une méthode qui : # 1) demande au bon joueur ce qu'il souhaite faire check = false while check == false check = true puts " #{player.name} where do you w...
true
754ebcf058f341b0cc2d219beacce112c438ade4
Ruby
JevonMckenzie/hw-knapsack_cipher
/knapsack_cipher.rb
UTF-8
2,665
3.796875
4
[]
no_license
require 'prime' require './modular_arithmetic.rb' class SuperKnapsack attr_accessor :knapsack def self.array_sum(arr) arr.reduce(:+) end def initialize(arr) arr.each.with_index do |a, i| unless i == 0 if (a <= self.class.array_sum(arr[0..i-1])) then raise(ArgumentError, "not s...
true
c4444ea2384878c9cbd143389afcb81ce47d4890
Ruby
rexlane/cta-bus-texter
/lib/bus_tracker.rb
UTF-8
2,163
3.25
3
[]
no_license
require 'active_support/core_ext/time/calculations.rb' class BusTracker def direction_pairs { "n" => "Northbound", "s" => "Southbound", "w" => "Westbound", "e" => "Eastbound" } end def split_into_loc_and_dir(args) location = "#{args.rpartition(' ').first} chicago" direction = args.rpartition(' ').l...
true
c847b52416383ac17aa7ce606113c6be0d8bdc99
Ruby
Keisuke-Awa/algorithm
/atcoder/abc148/b.rb
UTF-8
101
3.15625
3
[]
no_license
n = gets.to_i a, b = gets.split str = [] n.times do |i| str << "#{a[i]}#{b[i]}" end puts str.join
true
f29c8007fcd3f397320a13b166583ebd37272490
Ruby
tonykino/kata_algo_skelzor
/lib/technical_test/five.rb
UTF-8
418
2.890625
3
[]
no_license
class TechnicalTest::Five include TechnicalTest def perform nbs = [1, 2, 3, 4, 5, 6, 7, 8, 9] combinations = [' + ', ' - ', ''].repeated_permutation(8).to_a results = [] combinations.each do |comb| array_to_evaluate = Two.new.combine_arrays(nbs.dup, comb.dup) result = eval(array_to_eval...
true
062b18f564883e3b178efaea0b13b3b3b3aaac23
Ruby
EmilReji/ruby_small_problems
/Advanced_1/3.rb
UTF-8
1,445
4.4375
4
[]
no_license
=begin Transpose 3x3: input: an array containing 3 sub arrays; each sub array conatains 3 integers output: a similar array but with values transposed transpose is when the rows and columns are exchanged the 1st entire sub_array becomes the first value in each sub_array the 2nd entire sub_array becomes the 2nd valeu in ...
true
80fab8ef169baf5a47acfea9f814c50998f24233
Ruby
akbarratt/rb100_exercises
/strings/10.rb
UTF-8
347
3.8125
4
[]
no_license
colors = 'blue pink yellow orange' puts colors.include?('yellow') puts colors.include?('purple') colors = 'blue boredom yellow' puts colors.include?('red') # This will return true because the substring 'red' is included in the string, within the word 'boredom'. A better way to solve this issue would be: puts colors...
true
f0325b0bc362e404f0dd18612e4faadf69066250
Ruby
Weiyuan-Lane/wy-tg-backend
/app/helpers/logs_helper.rb
UTF-8
4,448
3.15625
3
[]
no_license
require 'json' require 'english' require 'csv' # To be included in the logs controller class, as a service file to simplify the # code between the model and the controller module LogsHelper # Combine two hashes to one hash # The second hash is always the hash that has precedence in the hash values # Returns the...
true
d34376b24aaa489ed49496b386568e6d189f77fd
Ruby
kristiana-rendon/iwantpopcorn.github.io
/if_else.rb
UTF-8
949
3.90625
4
[]
no_license
$null =begin if 1 + 1 == 2 puts "1 and 1 does indeed equal 2" end my_name = "Kristiana" if my_name == "Skillcrush" puts "Hello there, Skillcrush!" else puts "Oops, I thought your name was Skillcrush. Hello, #{my_name}!" end =end puts "What is your favorite color?" fav_color = gets.downcase.chomp puts "Your favo...
true
c8346b5bd8dd6517ebff32854018a24890eb7fa2
Ruby
tamarlehmann/bank-tech-test
/lib/bank_account.rb
UTF-8
1,192
3.53125
4
[]
no_license
require_relative 'transaction' require_relative 'transaction_history' require_relative 'bank_statement' class BankAccount attr_reader :balance, :transaction_history MIN_BALANCE = 0 def initialize(balance = 0, history = TransactionHistory.new) @balance = balance @transaction_history = history end de...
true
3462d875f9a9dcce123dd083e07e591e3281ff20
Ruby
rhivent/ruby_code_N_book
/book-of-ruby/ch7/class_methods2.rb
UTF-8
870
3.765625
4
[]
no_license
# The Book of Ruby - http://www.sapphiresteel.com class MyClass @@classvar = 1000 @instvar = 1000 def MyClass.classMethod if @instvar == nil then @instvar = 10 else @instvar += 10 end if @@classvar == nil then @@classvar = 10 else @@classvar += 10 end end def instanceMethod if ...
true
6386f816a9f6c4da51954cd95bf4e50990396139
Ruby
ckhui/hello-ruby
/ruby_string.rb
UTF-8
1,825
4.09375
4
[]
no_license
#!/usr/local/bin/ruby -w puts $VERBOSE # true puts "Double quote String here" puts 'Won\'t you read O\'Reilly\'s book?' puts "Won\'t you read O\'Reilly\'s book?" a, b, c = 13, 36 ,723 puts "The value of a is #{ a }." puts "The value of sum is #{ a + b + c}." #can user ! ( { < for delimiter puts %{ Ruby is fun.}...
true
8397265d0b9f595fbf25a054b1729fade64d5e3b
Ruby
erikaannesmith/battleship
/lib/ui/game_screen.rb
UTF-8
1,779
3.6875
4
[]
no_license
require './lib/game_state' require './lib/ocean' require './lib/ui/random_coordinate_generator' require './lib/ui/screen_printer' class GameScreen attr_reader :computer_ships, :player_ships, :game_state def initialize(computer_ships, player_ships) @computer_ships = computer_ships @player_ships = player_sh...
true
1e0c3cd492a24ed1d5fd4e210cafc4650c214da1
Ruby
bellyfat/Shopify_Dashboard_Plus
/lib/shopify_dashboard_plus/helpers.rb
UTF-8
6,447
2.828125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative 'currency' module ApplicationHelpers include Rack::Utils using Currency alias_method :h, :escape_html DESIRED_FIELDS = %w[ total_price created_at billing_address currency line_items customer referring_site discount_codes ].fre...
true
89d2e0208e10d3f08f4e43b47c585045d2091685
Ruby
nastylia/ror_beginner_exercises
/lesson2/3.rb
UTF-8
98
3.171875
3
[]
no_license
arr =[0, 1] sum = 1 while sum < 100 do arr << sum sum = arr[-1] + arr[-2] end puts "#{arr}"
true
99598e111c9cf80052a7251d236c9c2fbe3cecfd
Ruby
lachdoug/quiz_fc
/app/models/question/scorer.rb
UTF-8
1,409
2.890625
3
[]
no_license
class Question class Scorer require "damerau-levenshtein" def initialize( question, answer_attempt ) @question = question @answer_attempt = answer_attempt end def process # debugger return apply_scoring_strategy @question.scoring, ( @answer_attempt || [] ).join(', ') #...
true