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
91b9c2d6abf49754bf1bca7a79df8e92e33d2574
Ruby
annalisa2014/hotels_system
/spec/models/hotel_spec.rb
UTF-8
1,611
2.734375
3
[]
no_license
require "rails_helper" describe "Hotel" do describe 'when visited, should increment views number' do before(:example) do @hotel = Hotel.new end it 'views are initially empty' do expect(@hotel.views_count).to eq(0) end context "after a hotel has been visited" do before(:example...
true
a645a559d1c8bf4ac37b0badb2adc8549d253f0f
Ruby
nhu313/Mastermind_Ruby
/spec/mastermind/code_spec.rb
UTF-8
4,618
2.953125
3
[]
no_license
require 'mastermind/code' describe Mastermind::Code do def results_for(array_one, array_two) code_one = Mastermind::Code.new(array_one) code_two = Mastermind::Code.new(array_two) code_one.results(code_two) end before(:each) do @secret_values = [2, 5, 7] end describe "the number of pe...
true
3eb9c7e7671e5954abf740e9cd0c304ceab70cbc
Ruby
NexusClash/NexusClash
/behaviour/effect/regen.rb
UTF-8
1,342
2.546875
3
[]
no_license
module Effect class Regen < Effect::ActOnTick def initialize(parent, interval, type, amount) super parent, interval @type = type.to_sym @type_max = (@type.to_s + '_max').to_sym @type_set = (@type.to_s + '=').to_sym @amount = amount.to_i end def tick_event(*target) target = super *target ta...
true
57581a43372d8a6d9a8373fd77ddacfc9fab88d1
Ruby
faloi/descubriendoMensajes
/lib/a_descubrir.rb
UTF-8
2,050
3.1875
3
[ "MIT" ]
permissive
require 'descubriendoMensajes/version' class ADescubrir class << self attr_accessor :mensajes end def self.init(subclass) subclass.mensajes = Hash.new subclass.mensajes.default = 0 end self.init(self) def self.inherited(subclass) init(subclass) end def self.mensajes_recibidos me...
true
9b227e9781b0d273a158528ae45e98f142bbb635
Ruby
compwron/codeeval
/31.rb
UTF-8
1,455
3.828125
4
[]
no_license
File.open(ARGV[0]).each_line do |line| line.strip! next if line.empty? word, char = line.split(',') i = word.reverse.index(char) p i ? word.length - 1 - i : -1 end # def rchar word, char # word.length - 1 - word.reverse.index(char) # end # def rchar2 word, char # word.chars.each_with_index.map.inject(-1) { |...
true
eb6b1e482d0af00010cf9f06ae37d7d129dcd231
Ruby
rokimoto/ruby-challenges
/quiz.rb
UTF-8
997
3.875
4
[]
no_license
def divisor (int) my_array = [] for i in 1..int if int % i == 0 my_array << i end end my_array end def isPrime (int) has_false = [] for i in 2..(int-1) if int == 2 has_false << true elsif int % i == 0 has_false << false else ha...
true
1473e378d584fa40cfd3151c7d7cbe73843c7517
Ruby
samyak-jn/Ruby-Insights
/check10.rb
UTF-8
883
4.21875
4
[]
no_license
#analyzer puts "Enter your first name" first=gets.chomp puts "Enter your last name" last=gets.chomp name = first +last puts "Your full name is #{first} #{last}" puts "Your full name reversed is #{last.reverse} #{first.reverse}" puts "Your name has #{name.length} characters in it" #Simple calculator puts "Simp...
true
d4e8fe08e226aaae04ec5b441e1e77c446e32171
Ruby
czengg/phase_4
/test/unit/dojo_test.rb
UTF-8
2,805
2.578125
3
[]
no_license
require 'test_helper' class DojoTest < ActiveSupport::TestCase #Relationship macros should have_many(:dojo_students) #Validation macros should validate_presence_of(:name) should validate_presence_of(:street) should validate_presence_of(:zip) #Validating state should allow_value("PA").for(:state) ...
true
ab9f03368813fb47c97c12c5eb3a7f304dab3470
Ruby
thesnarky1/bible_ngrams
/classes/corpus.rb
UTF-8
758
3.6875
4
[ "LicenseRef-scancode-public-domain" ]
permissive
# http://www.sitepoint.com/natural-language-processing-ruby-n-grams/ was a great starting point class Corpus def initialize(glob, klass) @glob = glob @klass = klass end #Creates an array of the appropriate class (in this case BibleCorpusFile) def files @files ||= Dir[@glob].map do |file| @k...
true
235ade7d78a48d89a2585fbcd991aa11a3a71f10
Ruby
simabelkar/Scrabble-Score
/Scrabble.rb
UTF-8
1,049
3.75
4
[]
no_license
class Scrabble attr_reader :word #have a readable access to this propety def initialize(word) @word = word end # score each letter using hash LETTER_SCORE = { "A" => 1, "B" => 3, "C" => 3, "D" => 2, "E" => 1, "F" => 4, "G" => 2, "H" => 4, "I" => 1, "J" => 8, "K" => 5, "L" =>...
true
c1d16f5aae75e1cb39c614c41aa1f8c50ccd377b
Ruby
msc01/humidity_control
/lib/humidity_control/alert.rb
UTF-8
1,356
3.15625
3
[ "MIT" ]
permissive
# Represents an alert class Alert def initialize(message:, level:, config: Config.new) @message = "#{level}: #{message}" @level = level @config = config @config.phone_nbr_to.each do |nbr| alarm nbr if @level == :alarm info nbr end return unless @level == :alarm LOGGER.info "W...
true
0b114ef62d390ec538ce40385eb90fdde2832d56
Ruby
nimbleltd/cal
/cal.rb
UTF-8
390
2.96875
3
[]
no_license
require_relative './ruby_cal' month = ARGV[0] year = ARGV[1] # unless month and year # raise ArgumentError # end # unless month.to_i > 0 and year.to_i > 0 # raise ArgumentError # end if ARGV.size == 1 year = ARGV[0] month = "empty" calendar = MakeCal.new month, year puts calendar.deliver_whole_year else cal...
true
a56107de85bf0fd8519eed6bdff972952e6a31d9
Ruby
Dee-Race/ttt-game-status-v-000
/lib/game_status.rb
UTF-8
793
3.796875
4
[]
no_license
# Helper Method require 'pry' def position_taken?(board, index) !(board[index].nil? || board[index] == " ") end # Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [6, 4, 2] ] def won?(board) WIN_COMBINATIONS.det...
true
e8835d7e45ddbf77ab3ebc8a7619a83b105f3f22
Ruby
berkes/microframeworks-questions
/application.rb
UTF-8
1,575
2.640625
3
[]
no_license
require "rubygems" require "sinatra" require "rack-flash" require "data_mapper" require "dm-sqlite-adapter" helpers do include Rack::Utils alias_method :h, :escape_html end # need install dm-sqlite-adapter DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/questions.db") class Question include DataMapper::Res...
true
b72c2a62e3cda9d5dc6dd53f24af2252be711889
Ruby
exoticBrain/rb_109
/practice_problems/count_duplicates.rb
UTF-8
1,542
4.53125
5
[]
no_license
=begin # Problem: Count the number of Duplicates Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. ...
true
84266917edbcd22695fc3c936329dc10bf5039e1
Ruby
eliterry/countdown-to-midnight-v-000
/countdown.rb
UTF-8
255
3.828125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#write your code here def countdown(n) n = n.to_i while n > 0 puts "#{n} SECOND(S)!" n -= 1 end "HAPPY NEW YEAR!" end def countdown_with_sleep(n) n = n.to_i while n > 0 puts "#{n} SECOND(S)!" n -= 1 sleep(1) end "HAPPY NEW YEAR!" end
true
7bb2b4860c7e311bdbfa70589a6d3b383cb02d55
Ruby
TuanNguyen1010/Code_kata
/Ruby/calculate_distance/lib/calculate_distance.rb
UTF-8
108
2.828125
3
[]
no_license
def calculate_distance(pointA, pointB) return (pointA[0]-pointB[0]).abs + (pointA[1] - pointB[1]).abs end
true
f7c971dfef6ef84802c6778287a41713fe662ba4
Ruby
sol-vin/rubyfunge
/rubyfunge.rb
UTF-8
8,461
3.234375
3
[ "MIT" ]
permissive
#! /usr/bin/env ruby DEBUG = false class Rubyfunge DIRECTIONS = [?>, ?v, ?<, ?^] #Tested OPERATIONS = [?+, ?-, ?*, ?/, ?%] #Tested MEM_INSTRUCTIONS = [?l, ?r, ??, ?", ?', ?(, ?)] #Tested STORE_INSTRUCTIONS = [?:, ?[, ?], ?$] #Tested OUTPUT_INSTRUCTIONS = [?,, ?., ?{, ?}] #Tested INPUT_INSTRUCTIONS = [?~, ?&...
true
f72da6daa369aa174d67b6d5c7c467e4e78ade58
Ruby
calaway/web_guesser
/web_guesser.rb
UTF-8
744
3.21875
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' SECRET_NUMBER = rand(101) def check_guess(guess) if guess == 0 ["white", "Try guessing a number:"] elsif guess > SECRET_NUMBER + 5 ["red", "Way too high!"] elsif guess > SECRET_NUMBER ["pink", "Too high!"] elsif guess < SECRET_NUMBER - 5 ["red", "Wa...
true
a1ba64fb5c3071a833e3989eb67c11977b4dc38a
Ruby
rochefort/misc
/book_tutorials/ruby_crawler/5-18_kuroneko/yamato_google_calendar.rb
UTF-8
1,153
2.59375
3
[]
no_license
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'nokogiri' require 'net/http' require 'google_calendar' if ARGV.size == 1 number = ARGV[0] else puts 'Input slip number' exit 1 end def set_google_calendar(number, status, day) cal = Google::Calendar.new( username: '', password: '', app_name: 'm...
true
90c8e472d75eb8aff58b255fd4fa1f29c53868c3
Ruby
NolanDC/Stratego
/helpers/gosu_extensions.rb
UTF-8
453
2.84375
3
[]
no_license
class Gosu::Window def draw_rect x, y, width, height, color = Gosu::Color::WHITE self.draw_quad(x, y, color, x+width, y, color, x+width, y+height, color, x, y+height, color) end def mouse_over? x, y, w, h if mouse_x >= x and mouse_x < x+w if mouse_y >= y and mouse_y < y+h return true ...
true
dbe076575bf72f2cb6268d5b1eafb23d724e806d
Ruby
openactive/api-dashboard
/lib/dataset_parser.rb
UTF-8
2,238
2.875
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
require 'time' module DatasetParser def parse_modified(modified) begin parsed = Time.parse(modified) rescue parsed = modified.to_i parsed = parsed / 1000 if parsed.to_s.length > 10 end parsed.to_i end def extract_timestamp(item, date_key="startDate") data = item["data"] ...
true
24b6a3a4549e382a6afe0e9124ca28b34a9d973d
Ruby
TheCSpider/GLOBO_Queueing_Project
/ClientHandler/clientPipeline.rb
UTF-8
1,043
3.109375
3
[ "MIT" ]
permissive
#clientPipeline.rb # Monitors the client queue and requests items from that queue, logging the activity # waiting too long # @author Shad Scarboro #--------------------------------------------------------------------------- # Existing Ruby Gems # Locally defined files/classes/modules require_relative 'clientQueue.rb...
true
7fad273e66977ba911db91c23a79d414558ae52c
Ruby
nepalez/query_builder
/lib/query_builder/cql/modifiers/clustering_order.rb
UTF-8
1,120
2.546875
3
[ "MIT" ]
permissive
# encoding: utf-8 module QueryBuilder::CQL module Modifiers # Provides CLUSTERING ORDER clauses for statements # module ClusteringOrder # Adds CLUSTERNING ORDER clause to the statement # # @param [#to_s] name The name of the column # @param [:asc, :desc] order The order of clus...
true
59a0098f94f67d33ba72b12d6923d240eaad31c7
Ruby
technologiclee/stackoverflow-scraper
/lib/discussion.rb
UTF-8
1,380
2.953125
3
[]
no_license
require 'nokogiri' require 'open-uri' require_relative 'database' class Discussion attr_accessor :saved attr_reader :url, :question, :noko_doc, :upvotes, :op_name, :op_link, :id @@urls = [] @@id = 1 def initialize(url, id=nil) if !id @id = @@id @@id += 1 else @id = id end ...
true
236cbbb6873138ef1a05e11bded2fd410bf8b8d5
Ruby
majaber/launch_school_prep
/notes/daily_notes.rb
UTF-8
1,985
3.953125
4
[]
no_license
11/01/20 First notes on intro to programming with Ruby. One directory for each chapter. Create a separate file for every exercise. 11/02/20 Constants are denoted with all UPPERCASE letters -a value that never changes Rubygems - gem install <gem name> 11/03/20 Finally begin the intro to ruby textbook. I spent th...
true
abbe8a84549db0f62ae0a924095ff03427bec635
Ruby
odf/PlexusRails
/app/models/image.rb
UTF-8
2,669
2.6875
3
[ "MIT" ]
permissive
# The model to represent an image attachment. class Image < ActiveRecord::Base # -- where to write files - TODO this needs to go into an initializer DATA_PATH = File.join(Rails.root, "data") # -- add timestamps and authors for creation and modification include Blame # t.string "filename" # t.string "...
true
db4663728e7f0d9e8cce0bbd40f972363315b187
Ruby
economica-zz/funglish
/app/properties/terms_of_service_001.rb
UTF-8
21,226
2.53125
3
[]
no_license
# coding: utf-8 class TermsOfService001 CONTENT = %^本利用規約(以下「本規約」といいます。)には、株式会社Economica(以下「当社」といいます。)の提供するソーシャル英語学習サービス「Funglish(ファングリッシュ)」のご利用にあたり、登録ユーザーの皆様に遵守していただかなければならない事項及び当社と登録ユーザーの皆様との間の権利義務関係が定められております。当該サービスを登録ユーザーとしてご利用になる方は、本規約に同意する前に、必ず全文お読み下さいますようお願い致します。 <span class="article">第1条 適用</span> 1. 本規約は、本...
true
079ef656f856b06e06750f57e4c256262b603729
Ruby
rahuljharj10/Algorithms-and-Data-Structures-in-Ruby
/sorting/RadixSort.rb
UTF-8
2,161
3.875
4
[]
no_license
#======================================================================= # Author: Rosel Sosa Gonzalez # Title: Radix Sort # Based on: http://www.geekviewpoint.com/python/sorting/radixsort # Package: Algorithms and Data Structures in ruby # Category: sorting # # Statement: # Given a disordered list of integers, rearran...
true
a47e78c363a75a5525e6a9c32461f368bdf9a8cf
Ruby
Casey-S/Make-School
/Q1/Classes/Full Stack/challenge1.rb
UTF-8
443
3.5
4
[]
no_license
stringIn = "this is a test" # stringIn.split #ary = [stringIn.split] #puts ary result = stringIn.split.map(&:capitalize).join(' ') puts result newSentence = "dicks out for harambe" newWorldHarambe = newSentence.split.map(&:capitalize).join(' ') puts newWorldHarambe dicksOut = "for harambe" harambeStepOne = dicksOut....
true
e8d7e3ed1abaa048256167cc5a964683752ff2c4
Ruby
moh-alsheikh/rubypractice
/rpractice/var-progflow.rb
UTF-8
118
3.046875
3
[]
no_license
a = 10 * rand if a < 5 puts "#{a} less than 5" elsif a > 5 puts "#{a} grater than 5" else puts "رز بخاري" end
true
8b1cb8abecbaea11404c10bfc25c395c752933ad
Ruby
SophiaLWu/flight-booker
/db/seeds.rb
UTF-8
860
2.78125
3
[]
no_license
# Airports airports = Airport.create([ {code: "SFO"}, # San Fran {code: "ATL"}, # Atlanta {code: "PEK"}, # Beijing {code: "ORD"}, # Chicago {code: "LAX"}, # Los Angeles {code: "HKG"}, # Hong Kong {code: "DFW"}, # Dallas {code: "JFK"}, # NYC {code: "LHR"}]) # London # Flights all_flight_po...
true
01864f73b754437d2284dd9c0ff35f536b47cd8b
Ruby
RubyPearls/pingpong
/spec/ping_pong_spec.rb
UTF-8
377
2.671875
3
[]
no_license
require('rspec') require('ping_pong') describe(PingPong) do describe("Fixnum#ping_pong") do it("returns an array of all numbers from 0 up to the number it was called on") do expect(3.ping_pong()).to(eq("ping")) end end it("returns an array of all numbers from 0 up to the number it was called on...
true
b360e426c539edcea7c8952b29e49caf31fffb8c
Ruby
rubiojr/mech_farmer
/bin/mfarmer
UTF-8
1,048
2.859375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require 'rubygems' require 'mech_farmer' require 'ip' require 'yaml' include MechFarmer def process_ip(ip) print "Farming ip #{ip}... " rh = RemoteHost.new(ip) if rh.farm puts "Ok" else puts "Failed" end return rh end ip_list = ARGV if ip_list.size == 0 puts "Usage: #{File.basen...
true
2a774000760d9bb213ffe8a1d911f419fd0ccc54
Ruby
utumno86/ruby_exercism
/isogram/isogram.rb
UTF-8
274
3.421875
3
[]
no_license
# Class for testing whether or not a string is an isogram class Isogram def self.isogram?(test_string) normalize(test_string).chars.uniq.length == normalize(test_string).length end def self.normalize(test_string) test_string.gsub(/\W/, '').downcase end end
true
5af24798c4248798db4b61b9d2f631b31b76922c
Ruby
vneverz/ruby-execise
/hashes/ex2.rb
UTF-8
132
2.890625
3
[]
no_license
tree = { species: "Banyan"} age = { age: "700" } puts tree.merge(age) puts tree puts age puts tree.merge!(age) puts tree puts age
true
751e2ee909bb1fddf3bbf248595b58a4bd5d6722
Ruby
MihirKale89/Ruby_code
/Algorithms/Arrays/numberOfAtoms.rb
UTF-8
2,446
3.96875
4
[]
no_license
=begin Given a chemical formula (given as a string), return the count of each atom. An atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.1 or more digits representing the count of that element may follow if the count is greater than 1. If the count is...
true
83d707f8f5f20141365ae65c37501590856db6b2
Ruby
pinnacol/linebook
/helpers/linebook/os/posix/utilities/set.rb
UTF-8
641
2.671875
3
[ "X11-distribute-modifications-variant", "MIT" ]
permissive
Set or unset options as specified. For example: set 'x' => true, 'v' => false If a block is given then options will only be reset when the block completes. {[Spec]}[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25] (options) -- if block_given? var = _package_.next_variable_n...
true
a29d9e481de38ec9ccdfc40695cbdf74baae1d44
Ruby
mame/ruby-ticket-counter
/ruby-ticket-counter.rb
UTF-8
2,760
2.65625
3
[]
no_license
require "net/http" require "json" require "time" def fetch(api) json = Net::HTTP.get(URI.parse("https://bugs.ruby-lang.org/#{ api }")) JSON.parse(json, symbolize_names: true) end def get_updated_issues(since, &blk) i = 0 total = nil begin list = fetch("issues.json?project_id=1&status_id=*&offset=#{ i }&...
true
daf1faaf8b5456e06595405ba962a38aff276ddb
Ruby
phss/ransom_flickr
/app/model/composer.rb
UTF-8
1,269
3.28125
3
[ "MIT" ]
permissive
class Composer def initialize(images) @images = images @cache = {} end def generate(note) elements = [] word_count = -1 partition(note).each do |line| line.each do |images| elements << word(images.collect { |image| image.url }).at(word_count += 1) elements << space ...
true
8a7642808a77a76baa6e0967859aa9f7b32e515f
Ruby
willmoeller/launch-school
/courses/preparatory_work/back_end/hashes/ex1.rb
UTF-8
641
4.15625
4
[]
no_license
# Given a hash of family members, with keys as the title and an array of names # as the values, use Ruby's built-in select method to gather only immediate # family members' names into a new array. family = { uncles: ["bob", "joe", "steve"], sisters: ["jane", "jill", "beth"], brothers: ["fran...
true
1bf84d48bd5013a0509cc7b7e957af0d6866cded
Ruby
leepuppychow/parkinsons_app
/app/services/doctor_data_service.rb
UTF-8
531
2.765625
3
[]
no_license
class DoctorDataService def initialize(city, state, specialty) @city = city @state = state @specialty = specialty end def practices JSON.parse(response.body, symbolize_names: true)[:data].map do |practice| Practice.new(practice[:practices]) end end def response Faraday.get("ht...
true
f7214641ede4a99b9b4511ac5ba0bbf14ef44f82
Ruby
rajpurkar/augur-nlp-mining
/xpipelines/v0/collapse-nop.rb
UTF-8
258
2.546875
3
[]
no_license
# USE: ruby filter-actions.rb corpus-clean.tsv | ruby collapse-nop.rb - # Collapse adjacent NOPs count_nop = 0 ARGF.each_line do |line| if line.strip == "NOP" count_nop += 1 else puts "NOP #{count_nop}" puts line count_nop = 0 end end
true
6e3e5710210f6aa2a3d776394fff6de395476839
Ruby
MartinEguizabal/Wk1-Day-3-hashes-and-arrays-lab
/my_functions.rb
UTF-8
366
3.4375
3
[]
no_license
def add_array_lengths(array1, array2) return (array1 + array2).count end def sum_array(numbers) sum_value = 0 for number in numbers sum_value += number end return sum_value end def find_item(array, item) for object in array if object == item return true end end return false end def ...
true
fb9f88339f9f9e1da079c14dd440deacfc4b6f7e
Ruby
robhurring/dotfiles
/bin/battery-status
UTF-8
1,080
3.078125
3
[]
no_license
#!/usr/bin/env ruby require 'optparse' class Battery DEFAULT_FORMAT = 'P (S: R)' def self.status _, percent, status, remaining, present = `pmset -g batt|grep InternalBattery`.split(/\t|;/).map(&:strip) percent.gsub!(/%/, '') remaining.gsub!(/[\(\)]/, '') remaining.gsub!(/\s*remaining.*/, '') ...
true
e2f81f3be2c214f1b052ca223c40faf57ccda110
Ruby
JHutsell/collections_practice_vol_2-dumbo-web-060319
/collections_practice.rb
UTF-8
1,312
3.53125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# your code goes here def begins_with_r(tools) tools.each do |tool| if tool[0].downcase != "r" return false end end true end def contain_a(arr) a_list = [] arr.each do |ele| a_list << ele if ele.downcase.include?("a") end a_list end def first_wa(arr) arr.each do |ele| return el...
true
910a68de73664578b39bc1f5325c80a672d1046b
Ruby
michaelstsnow/tic-tac-toe-rb-cb-000
/lib/tic_tac_toe.rb
UTF-8
3,447
4.1875
4
[]
no_license
# This method displays the board def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "-----------" puts " #{board[6]} | #{board[7]} | #{board[8]} " end #convert the users input tp an index def input_to_index(user_i...
true
d6fdb066977093ca43c2c49641b786da5e26314f
Ruby
mikespangler/football-pool
/app/models/user.rb
UTF-8
1,272
2.515625
3
[]
no_license
class User < ActiveRecord::Base has_many :picks attr_accessor :password before_save :encrypt_password validates_confirmation_of :password validates_presence_of :password, :on => :create validates_presence_of :email validates_uniqueness_of :email def self.authenticate(email, password) user = f...
true
80f9918846669d302001ee4c0175d0d6b378727f
Ruby
AleksTheRabbit/ruby
/ruby_challenges/always_3.rb
UTF-8
228
3.59375
4
[]
no_license
puts "Give me a number" number_one = gets.to_i number_two = number_one + 5 number_two = number_two * 2 number_two = number_two - 4 number_two = number_two / 2 final_number = number_two - number_one puts "Always #{final_number}"
true
9276a74ec8ef6ae208a42864a49b03a8e5a50e8f
Ruby
amarzook1/boris-bikes
/spec/docking_station_spec.rb
UTF-8
1,906
2.921875
3
[]
no_license
require "docking_station" require "bike" describe DockingStation do it 'responds to release_bike' do expect(subject).to respond_to(:release_bike) end it 'release working bikes' do bike = Bike.new expect(bike).to be_working end it 'respond to bike' do expect(subject).to respond_to(:bikes)...
true
3c837d979009963bd7989e57946140fe58ade679
Ruby
norman/babosa
/spec/transliterators/romanian_spec.rb
UTF-8
442
2.640625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "spec_helper" describe Babosa::Transliterator::Romanian do let(:t) { described_class.instance } it_behaves_like "a latin transliterator" it "should transliterate various characters" do examples = { "Iași" => "Iasi", "Mehedinți" => "Mehedinti", "Țară" ...
true
942ac67074132b899293a3fcf19bf10c2356eaec
Ruby
alexHampton/Ruby
/Ruby/data_structures/tic_tac_toe/lib/tic_tac_toe_node.rb
UTF-8
2,018
3.8125
4
[]
no_license
require 'byebug' require_relative 'tic_tac_toe' class TicTacToeNode attr_reader :board, :next_mover_mark, :prev_move_pos def initialize(board, next_mover_mark, prev_move_pos = nil) @board = board @next_mover_mark = next_mover_mark @prev_move_pos = prev_move_pos end def losing_node?(evaluator) ...
true
7cfee50b5a55db70aa996f276dfb00ae1cb58240
Ruby
chansanuwat/ruby_cucumber_sample
/features/support/lib/classes/connected_file_table.rb
UTF-8
1,164
2.59375
3
[]
no_license
require "#{File.dirname(__FILE__)}/../helpers/result_parsing" class ConnectedFileTable include ResultParsing RowValues = lambda { |row| cells = Finder.every({locator:'td', el: row}) id = Finder.value_of_attribute({attribute: 'id', this_el: row}).strip name = Finder.text_of({this_el: cells[0]}).strip ...
true
469956eb2845a5e9262a211a4400dec0b338b45d
Ruby
genometools/genometools
/scripts/mkswapbits.rb
UTF-8
1,220
3
3
[ "LicenseRef-scancode-unknown-license-reference", "ISC", "BSD-2-Clause", "LicenseRef-scancode-mit-old-style", "Zlib", "MIT", "BSD-3-Clause", "bzip2-1.0.6" ]
permissive
#!/usr/bin/env ruby def mkswapbitpairs(i,j) if i <= j STDERR.puts "assertion i=#{i}>#{j}=j failed" exit 1 end return "GT_SWAPBITPAIRS(kmer,#{2*i},#{2*j},#{2*(i-j)})" end def extractpair(i) return "(kmer & (3U << #{2*i}))" end def mkswapbits(len) i=len-1 j=0 explist=[] loop do if i < j ...
true
5363ddc905087cf83f38b2e06994ed97b50656db
Ruby
fylch/Thinknetica
/Lesson2/date.rb
UTF-8
589
3.90625
4
[]
no_license
puts "Enter the day, please: " day = gets.chomp.to_i puts "Enter the month, plese: " month = gets.chomp.to_i puts "Enter the year, please: " year = gets.chomp.to_i hash = { 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 } current...
true
2aed7fa6f80dace2422d2bc35b535ef424a0ad7e
Ruby
remind101/e164.rb
/lib/e164.rb
UTF-8
289
2.78125
3
[]
no_license
require "e164/version" require 'e164/lookuptable' module E164 def self.lookup(number) for cut_idx in (number.length-1).downto(0) cut = number[0..cut_idx] if E164::LookupTable.include?(cut) return E164::LookupTable[cut] end end return nil end end
true
794d736e03e623faffc8cf889aa6c888a3de3c20
Ruby
otegami/c9
/basic/8/try.rb
UTF-8
178
3.3125
3
[]
no_license
i = 0 sum = 0 while sum <= 100 puts("数値:#{i}") i = i + 1 sum = sum + i if sum > 100 puts("数値:#{i}") puts("合計:#{sum}") end end
true
97c28549a26733fe255fa0d118c1e351b13afc85
Ruby
UrsulaAntares/dice-roll-ruby-dc-web-062419
/dice_roll.rb
UTF-8
310
3.859375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Create method `roll` that returns a random number between 1 and 6 # Feel free to google "how to generate a random number in ruby" #def roll # return rand(1..6) #end def roll range_array = [1,2,3,4,5,6] order = rand(0..6) #puts order puts range_array[order] return range_array[order] end roll
true
56d44bb7731c8e7adabf170cf24948b1ddd2ebd4
Ruby
moofmayeda/expense_tracker_psql
/spec/company_spec.rb
UTF-8
2,911
2.765625
3
[ "MIT" ]
permissive
require 'spec_helper' describe "Company" do describe "initialize" do it "initializes a company with a hash" do test_company = Company.new(ATTRIBUTES) expect(test_company).to be_a Company expect(test_company.name).to eq "house" end end describe "save" do it "saves an company in the ...
true
ea9abb5450eed3b186662f33d2334ae340aae4e5
Ruby
ericgj/newman-scheduler
/app/models/event.rb
UTF-8
2,295
2.96875
3
[ "MIT" ]
permissive
require 'delegate' class Event < DelegateClass(::Portera::Event) def self.from_email(email, defaults={}) parsed = Email.new(email) new(parsed.name || defaults[:name]) do duration (parsed.duration || defaults[:duration]) range (parsed.range || defaults[:range]) end end attr_accessor...
true
9584330977c05da00f71b05934e6481de358dd4c
Ruby
danarrington/three_sixty_five
/spec/models/user_spec.rb
UTF-8
566
2.578125
3
[]
no_license
describe User do subject { create(:user, email: 'user@example.com') } it { should respond_to(:email) } it "#email returns a string" do expect(subject.email).to match 'user@example.com' end describe '#recalculate_total_distance!' do before {subject.total_distance = 10} let!(:run) {create(:run, ...
true
d661f28590bfa162c11164b8ecf8675552e79307
Ruby
Araiyu/Ruby_on_Rails
/ruby確認問題/lesson6.rb
UTF-8
256
2.96875
3
[]
no_license
total_price = 100 if total_praice > 100 puts "みかんを購入。所持金に余りあり" elsif total_praice == 100 puts "みかんを購入。所持金0円" else total_praice < 100 puts "ミカンを購入することができません" end
true
97ce64818164cb937524895d127a4f43b45c52ca
Ruby
serenaleung/Amazon
/spec/models/review_spec.rb
UTF-8
703
2.5625
3
[]
no_license
require 'rails_helper' RSpec.describe Review, type: :model do def review_attr(review_attributes = {}) { rating: 2, body: 'this sucks' # title: 'something terrible', }.merge(review_attributes) end it 'has a required rating' do revew = Review.new review_attr(rating:2) expect(:rating).to_not eq(nil) end it...
true
1ab1c2d5cb68b0acac4b904bb77f9b87ff2caaed
Ruby
kurianvijay/gamefic
/scripts/standard/actions/drop.plot.rb
UTF-8
571
2.703125
3
[ "MIT" ]
permissive
respond :drop, Use.family() do |actor, thing| if thing.parent != actor actor.tell "#{you.contract you.pronoun.Subj + ' ' + you.verb.be} not carrying #{the thing}." else actor.proceed end end respond :drop, Use.children do |actor, thing| if thing.sticky? actor.tell thing.sticky_message || "#{you.pro...
true
8d991be496b748e0d0d9e07035b5cb95752cbb65
Ruby
cpeak/coin-changer
/spec/coin_changer_spec.rb
UTF-8
476
2.796875
3
[]
no_license
require 'coin_changer' describe 'make change' do [[1,[1]], [2,[1,1]], [3,[1,1,1]], [5,[5]], [6,[5,1]], [7,[5,1,1]], [10,[10]], [11,[10,1]], [15,[10,5]], [16,[10,5,1]], [20,[10,10]], [21,[10,10,1]], [25,[25]], [26,[25,1]], [30,[25,5]], [36,[25,10,1]], [4...
true
9524c8738da0fd0d16ea76abb3a55a5e48563426
Ruby
nari19/AtCoder
/05x/055/b.rb
UTF-8
126
2.96875
3
[]
no_license
n = gets.to_i foo = (10 ** 9) + 7 result = 1 (1..n).each do |i| result %= foo result *= i end puts result % foo
true
10287757c22b9c17d2b058e02ffcc064e2c3babe
Ruby
kfultz/prag_studio_game
/lib/studio_game/playable.rb
UTF-8
239
3.5625
4
[ "MIT" ]
permissive
module StudioGame module Playable def blam @health -= 10 puts "#{name} got blammed!" end def w00t @health += 15 puts "#{name} got w00ted!" end def strong? self.health > 100 end end end
true
1311853474b425b9cc8c620f1070dd678e486b72
Ruby
eastwoodgate/my_repo
/Morpion/lib/classes.rb
UTF-8
6,783
3.484375
3
[]
no_license
class Board attr_accessor:total_board_moves_array ##necessité d'utiliser @@ pour utiliser une variable dans une sous-classe @@total_board_moves_array = [] #Affichage graphique du morpion @@A1_graphic = 'A1' @@A2_graphic = 'A2' @@A3_graphic = 'A3' @@B1_graphic = 'B1' @@B2_graphi...
true
da34afaf5e7f85408b082bbc49a19b2ddb2d6955
Ruby
hanami/view
/spec/unit/helpers/escape_helper/escape_html_spec.rb
UTF-8
2,192
2.734375
3
[ "MIT" ]
permissive
# frozen_string_literal: true RSpec.describe Hanami::View::Helpers::EscapeHelper, ".escape_html" do def escape_html(...) described_class.escape_html(...) end it "doesn't escape safe strings" do expect(escape_html("&".html_safe)).to eq "&" end it "escapes nil" do expect(escape_html(nil)).to eq "...
true
882f6531c409dea8bfbf46e95cdface77def3ca6
Ruby
yingnierxiao/army_rs
/lib/boot/boot/tools/load/test.rb
UTF-8
1,639
2.625
3
[]
no_license
# Test.rb module Boot module LoadTest def initialize client @client = client end end class LoadTestFactory def initialize type @type = type end def make_test client test_num = 5 if (1..test_num).include?(@type) then t = @type else t = rand(...
true
a97247587e7b379c876a8342ba849f2e6482dad1
Ruby
Embo427/bewd_sf_13
/05_Ruby_Fundamentals/exercises/get_it.rb
UTF-8
979
3.203125
3
[]
no_license
#1 - Pull the json from the reddit API via # http://www.reddit.com/.json # http://mashable.com/stories.json #2 - Parse it using the JSON library #3 - Find the stories based on techniques used in the code_along (max of 25 provided) #4 - Create a new story hash out of each story with the following keys :title, :upvot...
true
a928980cfd3d9c985884f3dcb9b529f16c51a2a3
Ruby
cheezenaan/procon
/atcoder/arc010/a.rb
UTF-8
228
3.125
3
[]
no_license
n, m, a, b = gets.split.map(&:to_i) completed = true day = 0 m.times do |i| c = gets.to_i n += b if n <= a if n < c day = i completed = false break end n -= c end puts completed ? "complete" : day + 1
true
8d7b827fb8e71551065c520f3dde04bc48b52c14
Ruby
su-kun1899/rubybook
/chapter9/excersise/excersise.rb
UTF-8
420
3.375
3
[]
no_license
# 問1 module ChocolateChip def chocolate_chip @name += "チョコレートチップ" end end # 問2 class Drink include(ChocolateChip) attr_reader :name def initialize(name) @name = name end end drink = Drink.new("モカ") drink.chocolate_chip puts drink.name # 問3 module EspressoShot PRICE = 100 end puts EspressoShot...
true
5e689f003be37e8fb81531b9f1cd0d29b6ed1335
Ruby
jamesangie/Programming-Language-Projects
/EZ projects/Trees in fs/zhany111.rb
UTF-8
976
4.09375
4
[]
no_license
#define Leaf class with value and two children class Leaf attr_reader :value attr_accessor :left, :right def initialize(value=nil) @value = value left = nil; right = nil; return self end end #Define Tree that is connection of Leaf class Tree #root_leaf is the first leaf of a tree attr_acce...
true
db4c5db1628f1b066da5a08bcec21d908d5052fa
Ruby
Nefor/Nefor
/app/helpers/api/money_helper.rb
UTF-8
1,369
2.71875
3
[]
no_license
module Api module MoneyHelper def collect_data total = 0 banknotes = [] coins = [] Money.banknotes.each do |b| banknotes << [b.denomination.to_s, b.total] total += b.denomination * b.total end Money.coins.each do |c| coins << [c.denomination.to_s, c.tota...
true
c02faf3d691e66b6a6eabbe76eccb7a1e17eedd0
Ruby
gschorkopf/sales_engine
/lib/sales_engine/invoice.rb
UTF-8
3,362
2.65625
3
[ "MIT" ]
permissive
module SalesEngine class Invoice attr_reader :id, :customer_id, :merchant_id, :status, :created_at, :updated_at def initialize(hash) @id = hash['id'].to_i @customer_id = hash['customer_id'].to_i @merchant_id = hash['merchant_id'].to_i @status = hash['status'] @cr...
true
60d69a0b1db40427fef94a34256a5887075cab34
Ruby
luongtran/po_tracker
/data/scripts/import_revision_history.rb
UTF-8
2,377
2.53125
3
[]
no_license
require 'fastercsv' class POPVImportRevisionHistory < ActiveRecord::Migration def self.up puts "This will import the BPCherrypoint Revision History CSV into the record_changelogs table. It will NOT erase any data before this happens (non-destructive). Be sure you cleaned up the record_changelogs table before runnin...
true
3ed52f30aedf16b83ab1e3d61e71eba5c9466c68
Ruby
JoeBumbaca/W2D3
/Poker/lib/deck.rb
UTF-8
369
3.3125
3
[]
no_license
require_relative "card.rb" class Deck SUITS = [:Clubs, :Diamonds, :Hearts, :Spades] VAULES = [:Two, :Three, :Four, :Five, :Six, :Seven, :Eight, :Nine, :Ten, :Jack, :Queen, :King, :Ace] attr_reader :deck def initialize @deck = [] SUITS.each do |suit| VALUES.each do |value| deck << C...
true
51421690df467acffb015670cd6a7f55f3f18a24
Ruby
MarilynFranklin/Colleague
/lib/setup.rb
UTF-8
2,831
2.8125
3
[]
no_license
require_relative 'project_file' require_relative 'project' require_relative 'colleague' require_relative 'client_manager' require_relative 'client' require_relative 'client_file' require_relative 'task' require_relative 'checklist' class Setup include Client_file include Project_file attr_reader :colleague, :c...
true
9139b43e54abcf4a0e2609237fa4f99d2db3bd06
Ruby
EDalSanto/OperatingSystems
/processes/unix_processrb/signals.rb
UTF-8
1,050
3.109375
3
[]
no_license
child_processes = 3 dead_processes = 0 # fork 3 child processes child_processes.times do fork { sleep 3 } end # sync $stdout so the call to #puts in the CHLD handler isn't buffered # Can cause a ThreadError if a signal handler is interrupted after calling #puts # Always a good idea to do this if your handlers will b...
true
da2e37a3a21a7c5f8ef7578ad9a7eb4be286fb03
Ruby
dunlapww/poetry-and-emotion
/app/facades/poem_facade.rb
UTF-8
172
2.515625
3
[]
no_license
class PoemFacade def self.author_search(params) results = PoemService.author_search(params) results.first(10).map do |poem| Poem.new(poem) end end end
true
2f51d1dc001ee1529686ba8ab702a10844023ae5
Ruby
scottwillson/racing_on_rails
/lib/enumerable/stable_sort.rb
UTF-8
1,586
3.484375
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true module Enumerable # Sort by +method+ and preserve existing order. Ruby sort_by does not preserve order. def stable_sort_by(method, order = :asc) case order when :asc merge_sort do |x, y| if x.send(method).nil? true elsif !x.send(method).nil? && ...
true
2b0494c3c0c65c4affb9c53f56a762b45cffef7b
Ruby
aijey/Nedotwitter
/Models/User.rb
UTF-8
5,546
2.84375
3
[]
no_license
require 'set' require 'json' class User attr_accessor :login def initialize(login, password) @login = login @password = password end def corectize! File.foreach("./Data/Users.txt") do |line| user = line.split(' ') if (user[0].downcase == @login.downcase) @login = user[0] ...
true
be17e8be3ce68938032a2239004948c205501c65
Ruby
AlexWaller1/oo-tic-tac-toe-ruby-intro-000
/lib/tic_tac_toe.rb
UTF-8
2,280
3.90625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class TicTacToe WIN_COMBINATIONS=[ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [6,4,2] ] def initialize @board=Array.new(9," ") end def display_board puts " #{@board[0]} | #{@board[1]} | #{@board[2]} " puts "-----------" puts " #{@board[3]}...
true
d6c9677f6c357071ec86bbf14c15f24243c21e1f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/ad6f5bf13712465497a150525b6a9380.rb
UTF-8
199
3.453125
3
[]
no_license
class Hamming def self.compute(dna1, dna2) return unless dna1 && dna2 && dna1.length == dna2.length (dna1.chars).zip(dna2.chars).count {|char1, char2| char1 != char2 } end end
true
a2d49e5b9d034ce1f4b505c288b6702e6d1548e2
Ruby
primaulia/food-delivery-reboot
/app/repositories/base_repository.rb
UTF-8
1,323
3.34375
3
[]
no_license
require 'csv' require 'pry-byebug' class BaseRepository def initialize(file_path) @file_path = file_path @elements = [] @next_id = 1 read_csv if File.exist?(@file_path) end def all @elements end def add(new_instance) new_instance.id = @next_id # serialization @elements << new_i...
true
3418fec832a57d76fe96c1cb38187306877806f1
Ruby
jadeKing/rps-challenge
/lib/player.rb
UTF-8
85
2.625
3
[]
no_license
class Player attr_accessor :name def initialize @name = "Player 1" end end
true
9185a80ae9e15d1c467288d48200959c8dc9f781
Ruby
rbur004/safe
/test/aes.rb
UTF-8
437
2.5625
3
[]
no_license
#!/usr/local/bin/ruby require_relative '../rlib/aes' salt, iv, encoded_text = AES_256.encrypt(text: 'The quick brown fox', password: 'password') s = "#{[salt].pack('m').chomp}$#{[iv].pack('m').chomp}$#{[encoded_text].pack('m').chomp}" puts s salt2, iv2, encoded_text2 = s.split('$') puts AES_256.decrypt(password: 'pas...
true
4fbda527624aec9bc497be88574bdef18f48b480
Ruby
Dan2552/astar
/lib/astar/graph_factory.rb
UTF-8
869
3.390625
3
[ "MIT" ]
permissive
module AStar module GraphFactory # Creates a graph representing a 2D grid. Sets `x` and `y` values as the # position for the vertex within the 2D grid. # # - parameter width: Int # - parameter height: Int # - returns: Graph # def self.two_dimensional_graph(width, height) graph = ...
true
c5703fd5140d95610d562c2739e92678835bfc0c
Ruby
KylaBendrik/prg101
/Prg 101/lab_5/lab5.new_roman.rb
UTF-8
589
4.15625
4
[ "MIT" ]
permissive
# frozen_string_literal: true NUMERALS = %w[M CM D CD C XC L XL X IX V IV I].freeze VALUES = [1_000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1].freeze def numeralize(num) result = '' VALUES.each_with_index do |val, index| next unless (num / val).positive? dividend = num / val num = num % val ...
true
5a23e3909267ba05c9397ab2d558a18682735546
Ruby
strychemi/project_sinatra_dashboard
/scraper.rb
UTF-8
2,063
3.03125
3
[]
no_license
require 'rubygems' require 'bundler/setup' require 'mechanize' require 'nokogiri' require 'csv' class DiceScraper def initialize(keywords="python", location="san jose") words = keywords.gsub(/ /, '+') loc = location.gsub(/ /, '+').gsub(/,/, '%2C') @address = "https://www.dice.com/jobs?q=#{words}&l=#{loc...
true
efd10d0833fd5e7df8f72213300bb725aaed45dc
Ruby
mhdavis/computer-science
/language_basics/ruby/ruby_intermediate.rb
UTF-8
7,638
3.75
4
[]
no_license
=begin _____ _ _____ _ _ _ _ | __ \ | | |_ _| | | | (_) | | | |__) | _| |__ _ _ | | _ __ | |_ ___ _ __ _ __ ___ ___ __| |_ __ _| |_ ___ | _ / | | | '_ \| | | | | | | '_ \| __/ _ \ '__| ...
true
307e26082b1df56d6bd52f48bdd199144b46a9ca
Ruby
seth952/caraoke_hw_w2
/room.rb
UTF-8
982
3.171875
3
[]
no_license
class Room attr_reader :name, :playlist, :capacity, :guest_count, :entry_fee def initialize(name, playlist, guest_count, capacity, entry_fee) @name = name @playlist = playlist @guest_count = [] @capacity = capacity @entry_fee = entry_fee end def find_song(song_name) return @playlist.find { ...
true
2abfe168dd16be5e3cf9adc2509a7fbde57d9fe9
Ruby
isabella232/simple-benchmark
/lib/simple_benchmark.rb
UTF-8
797
2.59375
3
[ "MIT" ]
permissive
require 'benchmark' require 'logger' require 'simple_benchmark/version' class SimpleBenchmark autoload :Helper, 'simple_benchmark/helper' class << self attr_writer :logger, :enabled end self.enabled = true def self.logger @logger ||= default_logger end def self.enabled? @enabled == t...
true
89706e98c6f6131bc2663e0876ae633d9989355f
Ruby
maesitos/disavow_tool
/lib/disavow_tool/list.rb
UTF-8
4,254
2.84375
3
[ "MIT" ]
permissive
require 'set' require 'fileutils' module DisavowTool class List def new; raise 'abstract!' end def clean_line!; raise "SubclassResponsibility" ; end def initialize(import_files) @list = Set.new @list_files_imported = [] @verbose = OPTIONS.verbose @verbose_hard = OPTIONS.hardcore...
true
a0904fcaf0901a0119bb72f2f368e25f30472202
Ruby
dcascone84/reverse-each-word-onl01-seng-pt-030220
/reverse_each_word.rb
UTF-8
104
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def reverse_each_word(phrase) phrase.split.collect { |word| word.reverse }.join(" ") end
true
81db157d44a1faa306aecd7f441d1a210f26d9f5
Ruby
williamwyj/TwO-O-Player_math_game_ruby
/question.rb
UTF-8
1,040
3.78125
4
[]
no_license
class Question def initialize @number1 = rand(1...20) @number2 = rand(2...20) @answer = 0 @gameType = rand(1...4) end def newQuestion @number1 = rand(1...20) @number2 = rand(2...20) @answer = 0 @gameType = rand(1...4) end def generateQuestion operator = '' if @gameTyp...
true
0bfaf9f410c624864ccfafbae8a93d3d2ce5efbc
Ruby
hackhands/feedasaurus-rails
/app/models/feed_refresher.rb
UTF-8
1,194
2.8125
3
[]
no_license
require 'rss' require 'feed_fetcher' require 'item_builder' class FeedRefresher < Struct.new(:feed) def self.refresh(feed) new(feed).refresh end def refresh request = fetch_feed request.save create_items(request) if request.new_body? feed rescue raise Error, %Q(Error refreshing feed ...
true
d0534a045a5ae89589b6e1a0b3a95b4d865a5851
Ruby
shoebham/Ruby_Projects_the_odin_project
/Project_Connect_Four_TDD/spec/connect_four_spec.rb
UTF-8
1,148
3.09375
3
[]
no_license
require "../lib/board.rb" # require "../lib/player.rb" # require "../lib/game.rb" describe 'Board' do describe 'board_full?' do it "Checks if the board is full or not" do grid = [ ['X', 'O', 'X', 'O', 'X', 'X', 'X'], ['X', 'O', 'X', 'O', 'X', 'X', 'X'], ['X', 'O', 'X', 'O', 'X...
true
c7b983f52445073156b2bf43c51e14f3827fd18c
Ruby
ear/serif
/test/site_spec.rb
UTF-8
2,350
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "test_helper" describe Serif::Site do subject do Serif::Site.new(testing_dir) end describe "#source_directory" do it "should be sane" do subject.directory.should == File.join(File.dirname(__FILE__), "site_dir") end end describe "#posts" do it "is the number of posts in the s...
true