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
adbf79d612d7b034812b151fce14a987b43478f7
Ruby
Crystalnix/testflight-boarding
/boarding_service.rb
UTF-8
1,563
2.625
3
[]
no_license
require 'spaceship' class BoardingService attr_accessor :app attr_accessor :tester_group_name def initialize Spaceship::Tunes.login(ENV['FASTLANE_USER'], @password = ENV['FASTLANE_PASSWORD']).select_team @app = Spaceship::Tunes::Application.find(ENV['ITC_APP_ID']) init_tester_group(ENV['ITC_APP_T...
true
26aad92c86a3d3e5d827e9e92098a4bb031312de
Ruby
judithhinlung/Chess
/lib/node.rb
UTF-8
356
3.078125
3
[ "MIT" ]
permissive
# Linked lists used to construct the paths of slidersclass Node class Node attr_accessor :x, :y, :next_node, :moves def initialize(x, y, next_node=nil, distance=0, moves=[]) @x = x @y = y @next_node = next_node @moves = moves end def equal?(node) return true if self.x == node.x && self.y =...
true
694b6f1479b050a81d946416565f4ec5dafd91a9
Ruby
wrpaape/todo-csv
/lib/todo.rb
UTF-8
3,404
4
4
[]
no_license
require 'csv' class Todo def initialize(file_name) @file_name = file_name # You will need to read from your CSV here and assign them to the @todos variable. make sure headers are set to true @todos = CSV.read(@file_name, headers: true) end def start loop do system('clear') puts "--...
true
b0747b1ed00fa83574751fd79d0789e326c88d4f
Ruby
simonrobson/little-mapper
/test/integration/helper.rb
UTF-8
2,071
2.90625
3
[ "MIT" ]
permissive
class Person < OpenStruct attr_accessor :phone_numbers def initialize(*args) super @cats = [] @phone_numbers = [] end def receive_cat(cat) @cats << cat end def all_cats @cats end end class PhoneNumber attr_accessor :id, :code, :number, :person def initialize(opts = {}) opts...
true
e725fbbce86aa37e249aa6167dd87e0a972d07d0
Ruby
gatperdut/chatomud
/app/lib/chato_mud/controllers/items/liquid_fuel_req_controller.rb
UTF-8
449
2.515625
3
[]
no_license
module ChatoMud module Controllers module Items class LiquidFuelReqController def initialize(server, light_source_controller, liquid_fuel_req) @server = server @light_source_controller = light_source_controller @liquid_fuel_req = liquid_fuel_req end ...
true
87e8f6fe91237a1a3488b559bde975f9db60c039
Ruby
KaelinAlexander/kaelin-cli-project
/lib/scraper.rb
UTF-8
761
2.984375
3
[ "MIT" ]
permissive
class GetParks attr_accessor :parkset, :location def initialize(location) @location = location self.parks_by_state end def get_parks uri = URI.parse("https://developer.nps.gov/api/v1/parks?stateCode=#{@location}&api_key=MoMOpUwdmOP1d9ZbR8P2NyDm4746f3ewpweDR7R5") response = Net::HTTP.get_response...
true
5998fe6dd958c6a03cd529a4750382059da0798d
Ruby
jronallo/djatoka
/lib/djatoka/view_helpers.rb
UTF-8
5,799
2.53125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Djatoka # = Djatoka view helpers # # These methods accept an rft_id (identifier) that a Djatoka resolver knows # about and params. Params can include both parameters for a Djatoka query # and params for image_tag. All parameters will be passed on to image_tag allowing # setting of attributes like th...
true
364b272ea4687129b210dbe1af4c4a82a9bdb5cc
Ruby
brianwlego/ruby-oo-practice-relationships-domains-nyc01-seng-ft-071320
/app/models/crowdfunding/user.rb
UTF-8
620
2.75
3
[]
no_license
class User attr_accessor :name @@all = [] def initialize(name) @name = name User.all << self end def self.all @@all end def new_project(name, amount_goal) Project.new(name, amount_goal, self) end def new_pledge(name, amount, project) Pledge.new(name, amount, project, self) end...
true
a0c7f5e09d0f49f8314459d0e54438d26c8af8a4
Ruby
rparkerson/launch-school
/RB100/ruby_basics/debugging/9.rb
UTF-8
782
4.21875
4
[]
no_license
# Given a String of digits, our digit_product method should return the # product of all digits in the String argument. You've been asked to # implement this method without using reduce or inject. # When testing the method, you are surprised by a return value of 0. # What's wrong with this code and how can you fix i...
true
3bfd7a3b9b4f1fec3b51040a51c99752444a2679
Ruby
josereyesjrz/Code2040TA
/step4.rb
UTF-8
1,085
2.78125
3
[ "MIT" ]
permissive
require 'net/http' require 'uri' require 'json' uri = URI('http://challenge.code2040.org/api/prefix') # Parse challenge URI request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') # Create request request.body = {token: '641d2efd555c4fd6426096e66b040e8d'}.to_json # JSON on body with token response =...
true
7ba29d00b8864f476dd5aedb52400d220c453251
Ruby
appi123dk/neoulpum_test
/app/models/account.rb
UTF-8
522
2.859375
3
[]
no_license
class Account < ActiveRecord::Base validates :account_date, uniqueness: true # 오늘의 수입을 출력하는 함수 def self.today_revenue orders revenue = 0 orders.each do |order| menu = Menu.find(order.menu_id) revenue += order.order_unit * menu.menu_price end return revenue end # 오늘의 비용을 출력하는 함수 def self.today_cost...
true
a5c50c321b34c9aea97e026977e6362e43841686
Ruby
gauravm31/gaurav
/questions/q2.rb
UTF-8
734
3.21875
3
[]
no_license
# Before Action && After Action module BeforeMethod def before(array, hash) @@array = array @@hash = hash @@check = true def method_added method if(@@check) @@check = false if(@@array.include?(method.to_sym)) old = instance_method(method) define_method meth...
true
8e5f3d98c6aeeb8aafe1ca51693aeee66b973a10
Ruby
rajkumarra/Ruby
/lib.rb
UTF-8
197
2.640625
3
[]
no_license
class Library def initialize (name , register_no , time , date) @name = name @register_no = register_no @time = time @date = date end end l1 = Library.new('Raj' , 2545, 1-10 , 10-2-2020) p l1
true
7b29cdc556ef622f8c00c2ab9afb4d99f77c57ec
Ruby
railsfactory-ushaa/mp1
/delete_file/delete_file.rb
UTF-8
177
3.1875
3
[]
no_license
puts "Enter the name of file you wish to delete" file_name = gets.chomp status = File.delete(file_name) if status == 0 puts "#{file_name} file deleted successfully." end
true
caae5b20aef654d7c206bf69a51c9008cc096bb2
Ruby
gguuss/gplus-photohunt-server-ruby
/app/controllers/users_controller.rb
UTF-8
953
2.546875
3
[]
no_license
# Provides an API for retrieving the currently logged in user. This controller # provides the /api/users end-point, and exposes the following operations: # # GET /api/users # # Author:: samstern@google.com (Sam Stern) # class UsersController < ApplicationController # Throw 401 User Unauthorized error if a non-auth...
true
d3b62e2ae9e3160ecbd6d66a5fcb21fc8a7c1c99
Ruby
nick1123/seonews
/app/models/html_extractor.rb
UTF-8
141
2.5625
3
[]
no_license
class HtmlExtractor def title(html_content) html_content.scan(/<title>(.*?)</im).flatten[0].to_s.gsub(/\s+/, ' ').to_s.strip end end
true
a46df024388eb77c3c875911ba6b3cff2d282285
Ruby
schazbot/ruby-intro-to-arrays-lab-london-web-career-021819
/lib/intro_to_arrays.rb
UTF-8
631
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def instantiate_new_array my_new_array= Array.new end def array_with_two_elements my_two_array = Array.new(2, true) end #first_element def first_element(taylor_swift) taylor_swift[0] end #third_element def third_element(taylor_swift) taylor_swift[2] end #last_element def last_element(taylor_swift) taylor_s...
true
47857026f2fe1c7975da57309e443add026053c3
Ruby
Arasiga/Contact_List
/contact.rb
UTF-8
1,613
3.71875
4
[]
no_license
require_relative 'contact_list' require 'colorize' require 'pry' require 'csv' class ContactList def self.options(input) if input[0] == "list" Contact.all.each_with_index do |x, index| puts "#{index+1}: #{x[0]}, #{x[1]}" end elsif input[0] == "menu" puts "Here is a list of availa...
true
369614171a6b7a9ae1e851f83b6faecfdf4ef2cc
Ruby
densuper97/Actor
/lib/modules/observable.rb
UTF-8
322
3.03125
3
[]
no_license
module Observable def initialize @observers = [] end def add_observer(observer) @observers << observer unless @observers.include?(observer) end def delete_observer(observer) @observers.delete(observer) end def notify_observers @observers.each {|x| x.get_notification(self)} end e...
true
5af21ef44d9a8faa2ccec8aa52bdba6a37442161
Ruby
Gerhardk/Mosaic
/main.rb
UTF-8
871
2.765625
3
[]
no_license
require "./slice_input_image.rb" require "./calc_avg_rgb.rb" require "./converter.rb" panda = Image.read("InputImages/panda-4k.jpg").first slice_image(panda, 20) rgb_values_for_replacement_images = avg_rgb_for_folder("TileReplacementImages") tile_images = Dir.glob("InputTileImages/*.jpg").sort.map do |filename| im...
true
2e211ecb54c30f19566e2c31e3432f9523838df3
Ruby
murakamit/rsvcal
/app/controllers/items_controller.rb
UTF-8
1,606
2.5625
3
[ "MIT" ]
permissive
class ItemsController < ApplicationController include ReservationsWeeklies def index @page_title = "Items" end def prop id = params[:id] @item = Item.find id @page_title = @item.name rescue redirect_to items_index_path, alert: "No such item(##{id})" end def year_month id = param...
true
3d2d2618622013aa0770d282e75987a9dbdeb40e
Ruby
faloi/algoritmos-tp-knapsack
/lib/knapsack/item.rb
UTF-8
472
3.28125
3
[]
no_license
class Knapsack::Item attr_reader :number, :gain, :weight def initialize(number, gain, weight) @number = number @gain = gain @weight = weight end def rate gain.to_f / weight.to_f end def to_s (state + [rate]).to_s end def inspect to_s end def ==(other) other.class == ...
true
c338f6839bdd4f63e405b541ab2f525f31521fe0
Ruby
AdamPrusse/Coding-Exercises
/E14_comment_converter.rb
UTF-8
757
3.1875
3
[]
no_license
require 'rspec' module RubyContent refine String do def commentize "# #{self}" end end end module HtmlContent refine String do def commentize "<!-- #{self} -->" end end end class ContentController using RubyContent def initialize(word) @word = word end def hidden_content @word.commentize ...
true
3543d47011557c4dcc08ac31eb0bf4c373ba0c5b
Ruby
gcao/aspect4r
/spec/aspect4r_spec.rb
UTF-8
6,714
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Mixing regular expressions and string" do it "should work" do @klass = Class.new do include Aspect4r before /do_/, "test" do @value << "before" end attr :value def initialize ...
true
e79adc8976895c846a9dcd191db6fe22f7b2f829
Ruby
InternationalTradeAdministration/csl-search-legacy
/ccg/Rakefile
UTF-8
1,493
2.703125
3
[]
no_license
require 'yaml' require 'nokogiri' require 'pry' namespace :ccg do desc 'Generate markdown files from source.' task :generate do Dir["source/**/*.yaml"].each do |yaml_file| yaml_hash = YAML.load_file(yaml_file) parse_yaml(yaml_hash) clear_output_directory write_posts_files end end ...
true
59c0fe58c134fbd58bb00fed7deb9d1ab7a8aaca
Ruby
W-Sarah/learn_to_program
/chapter_9.rb
UTF-8
787
4.03125
4
[]
no_license
#old school roman numerals def old_roman_numeral(number) mille = number / 1000 if mille >= 1 m = "M" * mille number = number % 1000 else m = "" end five_hundred = number / 500 if five_hundred >= 1 d = "D" * five_hundred number = number % 500 else d = "" end hundred = number / 100...
true
943b9c67c665e3320b569006b9c8c63ecd523f9b
Ruby
clairespills/kwk-l1-flowchart-project-template-kwk-students-l1-min-072318
/app/models/quize.rb
UTF-8
773
2.984375
3
[]
no_license
def quiz(style_value) if style_value < 3 "vintage $" elsif style_value < 4 "vintage $$" elsif style_value < 5 "vintage $$$" elsif style_value < 6 "girly $" elsif style_value < 7 "girly $$" elsif style_value < 8 "girly $$$" elsif style_value < 9 "sporty $" elsif style_value < ...
true
e22544f47ff94d0d9b5bdf933e59f5176a34b49c
Ruby
SmileBack/whowentout
/mrcontacts/lib/directory_importer.rb
UTF-8
1,696
2.625
3
[]
no_license
class DirectoryImporter include EventPublisher event :on_skip_query event :on_save_students event :on_save_student event :on_skip_student def initialize(dir) @dir = dir end def import(query) if query_exists?(query) trigger :on_skip_query, query return nil end...
true
51c9767cbef6babc15883228d399aeeb0231f20f
Ruby
thomthom/solid-inspector
/src/tt_solid_inspector2/gl/label.rb
UTF-8
2,514
2.546875
3
[ "MIT" ]
permissive
#------------------------------------------------------------------------------- # # Thomas Thomassen # thomas[at]thomthom[dot]net # #------------------------------------------------------------------------------- module TT::Plugins::SolidInspector2 require File.join(PATH, "object_utils.rb") class G...
true
db03961a4d3f59c1956d9a61dea9471e40c49509
Ruby
treydock/puppet-module-treydock_stdlib
/spec/functions/nodeset_collapse_spec.rb
UTF-8
3,005
2.53125
3
[]
no_license
require 'spec_helper' describe 'nodeset_collapse' do it { is_expected.not_to eq(nil) } it 'raises a ParseError no arguments passed' do is_expected.to run.with_params.and_raise_error(ArgumentError) end it 'raises a ParseError only 2 argument passed' do is_expected.to run.with_params('foo', 'bar').and_...
true
88dc5cdb259f933c1dc68a2ce80c3e500c33e1cf
Ruby
yoon-ho/coderbyte
/Powers of Two.rb
UTF-8
307
3.609375
4
[]
no_license
def PowersofTwo(num) # code goes here while num%2 == 0 num = num / 2 end if num == 1 result = true else result = false end return result end # keep this function call here # to see how to enter arguments in Ruby scroll down PowersofTwo(STDIN.gets)
true
23a0b4143e52d376da1136d3e25387cb72287270
Ruby
jaydeverett/oop-farm
/farm.rb
UTF-8
2,700
4.4375
4
[]
no_license
require 'pry' class Farm def initialize(name) puts "Welcome to #{name}!" @name = name main_menu end def main_menu while true print_main_menu user_selected = gets.to_i call_option(user_selected) end end def print_main_menu puts 'What would you like to do?' puts...
true
ee08243d0e55ea1a8a29135801cdd5e1a5772981
Ruby
gabynaiman/working_calendar
/spec/week_day_spec.rb
UTF-8
2,111
2.71875
3
[ "MIT" ]
permissive
require 'minitest_helper' describe WorkingCalendar::WeekDay do let(:moment) { Timing::NaturalTimeLanguage.parse '2018-11-04T14:27:00-06:00' } describe 'Included moments' do it 'Single hours range' do week_day = WorkingCalendar::WeekDay.new :sunday, '09:00' => '18:00' assert week_day.include?(mom...
true
d92691c1a4a91a707f15aefe6504e76b23793e08
Ruby
EDalSanto/Databases
/forza_db/lib/nodes/selection.rb
UTF-8
426
2.9375
3
[]
no_license
module Nodes class Selection def initialize(predicate_func:, child:) @predicate_func = predicate_func @child = child end def next row = @child.next return nil unless row matched = @predicate_func.call(row) while row && !matched row = @child.next break ...
true
d034d6273c7e12a6de67702f296e2f7e5a55f50d
Ruby
DaniyarKulmanov/ruby_full
/Lesson_2/perfect_weight.rb
UTF-8
492
3.4375
3
[]
no_license
puts "Вас привествует программа идеального Веса!" puts "Здравствуйте как Вас зовут?" name = gets.chomp.capitalize puts "Введите Ваш рост" height = gets.chomp.to_i def count_weight (height) (height - 110) * 1.15 end best_weight = count_weight(height) puts "#{name} Ваш идеальный вес = #{best_weight}!" if best_weig...
true
9c399dd44fcc8a116b42f80f94ec40a2a44cad56
Ruby
tkovs/learning
/ruby/aprendaaprogramar/03 Variaveis/novamente.rb
UTF-8
178
2.859375
3
[]
no_license
puts '...você pode dizer aquilo novamente...' puts '...você pode dizer aquilo novamente...' novamente = '...você pode dizer aquilo novamente...' puts novamente puts novamente
true
564b111ead625a3d2206478e59178e0e34694c69
Ruby
ErikPeterson/hashsub
/lib/hashsub.rb
UTF-8
326
3.15625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
class String def hashsub(hash) rtrn = self hash.each do |regex, substitution| rtrn = rtrn.gsub((Regexp.new regex), substitution) end rtrn end def hashsub!(hash) rtrn = self hash.each do |regex, substitution| rtrn = rtrn.gsub((Regexp.new regex), substitution) end self[0..self.length] = rtrn en...
true
e3cc81e85f59a73a0c34691e72b580956066c558
Ruby
richrace/escapezeta
/lib/rooms/crew_quarters.rb
UTF-8
609
2.71875
3
[]
no_license
require 'rooms/room' require 'rooms/launch_control' require 'rooms/science_lab' require 'game/items/item' require 'game/items/foot_locker' class CrewQuarters < Room def initialize super("Crew Quarters") @items << FootLocker.new @items << Item.new("Soap", {:takeable => true, :usable => true, :wear...
true
d47243947ebae2d5516ad23f310d46656eaa44a6
Ruby
nfriedly/BiblePeople
/app/models/verse.rb
UTF-8
4,192
3.109375
3
[]
no_license
class Verse < ActiveRecord::Base belongs_to :book has_many :person_verses has_many :people, :through => :person_verses def self.search(search, page, ref=nil, strict=true) # a list of possible characters allowed to occur before or after words # (essentially, we're making a list of characters that defin...
true
706373c43e0d30b51eea960f286a248cd98b5d2e
Ruby
yuga77/freemarket_sample_68f
/spec/models/address_spec.rb
UTF-8
2,864
2.625
3
[]
no_license
require 'rails_helper' describe Address do describe '#create' do # 1. 全ての項目が存在すれば登録できること it "is valid with all" do address = build(:address) expect(address).to be_valid end # 2. 送付先の苗字が空では登録できないこと it "is invalid without a destination_family_name" do address = build(:address, des...
true
2d21e21b3d724078bc14187a9324a688764f24a8
Ruby
amorphid/learn_sql_ruby
/spec/statements/008_INNER_JOIN_apples_spec.rb
UTF-8
1,609
2.640625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
RSpec.describe "INNER JOIN" do before do LearnSQL.query(%q{ CREATE TABLE apples ( id SERIAL, variety CHARACTER VARYING, PRIMARY KEY (id) ); }) LearnSQL.query(%q{ CREATE TABLE votes ( id SERIAL, apple_id INT, PRIMARY KEY (id) ); })...
true
27ed841c33ca65ebfa4400a82806ec027735d260
Ruby
tiagosb/estudando_ruby
/repeticao_for.rb
UTF-8
614
4.28125
4
[]
no_license
for i in 1..5 do puts "Numero: #{i}" end puts "\nFor sem o 'do':" for i in 1..3 puts "Numero: #{i}" end puts "\nFor em uma única linha:" for i in 1..4 do puts i end puts "\nInteiros possuem o método .times que pode substituir o for:" 4.times {|i| puts i } puts "\nOutra alternativa é usar o método .upto disponível...
true
0b1a9b0233a28edf70e72547aba48da240fa62fa
Ruby
crazydays/crazydays
/ruby.edu/deck/card_count.rb
UTF-8
507
3.25
3
[]
no_license
class CardCountError < StandardError attr_accessor :actual, :expected def initialize(actual, expected = 0) @actual = actual if actual > 0 @expected = expected > 0 ? expected : nil end def error_message if @expected.nil? '' elsif @actual < @expected 'Too few cards!' else '...
true
e6b5728b014ab58eac25f94c1328e875c6377873
Ruby
cgrad01/hackerrank
/time_conversion/time.rb
UTF-8
289
3.15625
3
[]
no_license
def army_conversion(time) suffix = time.slice!(-2..-1) array = time.split(":") hours = array[0].to_i if suffix == "PM" && hours != 12 hours += 12 array[0] = hours elsif suffix == "AM" && hours == 12 hours = "00" array[0] = hours end time = array.join(":") end
true
233fa03ad18e99e120605b6f3cf0e98e6ea36951
Ruby
Draganovic/headcount
/test/district_test.rb
UTF-8
334
2.671875
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/district' class DistrictTest<Minitest::Test def test_district_class_exist assert District.new({:location => "ACADEMY 20"}) end def test_district_passes_location d = District.new({:location => "academy 20"}) assert "ACADEMY 20", d.na...
true
8d2c2d066af13eae2f6195ce6b84ec837eb0036b
Ruby
ruby-off-the-rails/ruby_vs_js
/ruby_vs_js/loops.rb
UTF-8
152
3.1875
3
[]
no_license
numbers = [28123,54,67,12,4,12] # each loop # numbers.each do |number| # p number # end i = 0 while i < numbers.length p numbers[i] i += 1 end
true
b0f7b3017cadf89794227b6863f52a15e76a6c80
Ruby
ywang118/sinatra-mvc-lab-nyc-web-080618
/models/piglatinizer.rb
UTF-8
1,898
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class PigLatinizer def piglatinize(string_of_words) string_array = string_of_words.split(" ") new_string_array = string_array.map do |word| rule_to_follow(word) end new_string_array.join(" ") end # end piglatinize def rule_to_follow(word) vowels = "aeiouAEIOU" letters_to_add = "" ...
true
bee2f90438fb630d7816e754f07537b36c0407bd
Ruby
staster86/RB
/Head_first/Base/mixin.rb
UTF-8
595
2.8125
3
[]
no_license
module AcceptsComments def comments if @comments @comments else @comments = [] end end def add_comment(comment) comments << comment end end class Clip def play puts "Playing #{object_id}..." end end class Video < Clip include AcceptsComments attr_accessor :resolution e...
true
88e57bef17d1897ac920fb7b11815db832f1a482
Ruby
gorajski/phase-0-tracks
/ruby/hamsters.rb
UTF-8
1,321
4.25
4
[]
no_license
#Gather Input-------------------------------------------------------- puts "What is the hamster's name?" hamster_name=gets.chomp puts "What is the hamster's volume level (1-10)?" volume=gets.chomp.to_i until volume >= 1 && volume <= 10 puts "Invalid input, please enter a number between 1 and 10." volume=get...
true
ed88e3c839903635670e635a36b5ca18ecf27a85
Ruby
Elffers/advent_of_code
/2018/ruby/day08.rb
UTF-8
604
3.453125
3
[]
no_license
input = File.read("/Users/hhh/JungleGym/advent_of_code/2018/inputs/day8.in").strip.split(" ").map { |x| x.to_i } # input = [2, 3, 0, 3, 10, 11, 12, 1, 1, 0, 1, 99, 2, 1, 1, 2] def build_tree input sum = 0 value = 0 c = input.shift mds = input.shift children = Array.new c c.times do |i| s, v = build_...
true
92b5c973703e536d61d610bfe7ffaff7fff28df3
Ruby
colstrom/triton-ops
/lib/triton-ops/snapshot/explorer.rb
UTF-8
1,287
2.546875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- ruby -*- require 'redis' # MIT License require 'tty-prompt' # MIT License require_relative 'catalog' module TritonOps class Snapshot class Explorer def initialize(**options) @namespace = options.fetch(:namespace) { '' } self end def headnode return unless h...
true
65d76382be94ace72fd35ecd57848cf9f8cfb9a4
Ruby
bobbear/depot
/test/models/product_test.rb
UTF-8
1,822
2.84375
3
[]
no_license
require 'test_helper' class ProductTest < ActiveSupport::TestCase test "product attributes must not empty" do product = Product.new assert product.invalid? assert product.errors[:title].any? assert product.errors[:description].any? assert product.errors[:price].any? assert product.errors[:im...
true
8c01d5cbbb925e136233920b6aa058e7f9763404
Ruby
jeffnv/vocab_quest
/vocab_quest.rb
UTF-8
3,090
3.078125
3
[]
no_license
require './lib/word_mgr' require './lib/games' require './lib/feedback_mgr' require 'io/console' require './lib/os_finder.rb' #include OS WORDS_DIR = "words" FEEDBACK_DIR = "etc" STATE_DIR = "lib" @word_mgr @feedback_mgr def set_up_screen_variable if OS.unix? $clear = 'clear' else #windows $clear = 'cls'...
true
b7137ea9f98d436786463bc7b649eeb5fb1245aa
Ruby
owenabbott/sinatra-ar-crud-lab-chicago-web-021720
/app/controllers/application_controller.rb
UTF-8
2,437
2.765625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require_relative '../../config/environment' class ApplicationController < Sinatra::Base configure do set :public_folder, 'public' set :views, 'app/views' end get '/articles/index' do redirect to "/articles" end get "/articles" do @articles = Article.all erb :index end get "/artic...
true
b74191545f60e9a513e2ac21abd5657b54e6c944
Ruby
thelazyfox/euler
/p012/solution.rb
UTF-8
557
4.0625
4
[]
no_license
def triangle_number(n) n*(n+1)/2 end def factor(n) if n == 0 [0] elsif n == 1 [1] else i = 2 while n % i > 0 i += 1 end if i == n [n] else factor(i) + factor(n/i) end end end start = Time.now n = 0 begin n += 1 count = Hash.new(0) factor(triangle_numbe...
true
cbbfdd02ebd13388b60710cfce5041478f607499
Ruby
shilovk/tn
/lesson11/dealer_game.rb
UTF-8
343
2.734375
3
[]
no_license
# frozen_string_literal: true require_relative 'game' # DealerGame < Game class DealerGame < Game define_steps delete: 'opening' def initialize super(Dealer.new) end def choosing steps = self.class.steps steps -= ['next'] if score < 17 steps -= ['taking'] if score > 18 super(steps) unles...
true
0eb4e0869c50f7ef832cef7a024d124029d18fd9
Ruby
cyspath/algorithms
/misc/test_first_app_academy/lib/10_temperature_object.rb
UTF-8
594
4.09375
4
[]
no_license
class Temperature def initialize (hash={}) if hash.include?(:f) @temp=(hash[:f]-32)*5.0/9 end if hash.include?(:c) @temp=hash[:c] end end def in_fahrenheit f=(@temp*9.0)/5.0+32 end def in_celsius @temp end def Temperature.from_celsius(t) Temperature.new(:c => t) end def Temperature...
true
b4adb252154c4822467b7fa1a4eb6c5e6beee45b
Ruby
VaiteLR/entourage-ror
/scripts/generate_redirection_url.rb
UTF-8
829
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby if ARGV.count != 2 $stderr.puts "Usage: #{$SCRIPT_NAME} <url> <secret>" $stderr.puts " To fetch the secret from Heroku, use:" $stderr.puts " $ heroku config:get ENTOURAGE_SECRET --app <app-name>" exit 1 end require 'uri' require 'cgi' require 'base64' require 'openssl' url = ARGV[0] sec...
true
0bd507575cf0f6bfc1bac4b447d01fe34f3f2c21
Ruby
chris-pollard/hummer-social
/db/helpers.rb
UTF-8
1,923
3.140625
3
[]
no_license
require 'pg' require 'bcrypt' require 'date' require 'time' def run_sql(sql,params = []) db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'hummer'}) response = db.exec_params(sql,params) db.close return response end def current_user run_sql('select * from users where id = $1;', [session[:user_id]])...
true
49a3ffbcb193bf0706180f7758400bc0679ddb3c
Ruby
lwoodson/obj_mud
/lib/obj_mud/model.rb
UTF-8
1,042
2.640625
3
[ "MIT" ]
permissive
require 'observer' require 'obj_mud/config' require 'obj_mud/events' module ObjMud module Model class Viewer include Observable include ConfigDependent attr_accessor :location, :last_location def initialize(location=nil) @location = location @last_location = nil e...
true
908f90253b7147dba9f261c6432b3b52f0ff0560
Ruby
opencounter/dentaku
/lib/dentaku/ast/functions/pair.rb
UTF-8
455
3.03125
3
[ "MIT" ]
permissive
require_relative '../function' module Dentaku class Pair attr_reader :l, :r def initialize(l, r) @l = l; @r = r end def inspect "pair(#{l.inspect}, #{r.inspect})" end end end Dentaku::AST::Function.register('pair(%a, %b) = :pair(%a %b)', ->(a, b) { Dentaku::Pair.new(a, b) }) Dentaku::AST::Fu...
true
5a0a89941ea39ff5959b87abd193981309ccb4bb
Ruby
gchan/advent-of-code-ruby
/2016/day-01/day-01-part-2.rb
UTF-8
796
3.609375
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'set' file_path = File.expand_path("../day-01-input.txt", __FILE__) input = File.read(file_path) class Person attr_reader :x, :y, :dir def initialize @x = 0 @y = 0 @dir = 0 end def move case dir when 0 @y += 1 when 1 @x += 1 when 2 ...
true
84c310040c4a0c2f8cb9b32458bce4d2dbfcbaa7
Ruby
nick-stebbings/ruby-rb101-109
/lesson_4/prac_probs_again_5.rb
UTF-8
253
3.28125
3
[]
no_license
flintstones = %w(Fred Barney Wilma Betty BamBam Pebbles) def find_be(array) counter = 0 while counter < array.length do current_str = array[counter] if current_str[0..1] == 'Be' then return counter end counter += 1 end end p find_be(flintstones)
true
9946c59ad228008bd4913857a66feafa71ce30a3
Ruby
edhowland/viper
/minitest/match.rb
UTF-8
2,070
3.46875
3
[ "MIT" ]
permissive
# match.rb: stake to test out Ruby 3.x match =begin 3-D Truth table for PDA that matches balanced brackets, braces, parens and single and double quotes _, :Err, _ => :Err, :nop [, 0, $ => :S0, :push, :RBrack [,0,:RBrack => :S0, :push, :RBrack [,0,:RBrace => :S0,:push, :RBrack [,0,:RParen => :S0, :push, :RBrack ##### l...
true
e5968d531c36cd1a6f6fcbc6cb4f0e93ca9f2a18
Ruby
kabisa/books
/app/models/copy.rb
UTF-8
674
2.75
3
[]
no_license
class Copy < ApplicationRecord belongs_to :book belongs_to :location has_many :borrowings, dependent: :destroy validates :number, numericality: { greater_than: 0, only_integer: true } validate :duplicate_locations_not_allowed acts_as_paranoid delegate :to_s, to: :book # @return true if there's still ...
true
165c182c166f9f09a92b8a9869c1ff1857810a90
Ruby
Codededoc/aA-homeworks
/W1D5/stack.rb
UTF-8
1,131
4.5
4
[]
no_license
# # DIY ADTs # # After you finish the exercises, or if you get stuck on one of the problems, you can view the solutions [here][adt-solutions]. # # [adt-solutions]: https://github.com/appacademy/curriculum/blob/master/ruby/homeworks/abstract_data_types/solution.rb # # ## Exercise 1 - Stack # # Let's write a `Stack` clas...
true
ffd68eace92e088f205344d2182140781023271f
Ruby
arianaberger/workout-tracker-sinatra-project
/db/seeds.rb
UTF-8
1,053
2.59375
3
[ "MIT" ]
permissive
users = [ {username: 'yanna', password: 'aaa',}, {username: 'yanna2', password: 'aaa'} ] users.each do |u| User.create(u) end workouts = [ {name: 'terrible', style: 'emom', time: '30', user_id: 1}, {name: 'hard', style: 'amrap', time: '20', user_id: 1}, {name: 'fun', style: 'amrap', time: '15', user_id: 1...
true
ae4764d891511a9844a9192040da6819dce20cb4
Ruby
Zach-Haddad/AA_class_work
/w2/w2d3/Poker/spec/deck_spec.rb
UTF-8
1,402
3.375
3
[]
no_license
require 'rspec' require 'deck' describe Deck do subject(:deck) { Deck.new } describe '#initialize' do it "generates a deck of 52 cards" do expect(deck.cards.length).to eq(52) end it "does not generate duplicate cards" do expect(deck.cards.uniq).to eq(deck.cards) end end describe...
true
672efd5074380d8b3faffecffbd371ff541ccf47
Ruby
vsinghal85/myRecipeapp
/test/models/recipe_test.rb
UTF-8
1,395
2.71875
3
[]
no_license
require 'test_helper' class RecipeTest < ActiveSupport::TestCase def setup @chef=Chef.create(chefname: "vaibhav",email: "vsinghal85@gmail.com") @recipe=@chef.recipes.build(name: "Chicken parm" ,summary:"This is the best chicken parm recipe ever " , description: "heat oil,add onions,add tomato sauce,add chicken,cook ...
true
3ba5ab5c1e1b345112c89da6592446fd5e9beb6a
Ruby
IsaacSolis97/ProyectoLPCrawler
/Scrapper_Basantes/CodigoRuby/Noticia.rb
UTF-8
572
2.9375
3
[]
no_license
class Noticia attr_accessor :rank, :squad, :matchesPlayed, :wins, :draws, :losses, :points, :goalDiference def initialize(rank, squad, matchesPlayed, wins, draws, losses, points, goalDiference) @rank = rank @squad = squad @matchesPlayed = matchesPlayed @wins = wins @draws = d...
true
eab3e325fae686ef60e9c45d027cf15910001e30
Ruby
lsegal/gorb
/ext/test/fib/test_fib.rb
UTF-8
330
2.921875
3
[ "BSD-3-Clause" ]
permissive
require_relative './fib' include Test::Fib class RubyFib def fib(n) n < 2 ? n : fib(n-1) + fib(n-2) end end p is_prime?(5) require 'benchmark' TIMES = 10 rf = RubyFib.new gf = Fibonacci.new Benchmark.bmbm do |x| x.report("golang") { TIMES.times { gf.fib(20) } } x.report("ruby") { TIMES.times { rf.fib(20...
true
92b62edd7473111107a1f77c694bff14b5474f58
Ruby
ochedenis/study
/my_own/each_with_index.rb
UTF-8
442
3.234375
3
[]
no_license
# require 'pry' # require 'test/unit' # extend Test::Unit::Assertions def ewi(z) for i in 0...(z.size) x = z[i] yield x, i end end ewi([43,'tr',50,'fdur']) { |x, i| p x, i } ewi(['a', 'v', 'l']) {|x, i| p "arr[#{i}]=#{x}"} ewi([43,'tr',50,'fdur']) {|x, i| p "index: #{i} for #{x}"} # test1 = [] # result...
true
c213d40f631eefc755b5bacf2bf5ce310eb71732
Ruby
jah2488/gamebox
/lib/gamebox/director.rb
UTF-8
901
2.984375
3
[ "MIT" ]
permissive
# Directors manage actors. class Director attr_accessor :actors def initialize @actors = [] @dead_actors = [] setup end def setup end def add_actor(actor) @actors << actor actor.when :remove_me do remove_actor actor end actor_added actor actor end def remove_act...
true
f71952e0c1be030f75616b4e5cb8117e10b7ff72
Ruby
IanMKesler/caesar_cipher
/caesar-cipher.rb
UTF-8
897
3.140625
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' if development? def caesar_cipher(string,n) return false unless string.instance_of? String alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] letters = string.downcase.split("") places = lett...
true
a53d9415cd914e8f18558fa45668af8b4cf21a95
Ruby
keeponward/launch-school-rb130
/ruby_js_challenges/medium_challenges/meetup.rb
UTF-8
2,133
3.734375
4
[]
no_license
require 'date' HASH = { 'first' => 0, 'second' => 7, 'third' => 14, 'fourth' => 21, 'fifth' => 28} class Meetup attr_reader :year, :month, :date, :last_date_of_month def initialize(year, month) @year = year @month = month @date = Date.new(year, month, 1) end def day(weekday, schedule) weekda...
true
f0b1acb3e8917b4dd122ce9e68ad4f14ad53d72e
Ruby
johnhabibi/blocks_course
/time_cop.rb
UTF-8
567
3.15625
3
[]
no_license
require 'timeout' Timeout.timeout(2.0) do sleep 1.0 puts 'That was refreshing...' end Timeout.timeout(2.0) do sleep 1.0 puts 'That was refreshing...' end def try_with_timeout(timeout_duration) Timeout.timeout(timeout_duration) do yield end rescue Timeout::Error puts 'Took too long!' end try_with_t...
true
ae7dff3eab2c8660d5c79dc72339d2a5988634e9
Ruby
agiratech-karthiga/Rubyprogram
/ruby/stringoccurencepdf.rb
UTF-8
650
3.390625
3
[]
no_license
module Stringpdf class Stringoccurence attr_accessor :elem, :a, :b def initialize elem,a,b @elem=elem @a=a @b=b end def self.number1 h=Hash.new f=File.open("/home/agira/Rubypgm/string.pdf","r") f.each_line{|line| words=line.split #words=char.split ...
true
f9fd084daa5978b95f93cf30700700faadf0a2da
Ruby
camelpunch/xyleme_transformer
/lib/add_file_extentions.rb
UTF-8
312
2.640625
3
[]
no_license
class AddFileExtentions def initialize(file_extensions) @file_extensions = file_extensions end def call(files) files.inject({}) do |output, (file_path, text)| output.merge( { @file_extensions.reduce(file_path) { |value, ext| value + '.' + ext } => text } ) end end end
true
0de170527bad73f63ca8728f0d776780e98576c1
Ruby
postmodern/deployml
/lib/deployml/servers/thin.rb
UTF-8
2,521
2.75
3
[ "MIT" ]
permissive
require 'deployml/exceptions/missing_option' require 'deployml/options/thin' module DeploYML module Servers # # Provides methods for configuring, starting, stopping and restarting # the [Thin](http://code.macournoyer.com/thin/) web server. # module Thin # # Initializes options used wh...
true
549b1066ea4e5293ceaa731894aabc254eb8241d
Ruby
Yihwan/faquity
/app/models/user.rb
UTF-8
2,352
2.5625
3
[]
no_license
# == Schema Information # # Table name: users # # id :integer not null, primary key # first_name :string not null # last_name :string not null # email :string not null # buying_power :decimal(, ) not null # password_digest :string ...
true
f026da5a13a42f056f038e5271ba3b61c741b9f0
Ruby
logicalhan/reading_tracker
/spec/models/tracker_spec.rb
UTF-8
1,571
2.96875
3
[]
no_license
require File.expand_path("../../../tracker", __FILE__) describe "Tracker" do context "making sure rspec works" do it "should return true when the method rspec_works is called" do Tracker.rspec_works.should eq(true) end end context "initialization" do it "should take an optional hash when initia...
true
edb4c52cdcc615149f615f07d9f8367185cc1509
Ruby
arjenvanderende/SubR
/app/lib/subr/episode.rb
UTF-8
665
2.8125
3
[]
no_license
require 'bierdopje' require 'bierdopje/Subtitle' module SubR class Episode attr_reader :season, :episode, :title def initialize season, episode, title @season = season.to_i @episode = episode.to_i @title = title end def find_subtitles show_id Bierdopje::Subtitle.find show_id, @season, @episode, ...
true
cc2b579e8dc8e984a3c5e4f648d8fe274256728b
Ruby
javo20/tip-calculator
/tip-calculator2.rb
UTF-8
665
3.546875
4
[]
no_license
print "Enter the cost of your meal before tax: " meal_cost = Float(gets) print "Enter your local tax rate: " tax_percent = Float(gets) print "Enter the percent tip you would like to leave: " tip_percent = Float(gets) tax_value = meal_cost * tax_percent/100 meal_with_tax = meal_cost + tax_value tip_value = meal_with...
true
2ba87447feb9a73e720cd0a581b0681c6e544e38
Ruby
zeisler/reverse_parameters
/lib/reverse_parameters.rb
UTF-8
3,754
3.03125
3
[ "MIT" ]
permissive
require "reverse_parameters/version" require "reverse_parameters/core_ext/refinements" module ReverseParameters # @param [Object#to_proc, Object#to_ary, UnboundMethod] input def self.new(input) return input if input.is_a? Base Base.new(input) end class Base # @param [Object#to_proc, Object#to_ary...
true
a67ae6595b409cea63234a85f12f6303431ec510
Ruby
Gerula/interviews
/ElementsOfProgrammingInterviews/BinarySearchTrees/first_occurrence.rb
UTF-8
2,354
3.1875
3
[ "MIT" ]
permissive
class Node < Struct.new(:value, :id, :left, :right) end node = Node.new(108, :A, Node.new(108, :B, Node.new(-10, :C, Node.new(-14, :D, nil, nil), Node.new(2, :E, ...
true
f4ca63fa1151055d0696eda1daf54743f298a911
Ruby
chanachein1/kwk-l1-classes-and-instances-lab-ruby-kwk-students-l1-nyc-080618
/lib/dog.rb
UTF-8
447
4
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog end #put end to end the class fido = Dog.new snoopy = Dog.new lassie = Dog.new # def initialize (name,name1,name2) # @name= name # @name1= name1 # @name2= name2 # end # def name # @name # end # def name1 # @name1 # end # def name2 # @name2 # end ...
true
123ede3209305ff8fcde2a83390e02f359899144
Ruby
System-rat/mcsmp
/lib/mcsmp/server_runner.rb
UTF-8
3,269
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'open3' module MCSMP # A class responsible for running a ServerInstance class ServerRunner attr_reader :instance attr_accessor :jvm_arguments def initialize(server_instance, java_executable: 'java', jvm_arguments: nil, log_limit: 100) unless server_instance...
true
5254e2829225afcc38e03aef749522421eeb5847
Ruby
curationcodes/jekyll-paginate-categories
/lib/jekyll-paginate-categories/category-page.rb
UTF-8
1,098
2.5625
3
[ "MIT" ]
permissive
module Jekyll module Paginate module Categories class CategoryPage < Jekyll::Page # Attributes for Liquid templates ATTRIBUTES_FOR_LIQUID = %w( category content dir name path url ) # Initialize a new Page. ...
true
1240d1d9850a923ffbb4918a76d99b3b27410cb5
Ruby
johslarsen/rbtimesheet
/lib/timesheet/ascii_tables.rb
UTF-8
1,850
3.0625
3
[]
no_license
#!/usr/bin/env ruby require_relative 'common' module Timesheet class AsciiTables def initialize(timesheet) @timesheet = timesheet end def entries() @timesheet.map {|o| o}.join("\n") end def metadata() longest_key = @timesheet.metadata.each_key.inject { |memo, key| key.length > memo.length ? key :...
true
c243d9444e398a17fc522bdf6716d65812c70a3b
Ruby
codemilan/old_stuff
/active_point1/Test/utils/_namespace.rb
UTF-8
291
2.609375
3
[]
no_license
class Module def namespace if @module_namespace_defined @module_namespace else @module_namespace_defined = true list = self.name.split("::") if list.size > 1 list.pop @module_namespace = eval(list.join("::")) else @module_namespace = nil end end end end
true
47006847532b75b8146ad33e8e41395a723641a5
Ruby
AlveeM/exercism-ruby
/series/series.rb
UTF-8
226
3.53125
4
[]
no_license
class Series attr_reader :chars def initialize(str) @chars = str.split('') end def slices(len) raise ArgumentError, 'Slice length too long' if len > chars.length chars.each_cons(len).map(&:join) end end
true
e8f2f72875a2c1dce2f3ef3b31d5ac51ca793d8f
Ruby
sander6/custom_matchers
/lib/matchers/all_matchers.rb
UTF-8
5,649
3.0625
3
[]
no_license
module Sander6 module CustomMatchers module AllMatcherExtensions # Some more handy aliases for common things. def be_a(klass) @conditions = Proc.new { |o| o.is_a?(klass) } self end def be_an_instance_of(klass) @conditions = Proc.new { |o| o.instance_of?(klass) } ...
true
97c33f71621141c5a8ec0cb606e31b9b557786b7
Ruby
amardeepshinde/Shopping-cart
/lib/shopping/input/inputhandler.rb
UTF-8
1,390
3.375
3
[ "MIT" ]
permissive
require_relative 'addtocart' require_relative 'showcart' require_relative 'orderitem' require_relative 'showcart' require_relative 'invokers' require_relative 'bufferinvoker' require_relative 'item' require_relative 'bag' module Inputhandle def Inputhandle.parse products = { "aaa" => 1000 , "bbb" => 3000} ...
true
1a1cee6c30bb0dbb162f5ba5b1831f11ca42fb26
Ruby
puppetlabs/puppet-community-rangefinder
/lib/rangefinder/parser/puppet.rb
UTF-8
845
2.53125
3
[ "Apache-2.0" ]
permissive
require 'puppet' require 'puppet/parser' class Rangefinder::Parser::Puppet def initialize(filename) @filename = filename @parser = Puppet::Pops::Parser::EvaluatingParser.new end def evaluate! source = Puppet::FileSystem.read(@filename) result = @parser.parse_string(source, @filename).definit...
true
f5219b1b37a34aed085532dc931ef7ff039ae124
Ruby
eniolar10/key-for-min-value-onl01-seng-ft-012120
/key_for_min.rb
UTF-8
413
3.484375
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 require "pry" def key_for_min_value(name_hash) lowest_value = nil lowest_key = nil name_hash.each do |key, value| if lowest_value == nil lowest_value = value lowest_key = key else if...
true
6279103400be1dce3ac486dbcad5b9e097c35c74
Ruby
snelson82/ruby-warrior
/lib/ruby_warrior/abilities/detonate.rb
UTF-8
1,042
2.890625
3
[ "MIT" ]
permissive
module RubyWarrior module Abilities class Detonate < Base def description 'Detonate a bomb in a given direction (forward by default) which damages that space and surrounding 4 spaces (including yourself).' end def perform(direction = :forward) verify_direction(direction) ...
true
138b2834e298594409fc0c80795676736de3118e
Ruby
yuicraft/Ruby-par-teach
/3일차/self_entrance.rb
UTF-8
194
3.046875
3
[]
no_license
#연산 결과를 스스로에게 대입하는 자기 대입은 = 앞에 연산자를 기술해 간단히 표현할 수 있다. a = 1 a +=1 #a = a + 1 과 동일 a ||= 2 #a = a || 2와 동일
true
f549d5787eefee3ca181229507fa5b4431ea10d3
Ruby
callumj/simple_crawler
/lib/simple_crawler/global_queue.rb
UTF-8
1,907
3.203125
3
[]
no_license
require 'thread' module SimpleCrawler # Provides the ability to enqueue and dequeue URIs to crawl onto a infinite queue. # Makes use of Mutexs to ensure multiple threads don't conflict. class GlobalQueue class Node < Struct.new(:uri, :next); end attr_reader :crawl_session, :known_uris def initia...
true
b9f84894acd5ccd9a59fda2b3e934059400ead2e
Ruby
tomtomecek/code-challenges
/simple_linked_list/simple_linked_list.rb
UTF-8
1,011
3.5
4
[]
no_license
class Element attr_reader :datum, :next def initialize(datum, _next = nil) @datum = datum @next = _next end def tail? self.next.nil? end end class SimpleLinkedList attr_reader :head def initialize @head = nil end def self.from_a(array) list = new array&.reverse_each do |e...
true
26f4c7e6dff261c60c1b8fa9bf26effe77ad2f29
Ruby
mstram/vintage
/test/storage_test.rb
UTF-8
2,338
3.046875
3
[]
no_license
require_relative "helper" describe "Storage" do let(:mem) { Vintage::Storage.new } let(:program_offset) { Vintage::Storage::PROGRAM_OFFSET } it "can get and set values" do mem[0x1337] = 0xAE mem[0x1337].must_equal(0xAE) end it "can load a bytecode sequence into memory and traverse it" do bytes...
true