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
01dfe779dce5ea2ffbfdde1508e7ff72f16b9ae4
Ruby
kendrickbogan/mediblock-backend
/app/models/demographic_detail.rb
UTF-8
808
2.734375
3
[]
no_license
# frozen_string_literal: true class DemographicDetail < ApplicationRecord RACES = { white: "white", black_or_african_american: "black_or_african_american", american_indian_or_alaska_native: "american_indian_or_alaska_native", asian: "asian", native_hawaiian_or_other_pacific_islander: "native_hawa...
true
cb1581b3917ac0507e9bf58524c147e3ec258e28
Ruby
Yahyagok/ruby-enumerables-cartoon-collections-lab-nyc-web-021720
/cartoon_collections.rb
UTF-8
632
3.484375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(names)# code an argument here i = 0 while i < names.length do names[i] puts "#{i+1}. + #{names[i]} " i +=1 end # Your code here end def summon_captain_planet(names)# code an argument here array = names.map {|name| name.capitalize } array.collect { |name| "#{name}!" } ...
true
4040170a54f469b5ec01386cf13f2b19c6c71ef8
Ruby
DVygovskiy/property_test
/features/helpers/requester.rb
UTF-8
1,542
2.609375
3
[]
no_license
require 'csv' class Requester def initialize(api) @api = api @current_cookie = '' end def get(path:, referrer: '') result = @api.get(URI("#{Global.settings.base_url}/#{path}"), :headers => set_header(referrer: referrer), follow_redirects: true) set_cook...
true
86fe9daa1aa581aba563fed785e246709f3c8a94
Ruby
BlakeJenningsJohnson/Scamazon
/app/models/order_item.rb
UTF-8
242
2.59375
3
[]
no_license
class OrderItem < ActiveRecord::Base belongs_to :order belongs_to :product def add(amount) self.update(quantity: (quantity + amount.to_i)) end def subtract(amount) self.update(quantity: (quantity - amount.to_i)) end end
true
3ce847b767eca433ebc4d62d59f54447249f1e72
Ruby
rootstrap/rs-code-review-metrics
/spec/models/technology_spec.rb
UTF-8
777
2.515625
3
[]
no_license
# == Schema Information # # Table name: technologies # # id :bigint not null, primary key # keyword_string :text # name :string # created_at :datetime not null # updated_at :datetime not null # require 'rails_helper' RSpec.describe Technology, type: :model d...
true
41ac930a32a76b668f804a52353c80588dc8b28f
Ruby
digitaIfabric/21daycodingchallenge
/ruby/challenge16.rb
UTF-8
197
3.140625
3
[]
no_license
def festivalColours(color1) hue1 = ((color1 + 150) > 360 ) ? (color1 - 210) : color1 + 150 hue2 = ((color1 + 210) > 360 ) ? (color1 - 150) : color1 + 210; return [hue1, hue2].sort end
true
0622a82899bf92c19340c917cd78c2e84f4f7b35
Ruby
quinHD/cards_against_humanity
/app/services/game_initializer.rb
UTF-8
341
2.78125
3
[]
no_license
class GameInitializer def initialize(decks:, players:) @decks = decks @players = players end def run game end private attr_reader :decks, :players def game @_game ||= Game.new(cards: cards, players: players) end def cards @_cards ||= Card.joins(:decks).where(decks: {id: decks}...
true
988d73be59bc8742f44859c1214a7941d6740ee1
Ruby
h4hany/yeet-the-leet
/algorithms/Medium/161.one-edit-distance.rb
UTF-8
1,264
3.75
4
[]
no_license
# # @lc app=leetcode id=161 lang=ruby # # [161] One Edit Distance # # https://leetcode.com/problems/one-edit-distance/description/ # # algorithms # Medium (32.30%) # Total Accepted: 113.2K # Total Submissions: 350.6K # Testcase Example: '"ab"\n"acb"' # # Given two strings s and t, return true if they are both one e...
true
d6e9c4542452dbacb55780f71545478ca75d793b
Ruby
bellroy/job-application
/unclear_purpose/unclear_purpose.rb
UTF-8
713
3.171875
3
[]
no_license
# Found in some inherited code, without tests. # # TODO: # Work out what this method does, # then write a test or spec to make sure you know what it does, # then refactor it such that your test or spec still passes, but the # rubyists who come after you don't have to think so hard. def group_trip_days_by_lat_l...
true
cdd0bc2aac83f88781c90ac1289faad37830a4ef
Ruby
mefellows/sitemap-generator
/lib/sitemap/filters/filters.rb
UTF-8
5,225
2.796875
3
[]
no_license
require 'sitemap/logging' require 'open-uri' require 'net/http' # Public: Various index filtering operations and classes. module Filters class Util # # Idempotently make a string a URI # def self.make_URI(uri) begin if !uri.is_a? URI uri = URI::parse(uri) end ...
true
3cfaa11d0b02bcc2a2687f2588dbadb5b12bf316
Ruby
blevy115/roll-of-the-die
/total_times.rb
UTF-8
996
3.390625
3
[]
no_license
permutation = [] combo =[] total =[] a = 1 puts "How many sides does Dice A have?" b = gets.chomp.to_i puts "How many sides does Dice B have?" c = gets.chomp.to_i n = 0 until permutation.length == b*c dice_1 = Random.rand(a..b) dice_2 = Random.rand(a..c) combo = [dice_1, dice_2] n += 1 # combo = combo.join(" ...
true
798038fdd387543f53f1d8ccd02195fa62067ec1
Ruby
renuo/ruby-katas
/spec/simple_sum_spec.rb
UTF-8
348
2.90625
3
[]
no_license
require 'spec_helper' require './src/simple/simple_sum.rb' RSpec.describe SimpleSum do subject(:kata) { described_class.new } it { expect(kata.run(1, 2)).to eq(3) } it { expect(kata.run(0, 0)).to eq(0) } it { expect(kata.run(100, 9)).to eq(109) } it { expect(kata.run(3, -3)).to eq(0) } it { expect(kata.r...
true
2173950b5fbc82acca9d7eac9be1a8d5682f8a74
Ruby
mersonff/desenvolvendome
/lib/reorder_index.rb
UTF-8
464
3.171875
3
[]
no_license
module ReorderIndex def self.reorder(array, index, n) temp = [0] * n for i in 0..n temp[index[i]] = array[i] end for i in 0..n array[i] = temp[i] index[i] = i end reorder_array = [] for i in 0..n reorder_array << array[i].to_s + " " end modified_array =...
true
656afe7bc0e1615d62fb2c5a66a1970db4ca316c
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/cs169/1130/source/8442.rb
UTF-8
465
3.0625
3
[]
no_license
words = ['Cars', 'ofr','rof', 'for', 'potatoes', 'raCs', 'four','Scar', 'creams', 'scream'] def combine_anagrams(words) anagrams = {} words.each do |w| word = [] w.each_byte do |b| word << b.chr.downcase end if anagrams[word.sort.join('')].nil? anagrams[w...
true
c88ff0c739588d5829c6cebb7184347a78697ff8
Ruby
Opaismoe/codaisseurup
/spec/models/event_spec.rb
UTF-8
3,270
2.59375
3
[]
no_license
require 'rails_helper' RSpec.describe Event, type: :model do describe "validations" do it "is invalid without a description" do event = Event.new(description: "") event.valid? expect(event.errors).to have_key(:description) end it "is invalid without a name" do event = Event.new(n...
true
4988772893910a4e8b7c982226f37ef7980fe3d5
Ruby
christianlarwood/ruby_small_problems
/1.fundamentals_exercises/easy_4/century.rb
UTF-8
1,173
4.53125
5
[]
no_license
=begin Write a method that takes a year as input and returns the century. The return value should be a string that begins with the century number, and ends with st, nd, rd, or th as appropriate for that number. New centuries begin in years that end with 01. So, the years 1901-2000 comprise the 20th century. algorithm:...
true
9b3d7b9a1ee134d806307ea4e1b784a70605e007
Ruby
tshanebuckley/D4
/word_finder.rb
UTF-8
845
3.046875
3
[]
no_license
require_relative 'graph.rb' require_relative 'node.rb' require_relative 'runner.rb' # require 'flamegraph' require 'parallel' # initialize DAG text = ARGV[0].to_s g = Graph.new(text) # find all paths paths = g.find_paths # paths.each { |x| puts(x) } # find all permutations # perms = [] # puts(paths.size) paths = paths....
true
5fb5b9640eb1df3c64b08dc6a1dbf522392143d2
Ruby
kyledrake/wrong
/test/eventually_test.rb
UTF-8
4,516
2.828125
3
[ "MIT" ]
permissive
# based on # * https://gist.github.com/1228927 # * https://github.com/pivotal/selenium/blob/master/lib/selenium/wait_for.rb # see # http://rubyforge.org/pipermail/rspec-users/2011-September/020575.html here = File.expand_path(File.dirname(__FILE__)) require "#{here}/test_helper" require "wrong/assert" require "wrong...
true
d4bf98f41abdd7ac01918a9e3fada88cd7d73a24
Ruby
pedrozath/coltrane
/lib/coltrane/theory/note.rb
UTF-8
2,689
3.28125
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Coltrane module Theory # Notes are different ways of calling pitch classes. In the context of equal # tempered scales, they're more like a conceptual subject for # matters of convention than an actual thing. # # Take for example A# and Bb. Those are different ...
true
34aac6afc20e4bd1d31bdfb74cdac5079b24c06a
Ruby
VinnieLu/phase_0_Tracks
/web_dev/sinatra_intro/app.rb
UTF-8
2,200
3.375
3
[]
no_license
# require gems require 'sinatra' require 'sqlite3' db = SQLite3::Database.new("students.db") db.results_as_hash = true # write a basic GET route # add a query parameter # GET / get '/' do "#{params[:name]} is #{params[:age]} years old." end # write a GET route with # route parameters get '/about/:person' do pers...
true
1b8330107088c6790dbfa5fb15dbf6a5e1c79c51
Ruby
twe4ked/hrdlr
/lib/player.rb
UTF-8
4,103
2.75
3
[]
no_license
class Player attr_reader :track, :x, :y, :state attr_reader :score, :high_score attr_reader :multi_coin, :coin_count, :coin_multiplier attr_reader :dino_count def initialize(track) @track = track @x = 0 @y = 0 @state = 'normal' @score = 0 @high_score = 0 @score_start = 0 @coin...
true
0e8c7638dca8ea01b6929ba2bfd597e63bcf4b4c
Ruby
mickamy/atcoder
/abc086/c/main.rb
UTF-8
907
3.71875
4
[]
no_license
#!/usr/bin/env ruby N = gets.chomp.to_i COORDINATES = [] N.times do t, x, y = gets.chomp.split.map(&:to_i) COORDINATES << { t: t, x: x, y: y } end def possible? COORDINATES.prepend({ t: 0, x: 0, y: 0 }) ans = true 1.upto(N) do |i| before = COORDINATES[i - 1] current = COORDINATES[i] dt = (befo...
true
4f22fd7ff355fa9e3e3311b351e7aa867d732ce5
Ruby
adamgriffis/7languages7days
/ruby/day2/print4.rb
UTF-8
231
3.34375
3
[]
no_license
arr = (1..16).to_a count = -1 str = "" arr.each do |num| if count < 3 count += 1 else puts str count = 0 str = "" end str += "#{num} " end puts str arr.each_slice(4) do |slice| puts slice.join(' ') end
true
91992de6e76827aebcc0b1795fd294d0d270d83d
Ruby
kenbo736/TDP007
/seminarie3/Uppgift1.rb
UTF-8
642
2.90625
3
[]
no_license
#!/usr/bin/ruby #-*- coding:utf-8 -*- class Person def initialize(ct, pn, yd, g, a) @carType = ct @postNumber = pn @yearsDriven = yd @gender = g @age = a @points = 0 end def evaluatePolicy(inputPolicy) self.instance_eval(File.read(inputPolicy)) @points += @bilmarke[@carType] ...
true
57221f6072df7f793f191f4331dbf1b4079c73d0
Ruby
LAdkins81/DojoAssignments
/Ruby/first_vagrant_box/stringer/spec/stringer_spec.rb
UTF-8
908
3.078125
3
[ "MIT" ]
permissive
require "spec_helper" RSpec.describe Stringer do # it "has a version number" do # expect(Stringer::VERSION).not_to be nil # end # # it "does something useful" do # expect(false).to eq(true) # end it "concatenates undefined number of strings with a space" do expect(Stringer.spacify "Laura", "Terr...
true
068f9d118f9ecde0f1312205ef309ff2230a1e32
Ruby
gabe-vazquez-blk/blood-oath-relations-nyc-web-051319
/app/models/cult.rb
UTF-8
955
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Cult attr_accessor :name, :location, :founding_year, :slogan, :recruit_follower, :cult_population, :followers @@all = [] def initialize(name, location, founding_year) @name = name @location = location @founding_year = founding_year @slogan = slogan @followers = [] ...
true
125fa4c4d3e15b0608e46b761a053c2406c91cfa
Ruby
flored27/oo-meowing-cat-web-100817
/lib/meowing_cat.rb
UTF-8
63
2.59375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Cat attr_accessor:name def meow puts "meow!" end end
true
d3de7c0a4c93c38f3102b71e6a7396aa9118d17e
Ruby
ParkJong-Hun/Ruby_RubyOnRails-Tutorial
/app/controllers/calculator_controller.rb
UTF-8
327
2.5625
3
[]
no_license
class CalculatorController < ApplicationController #add라는 action 만들기 def add @message = "Hello I'm information" end def result #@result = params[:first] + params[:second] -> 문자열로 됨!! @result = params[:first].to_i + params[:second].to_i #정수형 계산 end end
true
29c4f06b7e612ca240cd1ad58f5b8bb77a07a2ee
Ruby
etelan/battle
/app.rb
UTF-8
1,244
2.96875
3
[]
no_license
# in app.rb require 'sinatra/base' require_relative './lib/game' require_relative './lib/player' require_relative './lib/turn' class Battle < Sinatra::Base # Allows us to save between requests enable :sessions get '/' do erb :index end # ALERT HORRIBLE GLOBAL VARIABLE DETECTED post '/names' do ...
true
951cc15bde22f1159cd0136759a5f6199fee2124
Ruby
jordanrand1/dpl_casino
/spec/casino_manager_spec.rb
UTF-8
729
2.96875
3
[]
no_license
require 'spec_helper' require_relative '../casino_manager.rb' describe Manager do before(:each) do @manager = Manager.new end it 'prints main menu' do expected = puts "+-+-+-+-+ Welcome to the Casino +-+-+-+-+ \n 1) Check balance \n 2) List games \n 3) Exit \n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" ...
true
7178d41ad9d7acb99203c59aeb2effb2362b2197
Ruby
wlads/miq_tools
/memory_dump_analyzer/mem_analyzer.rb
UTF-8
4,181
2.984375
3
[]
no_license
require 'optparse' options = { :generation => nil, :depth => 0 } OptionParser.new do |opt| opt.banner = "Usage: #{File.basename $0} [options] DUMPFILE" opt.separator "" opt.separator "Parses the given DUMPFILE (output from ObjectSpace.dump_all)" opt.separator "and either gives the generation statisics or the...
true
3da873f4b9c801b532b253d277155efdd32d1205
Ruby
walleye819/home_automation
/run.rb
UTF-8
3,022
2.75
3
[]
no_license
load 'lib/time_zone.rb' load 'lib/lifx.rb' load 'lib/logstash.rb' load 'application.rb' require 'rest-client' require 'json' def time_delay 60 end def outside_lights ['Front', 'Deck', 'Shed', 'Backyard'] end def outside_light_colors ['red', 'green'] end def log_times @logger.log_and_puts("Current time: #{Time....
true
26a9f2193f3d427c116a102dc2a1b2f292894984
Ruby
arnabc74/arnabc74.github.io
/numana2021/interpol2.rb
UTF-8
10,847
3.296875
3
[]
no_license
<NOTE> @{ <M>\newcommand{\y}{\mathbf y} \newcommand{\bb}{\mathbf b} \newcommand{\xx}{\mathbf x} \newcommand{\PP}{\mathbf P} \newcommand{\RR}{\mathbf R}</M> <TITLE>Interpolation</TITLE> <UPDT>TUE JUN 15 IST 2021</UPDT> <HEAD1>Different representations of polynomials</HEAD1> A polynomial may be expressed in...
true
961510fa16f1759bc86877329d8bbc7576be007e
Ruby
CaptainMoe/smallProbs
/Easy3/ex03.rb
UTF-8
259
4
4
[]
no_license
def count_char(words) letter_cout = 0 words.split("").each do |let| if let != ' ' letter_cout += 1 end end letter_cout end puts "Please write word or multiple words:" words = gets.chomp puts "There are #{count_char(words)} characters"
true
d81ad4a59c0552d7c0339d3f98df630d99571f2e
Ruby
maxcfry/oyster_card
/lib/oystercard.rb
UTF-8
1,201
3.21875
3
[]
no_license
class OysterCard MAX_BALANCE = 90 MIN_BALANCE = 1 attr_reader :balance attr_reader :full # attr_accessor :in_journey attr_reader :fee attr_reader :entry_station attr_reader :exit_station attr_reader :journeys def initialize(balance = 10) @balance = balance @entry_station = nil @exit_station...
true
502c2f6a6c5f12b6c8b9397d65ae1fe9e5e6d630
Ruby
red-data-tools/red-optuna
/example/rumale-simple.rb
UTF-8
1,174
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env ruby require "datasets-numo-narray" require "optuna" require "rumale" iris = Datasets::Iris.new.to_table x = iris.to_narray(:sepal_length, :sepal_width, :petal_length, :petal_width) y = Numo::NArray[*iris.label_encode(:label)] study = Optuna::St...
true
9649a5c81f1257c1d7a4e6e2c3315ded604b40cb
Ruby
tangmae/advent_of_code_2018
/day7-1.rb
UTF-8
1,408
2.703125
3
[]
no_license
input_text = File.read("./day7-1input.txt") # input_text = File.read("./example.txt") input_arr = input_text.split("\n") direction_to = Hash.new([]) dependencies = Hash.new([]) input_arr.each do |line| token = line.split(/\s/) direction_to[token[1]] = direction_to[token[1]].nil? ? [token[7]] : direction_to[t...
true
8e57c4f331999097ff3d26ae6c397dedceeb4081
Ruby
eynaKane/HackerRankExercises
/30DaysOfCode/day_01_datatype.rb
UTF-8
713
4.25
4
[]
no_license
# https://www.hackerrank.com/challenges/30-data-types/problem require 'json' require 'stringio' i = 4 d = 4.0 s = 'HackerRank ' # Declare second integer, double, and String variables. # Read and save an integer, double, and String to your variables. i1 = gets.to_i d2 = gets.to_f s2 = gets # Print the sum of both int...
true
a2f80e03a428b437177d7a0894c74aceeb538f60
Ruby
fadendaten/six_saferpay
/lib/six_saferpay/models/redirect.rb
UTF-8
574
2.5625
3
[ "MIT" ]
permissive
module SixSaferpay class Redirect attr_accessor(:redirect_url, :payment_means_required ) def initialize(redirect_url:, payment_means_required: ) @redirect_url = redirect_url @payment_means_required = payment_means_required end def to_...
true
d95c8f96f8f8fbb5fba7ad1a879ea4f7de031c11
Ruby
ruby-dita/Duxml
/lib/duxml/doc/element.rb
UTF-8
5,146
2.59375
3
[ "MIT" ]
permissive
# Copyright (c) 2016 Freescale Semiconductor Inc. require 'ox' require File.expand_path(File.dirname(__FILE__) + '/lazy_ox') require File.expand_path(File.dirname(__FILE__) + '/node_set') require File.expand_path(File.dirname(__FILE__) + '/../reportable') module Duxml # contains actual methods of XML Element modu...
true
0b13a3bb9e13f6016ec2ebebe16d9833022d5121
Ruby
ellawren/tkwa_app
/app/models/holiday.rb
UTF-8
834
2.546875
3
[]
no_license
# == Schema Information # # Table name: holidays # # id :integer not null, primary key # date :string(255) # name :string(255) # created_at :datetime not null # updated_at :datetime not null # date_object :date # year :integer # week :integer # day ...
true
4beccc6460cfd651fc4acf6911af40997d03b984
Ruby
jcartledge/fingerpoken
/lib/fingerpoken/vnc.rb
UTF-8
1,820
2.703125
3
[]
no_license
require "rubygems" require "eventmachine-vnc" require "fingerpoken/target" class FingerPoken::Target::VNC < FingerPoken::Target attr_accessor :x attr_accessor :y attr_accessor :buttonmask def initialize(config) super(config) # TODO(sissel): eventmachine-vnc needs to suppore more auth mechanisms @u...
true
04de3eef50eded6a92263cfaa1c8cb3cba24de5d
Ruby
jaredbeck/libsmpair
/lib/smpair/person_set.rb
UTF-8
1,813
3.40625
3
[]
no_license
module PersonSet include Enumerable def each() @people.each { |p| yield p } end def empty?() @people.empty? end def initialize() @people = [] end def size() @people.length end def pretty_print puts "\nThe Field:" puts "#".ljust(4) + "id".ljust(10) + "rating".ljust(15) + "mcmahon score" @people...
true
1a0620f48ea116d583d96778150f671451a877fb
Ruby
chefvivica/ruby-project-guidelines-nyc-web-030920
/db/seeds.rb
UTF-8
1,033
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' require 'JSON' User.destroy_all Restaurant.destroy_all Reservation.destroy_all # yelp_search = RestClient.get("https://api.yelp.com/v3/businesses/search") # parsed_data = JSON.parse(yelp_search) user1 = User.create(name: "User1") user2 = User.create(name: "User2") restaurant1 = Restaurant.create(name: "r...
true
fc261b5b148d49042e398f117515bb939194db8c
Ruby
JupiterLikeThePlanet/goby
/lib/Map/Map/map.rb
UTF-8
2,294
3.5
4
[ "MIT" ]
permissive
class Map # @param [Hash] params the parameters for creating a Map. # @option params [String] :name the name. # @option params [[Tile]] :tiles the content of the map. # @option params [Couple(Int,Int)] :regen_location the respawn-on-death coordinates. ################ Added @music attribute and attr_accessor :mus...
true
0fd233ef23f3045c77339059fd768fd6944b3fdf
Ruby
charlietag/ruby-learn
/hash.rb
UTF-8
225
3.203125
3
[]
no_license
#!/usr/bin/env ruby pets = Hash.new pets["Name"] = "Charlie" puts pets["Name"] # Above equals to animals = {} # equals to animals = Hash.new animals["Name"] = "Haha" puts animals["Name"] puts "==============" puts animals
true
ae62f6aaa9566dff01673929d48257cf21826455
Ruby
tiefengeist/oo-relationships-practice-seattle-web-career-012819
/app/models/Trainer.rb
UTF-8
313
2.90625
3
[]
no_license
class Trainer attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def clients Client.all.select {|client| client.trainer == self} end def self.all @@all end def self.most_clients @@all.sort_by {|trainer| trainer.clients.size}.last end end
true
c6978ecd3f19b6aec2598649310b5442164a75a4
Ruby
drjolo/RubyLearning
/week_7/last_modified.rb
UTF-8
384
3.09375
3
[]
no_license
=begin doctest: last_modified >> f = File.open('test_mod', 'w') >> f.close >> tm = File.mtime('test_mod') >> last_modified('test_mod', 2) => 'file was last modified 0.0 days ago' >> puts last_modified('../test.rb') =end def last_modified( file, digits = 15 ) days = ( Time.now - File.mtime(file) ) / ( 60*60*24...
true
24145cc628a708a08ae0293e369516ff088476f7
Ruby
efatsi/Card-Games-on-Rails
/spec/models/game_spec.rb
UTF-8
18,115
2.625
3
[]
no_license
require 'spec_helper' describe Game do before do @game = FactoryGirl.create(:game) @user1 = FactoryGirl.create(:user, :username => "game_user1") @user2 = FactoryGirl.create(:user, :username => "game_user2") @user3 = FactoryGirl.create(:user, :username => "game_user3") @user4 = FactoryGirl.create...
true
afae133aca20a2119c76f91c504a70cd813a421f
Ruby
CodeKrakken/fizzbuzz_interview_test
/spec/fizzbuzz_spec.rb
UTF-8
491
3.109375
3
[]
no_license
require 'fizzbuzz' context 'fizzbuzz' do it('returns number 1') do expect(fizzbuzz(1)).to eq(1) end it('returns fizz for 3') do expect(fizzbuzz(3)).to eq('fizz') end it('returns number 2') do expect(fizzbuzz(2)).to eq(2) end it('returns buzz for 5') do expect(fizzbuzz(5)).to eq('buzz')...
true
21e2ef209b162f2e2de0f70a5c70ea6b19b2f2e6
Ruby
magdabm/ruby-exercises
/03/20_Calculator.rb
UTF-8
2,576
4.1875
4
[]
no_license
# Zaprojektuj i zaimplementuj klasę kalkulator tak aby zadziałał poniższy kod. W komentarzach przy każdej linijce jest opisany wynik jaki ma wypisać dana metoda pozastosowaniu na niej puts: # calculator = Calculator.new("CASIO") # puts calculator.name # prints CASIO # calculator.add(2) # calculator.add(3) # puts calcul...
true
7e1c503bfb8bf4001b94422a957caa4ab7ddd87c
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/nucleotide-count/34066b1045b94a3abf301eec09c7b8f3.rb
UTF-8
542
3.640625
4
[]
no_license
class DNA attr_accessor :nucleotide_counts NUCLEOTIDES = "ATUCG" DNA_NUCLEOTIDES = "ATCG" def initialize(dna) @dna = dna @nucleotide_counts = { 'A' => 0, 'T' => 0, 'C' => 0, 'G' => 0 } count_nucleotides end def count(nucleotide) NUCLEOTIDES.include?(nucleotide) || raise(ArgumentError) ...
true
3b7761b45edba29727a93db9c6fc5beb0d09a6df
Ruby
wassimk/cheatsets
/vim_cheatset.rb
UTF-8
10,854
2.59375
3
[]
no_license
cheatsheet do title 'Vim Cheatset' # Will be displayed by Dash in the docset list docset_file_name 'vim' # Used for the filename of the docset keyword 'vimcs' # Used as the initial search keyword (listed in Preferences > Docsets) # resources 'resources_dir' # An optional resources folder which can contain imag...
true
9474214f37d560cd35761d5e3fc97b353d2ad403
Ruby
mathilde-prog/Hashiwokakero
/src/PartiePuzzleRush.rb
UTF-8
15,547
2.859375
3
[]
no_license
# # # # # # # # # # # # # # # # Auteur : Marie-Nina MUNAR # # # # # # # # # # # # # # # # require_relative('Case') require_relative('Ile') require_relative('Pont') require_relative('Aide') require_relative('Conseil') require "active_record" require 'sqlite3' require 'gtk3' require_relative('./Interface/Timer') requir...
true
8dec5434c46f7d8739915e774500d6987e244764
Ruby
aliceloudon/YogaClan_project1
/models/pose_sequence.rb
UTF-8
1,935
3.265625
3
[]
no_license
require_relative('../db/sql_runner.rb') require_relative('../models/sequence.rb') class PoseSequence attr_reader :id attr_accessor :pose_id, :sequence_id def initialize(options) @id = options['id'].to_i @pose_id = options['pose_id'].to_i @sequence_id = options['sequence_id'].to_i end def save ...
true
ac8edb75ed3a4d4c37f68a1eb851e8562fac9e81
Ruby
deepigarg/rubyx
/lib/arm/instructions/stack_instruction.rb
UTF-8
1,804
2.859375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Arm # ADDRESSING MODE 4 class StackInstruction < Instruction def initialize(first , attributes) super(nil) @attributes = attributes @first = first @attributes[:update_status] = 0 if @attributes[:update_status] == nil @attributes[:condition_code] = :al if @attributes[:condi...
true
2a03e942c2557ce4fda0db2615f1bcf9eed927ac
Ruby
saibabanadh/ash
/lib/ash/person.rb
UTF-8
421
3.03125
3
[ "MIT" ]
permissive
module Ash class Person # TODO move to config CUSTOM_INITIALS = { 'Mark Dodwell' => 'mk' } attr_reader :name, :id def initialize(id, name) @id = id @name = name end def initials if CUSTOM_INITIALS[name] CUSTOM_INITIALS[name] else letters = name.split(/...
true
64b92538c99e818c375eedb951f3e8a42572b32b
Ruby
rachelkathleen/programming_languages-online-web-prework
/programming_languages.rb
UTF-8
286
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reformat_languages(languages) solution_hash = {} languages.each do |type, hash| hash.each do |name, string_value| solution_hash[name] ||= string_value solution_hash[name][:style] ||= [] solution_hash[name][:style] << type end end solution_hash end
true
604f8c1e75c8d00753ee5b676414e0bdf6de51f1
Ruby
caalberts/algorithmic-toolbox
/week2/fibonacci_sum_spec.rb
UTF-8
544
3.09375
3
[]
no_license
require "./fibonacci_sum" describe "#fibonacci_sum" do it "should return the last digit of sum of the first n Fibonacci numbers" do expect(fibonacci_sum(0)).to be(0) expect(fibonacci_sum(1)).to be(1) expect(fibonacci_sum(2)).to be(2) expect(fibonacci_sum(3)).to be(4) expect(fibonacci_sum(4)).to b...
true
819e44c1e74d12250df90a538a226726a911957e
Ruby
nubs/euler
/069-phi-totient.rb
UTF-8
776
3.5625
4
[]
no_license
#class Integer # def primefactors # (2..Math.sqrt(self).floor).to_a.select {|i| (self%i).zero? && i.prime? } # end # # def totient # (primefactors.collect {|i| 1-1.0/i }.inject(1) {|prod,i| prod*i }*self).to_i # end # # def prime? # return true if self == 2 # return false if (self%2).zero? # (3..Math.sqrt(self).fl...
true
9987722eeb01f39cb01eddc56f76cfeb7e1a795b
Ruby
bexodim/MultiplicationTable
/multiplier.rb
UTF-8
2,189
4.125
4
[]
no_license
class Multiplier attr_reader :n attr_reader :primes attr_reader :table def initialize(n = 10) @n = n if @n < 1 @primes = [] $stdout.write "You have chosen to multiply less than one prime number." else @primes = [2] end @tabl...
true
f7d5ab8fea0ff991ce4ccf5bb324d8ce0bb0e687
Ruby
jrdowns/Learning
/Ch5/betterNumber.rb
UTF-8
183
3.6875
4
[]
no_license
puts 'What is your favorite number?' fav_number = gets.chomp better_number = fav_number.to_i + 1 puts 'Perhaps you would prefer ' + better_number.to_s + ' as your favorite number.'
true
7835395215483fe554af8fac1e79e4a54176edc2
Ruby
jairodiaz/pronet
/spec/views/programmers_spec.rb
UTF-8
1,183
2.8125
3
[]
no_license
require './spec/spec_helper' require './programmer' require './views/programmers' describe Programmers do it 'will render an empty set of programmers' do Programmers.new([]).render.should == '0 rows in set' end it 'will render a single programmer in a table' do programmers = [Programmer.new('fred', ['J...
true
eaca0015978c51a082db299f77dbaae6a65b5efc
Ruby
aaronwtan/RB101
/small_problems/medium1/q3.rb
UTF-8
1,730
4.875
5
[]
no_license
# If you take a number like 735291, and rotate it to the left, you get 352917. # If you now keep the first digit fixed in place, and rotate the remaining digits, # you get 329175. Keep the first 2 digits fixed in place and rotate again to 321759. # Keep the first 3 digits fixed in place and rotate again to get 321597. ...
true
b5d39812344549efaf2fb2a2a9b6425bf1b837ce
Ruby
Kay-Lander/ruby_august_2017
/keith_sanders/OOP/human.rb
UTF-8
715
3.9375
4
[]
no_license
class Human attr_accessor :name, :str, :intel, :stl, :hp def initialize name @name = name @str = 3 @intel = 3 @stl = 3 @hp = 100 end def attack alien, caus if alien.class.ancestors.include? Human p "#{@name}: You attack #{alien.name} fo...
true
ab3138ec12c3413d2b36497661c49ad406ab0a41
Ruby
amyanne/newletter.rb
/newsletter.rb
UTF-8
5,549
3.234375
3
[]
no_license
# newsletter.rb # Generates this week's newsletter # Use: # $ ruby newsletter.rb ######################### # Data for the newsletter ######################### require 'pry' CAMPUS = { name: "Springfield", address: "171 Maple St, Springfield, MA 01105", } DATE = "Jun 13, 2019" SUBSCRIBERS = ["rhona@...
true
fb859506d5d6b42f7b65bb2cf8b702e94b174c7b
Ruby
infovore/ghostme
/app/models/venue_mirrorer.rb
UTF-8
972
2.84375
3
[]
no_license
class VenueMirrorer def self.mirror_venue_for_checkin(checkin) # build a Foursquare object foursquare = GhostClient.foursquare_client(checkin.user.access_token) # get the relative latlng of this checkin # add them to the user's offset_latlng to get the search terms new_lat = checkin.user.offset_l...
true
1939abd4ae666861e1a72958d426075278c64fe0
Ruby
ChristopherDurand/Exercises
/ruby/small-problems/medium1/e06.rb
UTF-8
1,455
3.765625
4
[ "MIT" ]
permissive
INVALID_TOKEN = "IT" END_OF_STACK = "EOS" def validate(register, stack, &operator) if stack.empty? END_OF_STACK elsif operator operator.call(register,stack.pop) else stack.pop end end def errors(register) if register == END_OF_STACK puts "ERROR: END OF STACK REACHED" true elsif registe...
true
f640ad7c821c333779e6d65ec33910c2aca8abee
Ruby
samui13/rc2010s
/scenes/game/character/lib/keplerian/sinwave.rb
UTF-8
155
3.125
3
[ "MIT" ]
permissive
class SinWave < EnemyGun def initialize(x,y) @car=0 super(x,y) end def move() @x-=5 @y+=50*sin(@car) @car +=10 super() end end
true
b76f2de3ce11100c9726f03be431fc66cbac1194
Ruby
AlexVPopov/exercism-ruby
/space-age/space_age.rb
UTF-8
885
3.015625
3
[]
no_license
# frozen_string_literal class SpaceAge SECONDS_IN_YEAR = 365.25 * 24 * 60 * 60 ORBITAL_PERIODS = { mercury: 0.2408467, venus: 0.61519726, earth: 1, mars: 1.8808158, jupiter: 11.862615, saturn: 29.447498, ...
true
8c8b07b8613a761cebc838ca29dfba36055f3ecb
Ruby
tpasqual1/ruby
/d01bkp/ex00/var.rb
UTF-8
364
3.34375
3
[]
no_license
#!/user/bin/env ruby -w def my_var puts "mes variables : " a = 10 puts (" a contient : #{a} et est de type: #{a.class}" ) b = "10" puts (" b contient : #{b} et est de type: #{b.class}" ) c = nil puts (" c contient : nil et est de type: #{c.class}" ) d = 10.0 puts (" d contient : #{d...
true
ae4ecf7df9b849c398ec826dcde75b99a937df41
Ruby
janjindra/W4D1homework
/models/play.rb
UTF-8
1,093
3.15625
3
[]
no_license
class Play def Play.rock_computer_choice random = ["rock", "scissors", "paper"].sample if random == "rock" return "Draw! You both played rock" elsif random == "scissors" return "You won! The computer played #{random} this time. Well done!" else "The computer played #{random}. Sorry...
true
2187835a0fa445e5853e2ae730113116c362a1f8
Ruby
learn-co-curriculum/chicago-se-120720
/intro-to-testing/intro-tdd/spec/hero_spec.rb
UTF-8
1,821
3.34375
3
[]
no_license
describe Hero do subject(:hero) { Hero.new([ { name: "Super Strength", coolness: 3 }, { name:"Flight", coolness: 5 }, { name: "Lightning Blast", coolness: 10 } ]) } describe "#coolest_ability" do let(:co...
true
34487194906dd43c1631c6b7971791677c0ba68f
Ruby
charliepatronr/programming-univbasics-nds-nested-arrays-iteration-lab-part-3-chi01-seng-ft-080320
/lib/iteration_with_loops.rb
UTF-8
374
3.40625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def join_nested_strings(src) new_arr =[] i = 0 while i < src.length do j = 0 while j < src[i].length do if (src[i][j].is_a? String) new_arr.push(src[i][j]) end j +=1 end i +=1 end new_arr.join(' ') end join_nested_strings([ ["The", 4, "quick"], [-1, "...
true
7cd3189a6556adf6d8ffe16fe04c835908c82eb7
Ruby
southpawgeek/perlweeklychallenge-club
/challenge-189/roger-bell-west/ruby/ch-2.rb
UTF-8
987
3.234375
3
[]
no_license
#! /usr/bin/ruby require 'test/unit' def arraydegree(a) f = Hash.new(0) a.each do |x| f[x] += 1 end degree = f.values.max inverse = Hash.new() a.each_with_index do |x, i| if !inverse.has_key?(x) then inverse[x] = [] end inverse[x].push(i) end minlen = 1 + a.length se = [0, 1] ...
true
07b51653aea352fab5878efe2c572185c84df0c0
Ruby
iSapozhnik/RubyCrawler
/lib/spider.rb
UTF-8
475
2.53125
3
[ "MIT" ]
permissive
require 'rubygems' require 'nokogiri' require 'open-uri' class Spider def load_data(url) @url = url end end page = Nokogiri::HTML(open(LIST_URL)) rows = page.css('div.mw-content-ltr table.wikitable tr') rows[1..-2].each do |row| hrefs = row.css("td a").map{ |a| a['href'] if a['href'] =~ /^\/wiki\// }...
true
05dc919113e7ab87a5f969442ad63adad3a66e7a
Ruby
edwardtang12/Rails-Blog
/db/seeds.rb
UTF-8
4,461
2.765625
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
0294700462637ce93bc0d33f3de04bed1d889990
Ruby
tylermarshal/chefs_haven
/app/models/recipe.rb
UTF-8
363
3
3
[]
no_license
class Recipe attr_reader :name, :url, :yield, :calories, :ingredients def initialize(recipe) @name = recipe[:recipe][:label] @url = recipe[:recipe][:url] @yield = recipe[:recipe][:yield] @calories = recipe[:recipe][:calories].to_i @ingredients = recipe[:recipe][:ingredientLines].map {|ingredie...
true
b15c532d935720d37156afaa6f7de4949262e979
Ruby
mikeappell/ruby2d
/tests/testcard.rb
UTF-8
3,320
3.125
3
[ "MIT" ]
permissive
require 'ruby2d' set width: 700, height: 500, title: "Ruby 2D – Testcard" # Read window attributes puts " === Window Attributes === Title: #{get :title} Width: #{get :width} Height: #{get :height} FPS: #{get :fps} Self: #{get :window}\n\n" # Primary colors Rectangle.new(0, 0, 50, 100, [1.0, 0, 0, 1.0]) Rect...
true
e624afb98c23581483eeedc7270029e0af133747
Ruby
LootCrate/acls
/lib/acls/tree.rb
UTF-8
1,037
3.25
3
[ "MIT" ]
permissive
module ACLS class Tree attr_accessor :name, :directory, :source, :parent, :children def initialize(parent, name, directory, source=nil) @parent = parent @name = name @directory = directory @source = source @children = [] end def make_child(name, directory, source=nil) ...
true
c44ca36aa479a0d99f341ec848ca85a2bd3d8a41
Ruby
practicingprogramming/projecteuler
/sieve.rb
UTF-8
316
3.703125
4
[]
no_license
def get_primes(max_value) is_prime = Array.new(max_value + 1).fill(true) is_prime[0] = false is_prime[1] = false primes = [] (2..max_value).each do |i| next if !is_prime[i] primes << i cur = 2 * i while cur <= max_value is_prime[cur] = false cur += i end end primes end
true
264e0c71816c4d1caa9e657495fa98c35235c88e
Ruby
longicorn/rdb_csv
/lib/rdb_csv/reader.rb
UTF-8
1,529
3.0625
3
[ "MIT" ]
permissive
module RdbCSVReader class Reader def initialize(fp, db, delimiter, options) @fp = fp @db = db @delimiter = delimiter @escape = options[:escape] || "\\" # 1 char @linefeed = options[:linefeed] || "\n" @quote = options[:quote] || '"' end def each_line str = '' ...
true
b2ae6e7663280e52d3c806f840e35f9ff3d50901
Ruby
SarpongAbasimi/CodeWarsRuby
/8kyu/TwotoOne.rb
UTF-8
422
3.34375
3
[]
no_license
#DoesNot return all #This could be a Kata where elements would have to appear once def longest(a1, a2) finalArray=[] mydict=Hash.new myarray=a1.concat(a2).split("") myarray.each do |elm| mydict[elm]=0 end mydict.select do |key,value| finalArray << key end return finalArray.sort!.join('') end p...
true
59adba73d4250dcbda9f05e79b5bd18f1157226c
Ruby
gsdu8g9/nanoc
/test/base/test_memoization.rb
UTF-8
1,117
2.90625
3
[ "MIT" ]
permissive
require 'helper' class Nanoc::Int::MemoizationTest < Nanoc::TestCase class Sample1 extend Nanoc::Int::Memoization def initialize(value) @value = value end def run(n) @value * 10 + n end memoize :run end class Sample2 extend Nanoc::Int::Memoization def initialize(va...
true
3f4420889b8e682a97757a15a3c305de9fe33f4e
Ruby
fyafighter/vines
/lib/vines/xmpp_server.rb
UTF-8
509
2.515625
3
[ "MIT" ]
permissive
module Vines # The main starting point for the XMPP server process. Starts the # EventMachine processing loop and registers the XMPP protocol handler # with the ports defined in the server configuration file. class XmppServer include Vines::Log def initialize(config) @config = Vines::Config.new(...
true
32239594b6be3ee0c777bf2ec5d9fba2fb81a61d
Ruby
AJFaraday/Ants-in-a-Maze
/dumb-ants.rb
UTF-8
881
2.9375
3
[]
no_license
class DumbAnt < Ant # both expect a single array, column, and row e.g. [0,0] def move(iteration=0) return if stop_if_finished(iteration) options = GridArray.current.options_from(position[0],position[1]) next_pos = options[rand(options.length)] set_position next_pos[0], next_pos[1] end def s...
true
ae2cdf31b67e9f731df678893f51fad9306b6790
Ruby
hugoo93/desafio_hashes_y_apis_ruby
/busqueda.rb
UTF-8
536
3.046875
3
[]
no_license
monto = ARGV.map(&:to_i) ventas = { Enero: 15000, Febrero: 22000, Marzo: 12000, Abril: 17000, Mayo: 81000, Junio: 13000, Julio: 21000, Agosto: 41200, Septiembre: 25000, Octubre: 21500, Noviembre: 91000, Diciembre: 23000 } monto.each do |i| puts ventas.invert[i] ? ve...
true
a013f3658e09411781222df6a1d67e4c4c60983f
Ruby
pneuman/canvasanim
/encode.rb
UTF-8
7,963
3
3
[]
no_license
#!/usr/bin/env ruby require "fileutils" require "pathname" require "rubygems" require "chunky_png" require "json" BLOCK_SIZE = 8 # how different a block has to be before it's considered different # 0 means lossless # a value of 0 kicks in a slightly faster algorithm $diff_threshold = 0 def to_b64(i) v = nil ...
true
3f30c592c9227ad46751661d3ff4b4034a40b82f
Ruby
yoshoku/hanny
/lib/hanny/lsh_index.rb
UTF-8
9,129
3.015625
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
# frozen_string_literal: true module Hanny # LSHIndex is a class that builds a search index with Locality Sensitive Hashing (LSH) [1]. # It is known that if the code length is sufficiently long (ex. greater than 128-bit), # LSH can obtain higher search performance than many popular hashing methods [2]. # In se...
true
6072a52bfe49e39a78ab2505c4fe0c2318ba1ddb
Ruby
ianderse/idea_box_sinatra
/lib/idea_box/idea_store.rb
UTF-8
1,851
2.875
3
[]
no_license
require 'yaml/store' require_relative 'idea' class IdeaStore def self.all_groups groups = [] raw_groups.each do |data| groups << data end end def self.raw_groups group_database.transaction do |db| db['groups'] || [] end end def self.group_database return @group_database if @group_data...
true
3bc4c811ebceb37e11ae96771fe4c862fb316ec0
Ruby
kmayer/gas-blender
/lib/gas-blender/fill.rb
UTF-8
1,856
2.84375
3
[ "MIT" ]
permissive
module GasBlender class Fill attr_reader :mix attr_reader :tank attr_reader :fill_mix attr_reader :top_off_mix def initialize(attributes) @mix = attributes.delete(:mix) || Mix.new(0.21) @tank = attributes.delete(:tank) @fill_mix = attributes.delete(:fill_mix) || Mix.new(1.0) ...
true
5d6ea76476f2e0ec17351a1e5befe33e9d16b0e1
Ruby
samstickland/disposable
/test/skip_getter_test.rb
UTF-8
2,454
3.0625
3
[ "MIT" ]
permissive
require "test_helper" class SkipGetterTest < MiniTest::Spec Album = Struct.new(:title, :artist) Artist = Struct.new(:name) class AlbumTwin < Disposable::Twin feature Sync feature Sync::SkipGetter property :title property :artist do property :name def name super.upcase ...
true
1f5cb32ece3cc39c52b0f3ef4258ad78f8db5381
Ruby
sa3036/powerstation
/powerstation/IDE_plugin/out/production/resources/static-analyzer/view2rb/main.rb
UTF-8
2,280
2.609375
3
[ "BSD-2-Clause" ]
permissive
require 'optparse' require 'pathname' require 'find' require 'yard' def os_walk(dir) root = Pathname(dir) files, dirs = [], [] puts "#{root}" Pathname(root).find do |path| unless path == root dirs << path if path.directory? files << path if path.file? end end [root, files, dirs] end d...
true
70f4f61d1e3e74c8d774ae78b8a8982c6ca04bf8
Ruby
talihomz/Exercism-Challenges
/ruby/roman-numerals/roman_numerals.rb
UTF-8
1,375
3.671875
4
[]
no_license
class Fixnum ROMAN_NUMERALS = { 1 => { # length 1 1 => 'I', 4 => 'IV', 5 => 'V', 9 => 'IX' }, 2 => { # length 2 1 => 'X', 4 => 'XL', 5 => 'L', 9 => 'XC' }, 3 => { # length 3 1 => 'C', 4 => 'CD', 5 => 'D', 9 => 'CM' }, ...
true
c0afbbc3e50c50e3598ecd6cd540da8b8f0925ed
Ruby
cfritsch5/app_academy_work
/algorithms/casey_fritsch_algos6/lib/install_order.rb
UTF-8
668
3.53125
4
[]
no_license
# Given an Array of tuples, where tuple[0] represents a package id, # and tuple[1] represents its dependency, determine the order in which # the packages should be installed. Only packages that have dependencies # will be listed, but all packages from 1..max_id exist. # N.B. this is how `npm` works. # Import any file...
true
8e9edf02b0a308676f86a94187c84b07a1d9be53
Ruby
inertia186/radiator
/lib/radiator/stream.rb
UTF-8
16,577
2.578125
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
module Radiator # Radiator::Stream allows a live view of the STEEM blockchain. # # All values returned by `get_dynamic_global_properties` can be streamed. # # For example, if you want to know which witness is currently signing blocks, # use the following: # # stream = Radiator::Stream.new # str...
true
f1a8cac5765f405f671244a95691ae1803ba55f8
Ruby
amco/dolla
/lib/dolla/payment_slip/due_date.rb
UTF-8
729
2.8125
3
[ "MIT" ]
permissive
module Dolla module PaymentSlip class DueDate extend Forwardable PAYSLIP_EPOCH_YEAR = 2014 PAYSLIP_YEAR_MUTATOR = 372 PAYSLIP_MONTH_MUTATOR = 31 def_delegators :@due_date, :year, :month, :day def initialize due_date @due_date = due_date end # TODO: h...
true
14eed8c4be68cdde2ddfd5a2063f2fba79ba8467
Ruby
RuiTTTT/ruby-itunes
/reader.rb
UTF-8
2,011
3.34375
3
[]
no_license
#!/usr/bin/ruby -w # READER # Copyright Mark Keane, All Rights Reserved, 2014 # Class that reads in things from different files. class Reader # method to read in songs from the songs.csv file. # returns an array of song objects. def read_in_songs(csv_file_name) songs = [] ids = [] CSV.foreach(csv_f...
true
a32c7767969c5c821b40f3325336518fb9c72c06
Ruby
mazherahmad/depotapp
/test/models/product_test.rb
UTF-8
503
2.515625
3
[]
no_license
require 'test_helper' class ProductTest < ActiveSupport::TestCase test "product price must be positive" do product = Product.new(title: "My Book Title", description: "yyy", image_url: "zzz.jpg") product.price = -1 assert product.invalid? assert_equal ["must be greater than or equal to 0.01"], product.errors[:...
true
38b3a3bc2f3a591b6493f51f89587813e82d1672
Ruby
thestrabusiness/record-deduper
/app/models/user.rb
UTF-8
766
3.140625
3
[]
no_license
class User attr_reader :first_name, :last_name, :company, :email, :address1, :address2, :zip, :city, :state_long, :state, :phone def initialize(args) @first_name = args[:first_name] @last_name = args[:last_name] @company = args[:company] @email = args[:email] @address1 = args[:add...
true