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
3e468a31a82f12a116d8a64348d2a631441e4ab2
Ruby
carquet/checkout-coding-test
/kelisto.rb
UTF-8
1,457
3.671875
4
[]
no_license
class Checkout attr_reader :basket, :pricing_rules def initialize(pricing_rules) @basket = {} @pricing_rules = pricing_rules end # add item to cart def scan(code) !@basket[code]? @basket[code] = 1 : @basket[code]+= 1 end # calculate total cost def total sub_total = 0 @basket.each do |code, quantit...
true
0987a22f580c8d54cd9cbfcc8ef0ab46bbc7e471
Ruby
manheim/backupsss
/lib/backupsss/janitor.rb
UTF-8
1,443
2.96875
3
[ "MIT" ]
permissive
require 'backupsss/removal_error' module Backupsss # A class for cleaning up backup artifacts class Janitor attr_reader :driver, :retention_count def initialize(opts) @driver = opts[:driver] @retention_count = opts[:retention_count] || 0 end def sift_trash trash = find_...
true
754a9baf1773182dd06672fda4748daeee08a611
Ruby
BlakeMesdag/fake-orders
/db/seeds.rb
UTF-8
1,692
2.578125
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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
abb414f3c188ee9b53dc45e244d1dd693f972fe2
Ruby
versioneye/veye
/lib/veye/views/project/licence_pretty.rb
UTF-8
538
2.53125
3
[ "MIT" ]
permissive
require_relative '../base_pretty.rb' module Veye module Project class LicencePretty < BasePretty def format(results) return if results.nil? n = 1 results["licenses"].each_pair do |licence, products| product_keys = products.map {|prod| prod["prod_key"]} licence_n...
true
d7dc71e72feeed9f007e3f0f63743b44c142041d
Ruby
dancernerd32/my-first-repository
/table_of_contents_array.rb
UTF-8
269
3.125
3
[]
no_license
line_width=60 puts "Table of Contents".center(line_width) puts " " chapters=[['1','Getting Started', '1'], ['2','Numbers', '9'], ['3','Letters', '13']] chapters.each do |chap| puts ("Chapter "+chap[0]+": "+chap[1]).ljust(line_width/2)+ chap[2].rjust(line_width/2) end
true
e2959d62e06b353117d1d8d6d8e69135ea24b0d8
Ruby
jtran/gcode-vm
/lib/gcode_vm/transformers/replace_transformer.rb
UTF-8
656
2.875
3
[ "MIT" ]
permissive
module GcodeVm class ReplaceTransformer attr_accessor :pattern attr_accessor :with def initialize(pattern:, with:, multiline_output: false) if ! multiline_output && /\n/ =~ with raise ArgumentError.new("I don't know how to replace a pattern with multiple lines. \"replace\" works on one li...
true
0e20c5ef97a76813c69e096be7ee4bb5b986b5d2
Ruby
agiletkiewicz/ruby-objects-has-many-lab-online-web-sp-000
/lib/artist.rb
UTF-8
373
3.25
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Artist attr_reader :name def initialize(name) @name = name @songs = [] end def songs Song.all.select {|song| song.artist == self} end def add_song(name) name.artist = self end def add_song_by_name(name) new = Song.new(name) add_song(new) end de...
true
1ba665557527cf061ac55ff2778bf6a54545d7ca
Ruby
kupolak/codewars
/Ruby/8 KYU/CSV representation of array.rb
UTF-8
137
2.921875
3
[]
no_license
def to_csv_text(array) text = '' array.map do |e| text << (e.join(',')) text += "\n" unless e == array.last end text end
true
28e59342bb0dff2d70fca2e8a427601e3d657c16
Ruby
codehaus/picocontainer
/tags/monolithic-src-tree/ruby/rico/test/tck/containertestcase.rb
UTF-8
10,308
2.765625
3
[]
no_license
require 'rico/container' require 'rico/test/model' module Rico =begin (Should) test all the methods in Rico container. Based on the TCK test suite from the Java PicoContainer. Mix into a TestCase containing a create_container() method Author: Dan North based on Aslak Hellesoy's tests =end module Container...
true
60a2916a9e4c6ae6979c2b6c15bebfde8ac0bed4
Ruby
BennyLouie/ruby-enumerables-hash-practice-green-grocer-lab-dumbo-web-82619
/grocer.rb
UTF-8
2,816
3.265625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def consolidate_cart(cart) ordered_cart = {} # i = 0 # while i < cart.length do # ordered_cart[cart[i].keys[0]] = cart[i].values[0] # ordered_cart[cart[i].keys[0]][:count] = cart.count(cart[i]) # i += 1 # end cart.each do |item| if ordered_cart[item.keys[0]] ordered_ca...
true
cc3d784a092aa563a0032c1e7e039ac11eb216ce
Ruby
Areukiddin/Ruby-commons
/Task2/cargo_car.rb
UTF-8
336
3.140625
3
[]
no_license
class CargoCar < Car attr_reader :empty_capacity, :filled_capacity def initialize(number, capacity, type = :cargo) super @empty_capacity = capacity @filled_capacity = 0 end def fill(capacity) return unless @empty_capacity >= capacity @empty_capacity -= capacity @filled_capacity += cap...
true
e611ca10f2c3c71c71b757421de961b33792a2a8
Ruby
expnotes9/codeforces
/templates/template.rb
UTF-8
266
3.125
3
[ "MIT" ]
permissive
# run on ruby 2.0.0p645 def main() n = gets.to_i s = gets x = Array.new(n) y = Array.new(n) for i in 0...n do x[i], y[i] = gets.split.map(&:to_i) end # solve here puts n puts s puts x[0] puts y[n-1] end def solve(n) return 0 end main()
true
d49b8377ff45499fff0ab980ef28b21904e30f65
Ruby
gabrieltal/aA-Homeworks
/W1D5/stack.rb
UTF-8
253
3.359375
3
[]
no_license
class Stack def initialize @store = [] end def add(el) @store << el el end def remove @store.pop end def show @store.dup end end # s = Stack.new # s.add(1) # s.add(4) # s.add(25) # p s.show # s.remove # p s.show
true
729de6b65eb886d279629babf42cba43bff6d30b
Ruby
willmomo/ry2kojima
/scripts/ruby/xml.rb
UTF-8
414
2.75
3
[]
no_license
$KCODE = 'utf8' require 'date' require 'rexml/document' #簡便の為、テキストデータとして、XMLを準備 xmlsource = <<EOF <?xml version="1.0"?> <root> <3>111</3> <1>222</1> <3>222</3> <1>444</1> <1>555</1> </root> EOF doc = REXML::Document.new xmlsource p doc p doc.root p doc.root.elements[3, '1'], doc.root.elements[3, '1'].text p doc...
true
da03cae790e9d00a6b5a9569e9475f2b0e2e99a6
Ruby
peteratt/swcm
/Tema2.1-Flujos_Streams/Expresiones_Regulares/WordCount/lib/Count2.rb
UTF-8
348
3.390625
3
[]
no_license
class Count2 # Incluye el método "count_words" en el modulo "Count" def self.count_words(text) if (text =~ /[^a-zA-Z]*\\Z/) then text = "" end # elimina ficheros sin palabras # sustituye cada palabra por letra "w" y calcula longitud de string resultante return text.gsub(/[^a-zA-Z]*[a-zA-Z]+[^a-zA-Z]*/,"...
true
d9bfd165271b098db1e318da031d8c4845697f40
Ruby
protokris/spiral
/spiral_matrix.rb
UTF-8
1,188
3.671875
4
[]
no_license
def make_spiral(width, height, spiral=[], start_col=0, start_row=0, val=1) return spiral if width <=0 || height <=0 instructions = { :right => { limit: width, col: 1, row: 0 }, :down => { limit: height-1, col: 0, row: 1 }, :left => { limit: width-1, ...
true
85c5e47604332aa7adee4da8f43a3d6c3b52d6a1
Ruby
skkmania/ctree
/loop_reporter.rb
UTF-8
3,863
2.734375
3
[]
no_license
#!/usr/bin/env ruby # -*- coding:utf-8 -*- # loop_reporter.rb require 'optparse' require 'pathname' dirname = Pathname(__FILE__).expand_path.dirname.to_s require dirname + '/gen_loop_patterns.rb' require dirname + '/pattern_to_exp.rb' class LoopReporter def initialize p:3, len:3, pat:"" @p = p @r = p - 1 ...
true
cb419d02778f841843fc8f4aaea44a26f2740c80
Ruby
chef/chef
/lib/chef/encrypted_data_bag_item.rb
UTF-8
4,886
2.765625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# # Author:: Seth Falcon (<seth@chef.io>) # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:/...
true
a881bd98d2168221d40520e2ca39d6e72ffefcef
Ruby
MarceloAGuimaraes/backend-service-sistema-um
/app/models/address.rb
UTF-8
260
2.546875
3
[]
no_license
class Address < ApplicationRecord belongs_to :request def to_param "#{space_to_plus(street)},#{space_to_plus(neighborhood)}, #{space_to_plus(city)}, #{space_to_plus(uf)}" end private def space_to_plus(value) value.gsub(' ', '+') end end
true
98e57f7d102d184da6abb848ab9c7799975be2a2
Ruby
adtekio/consumers
/lib/redis/expiring_set.rb
UTF-8
1,833
2.71875
3
[]
no_license
class RedisExpiringSet attr_reader :connection_pool def initialize(connection_pool) @connection_pool = connection_pool @cache = new_hash_cache end def add_click_event(event) @cache[event.lookup_key][event.payload] = event.max_age # expire!(event.lookup_key) flush if cache_full? end de...
true
aadd54c7439aaf0e483e8ef9f9fde6566efcac01
Ruby
DavidJonKariz/k2-connect-ruby
/lib/k2-connect-ruby/k2_entity/entities/k2_transfer.rb
UTF-8
2,025
2.609375
3
[ "MIT" ]
permissive
# For Transferring funds to pre-approved and owned settlement accounts class K2Transfer < K2Entity include K2Validation # Create a Verified Settlement Account via API def settlement_account(params) # Validation params = validate_input(params, @exception_array += %w[account_name bank_ref bank_branch_ref a...
true
54b2cdb9ca14e4328d129971a33af8f74f251800
Ruby
chadmetcalf/omaha_bot
/spec/lib/omaha_bot/parser_spec.rb
UTF-8
4,619
2.65625
3
[]
no_license
module OmahaBot describe Parser do subject(:parser) { Parser.new } # Settings timeBank 5000 # Settings timePerMove 500 # Settings handsPerLevel 10 # Settings startingStack 1500 # Settings yourBot player1 context "settings" do let(:settings) { Settings.new } before(:each) do ...
true
ff2c018b83185ac6366c3dfe17f03f45faf146cc
Ruby
netfoxonline/ey-cloud-recipes
/cookbooks/cron/files/default/catapult_resources_and_source_code_backups.rb
UTF-8
3,967
2.765625
3
[]
no_license
#!/usr/bin/env ruby require 'rubygems' require 'aws' require 'fileutils' require 'date' #backup_bucket_name = 'catapult-backup' backup_bucket_name = 'catapult-elearning-test-backups' backup_type = {"resources" => "/data/catapult/shared/resources"} $data_dir = "/mnt/backups" # Catapult destination_account = Aws::S3.ne...
true
5e67b0300cea4833ac7e502416c60b58f9f4fd1b
Ruby
danielbogart/magic-night-battleship
/game_board.rb
UTF-8
4,353
3.5
4
[]
no_license
class GameBoard attr_accessor :board attr_accessor :ships attr_accessor :hits DIRECTIONS = [:up, :down, :left, :right] def initialize reset_board self.ships = [:aircraft_carrier, :battleship, :submarine, :destroyer, :cruiser, :patrol_boat].map { |name| Ship.new(name) } ...
true
b66a30d1ee5d091a4c602d97b62e0e722765f897
Ruby
jdashton/glowing-succotash
/daniel/HeadFirst/ch09_jda/friendly.rb
UTF-8
598
3.578125
4
[ "MIT" ]
permissive
module Friendly def my_method puts 'hello from Friendly' end end module Friendlier def method_two puts 'hello from Friendlier!!' end end class ClassOne include Friendly end class ClassTwo include Friendly end ClassOne.new.my_method ClassTwo.new.my_method class MyClass include Friendly inclu...
true
85bba413c18edd22d69932a5d2cc58b47417d8fd
Ruby
fracnesco/workshop-robot
/esempi/06Imperative_Prog/08If.rb
UTF-8
239
2.84375
3
[]
no_license
# Condizionali # possiamo controllare dinamicamente il valore di una variabile # che cambia nel tempo pippo = 0 16.times do if pippo < 8 sample :drum_bass_hard else sample :drum_cowbell end pippo = pippo + 1 sleep 0.25 end
true
c3916b9c8fe0ef1cfe670b328d0979c9c97e2646
Ruby
jhellerstein/crocus
/test/tc_minibloom.rb
UTF-8
4,706
2.546875
3
[]
no_license
require './test_common.rb' require '../lib/crocus/minibloom' class TestMiniBloom < Test::Unit::TestCase def test_single_push results = [] mb = MiniBloom.new mb.source('p1',1) mb.p1.pro {|i| results << [2*i[0]]} mb.p1 << [2] assert_equal([4], results.pop) end def test_single_table resu...
true
208e8809d3f0a96128ee070303414b405e3f363c
Ruby
rud/ruby-cabin
/lib/cabin/publisher.rb
UTF-8
419
2.78125
3
[ "Apache-2.0" ]
permissive
require "cabin/namespace" # This mixin allows you to easily give channel and publish features # to a class. module Cabin::Publisher # Set the channel def channel=(channel) @channel = channel end # def channel= # Get the channel def channel return @channel end # def channel # Publish to the chan...
true
07b59fda89db74c121dd3fa8171f854f0ca03c1e
Ruby
cielavenir/procon
/euler/tyama_euler140.rb
UTF-8
227
3.046875
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby p Enumerator.new{|y| a=[7,8,13,17,32,43] n=[1,2,5,7,14,19] y<<2;y<<5 loop{ a<<9*a.first+20*n.first n<<4*a.first+9*n.first y<<(a.last-7)/5 if (a.last-7)%5==0 a.shift n.shift } }.take(30).reduce(:+)
true
65e3f68b10e422e548681baf3275debdb82a7958
Ruby
meilke/bewildr
/lib/bewildr/control_type_additions/tree_additions.rb
UTF-8
1,899
2.671875
3
[ "BSD-2-Clause" ]
permissive
#Copyright (c) 2010, Nathaniel Ritmeyer. All rights reserved. module Bewildr module ControlTypeAdditions #:nodoc: module TreeAdditions #Returns an array containing the tree's root nodes def root_nodes prepare_element get(:type => :tree_item, :scope => :children) end #Retu...
true
5195035be3cdeb4553af5f153e89494a16515ea0
Ruby
armandolew/banorte-payworks
/lib/banorte/payworks.rb
UTF-8
912
2.5625
3
[ "MIT" ]
permissive
require "banorte/payworks/version" require "httparty" module Banorte module Payworks class Client include HTTParty BANORTE_URL = "https://eps.banorte.com" AUTH_PATH = "/recibo" base_uri BANORTE_URL attr_accessor :name, :password, :client_id, :mode, :trans_type def initialize ...
true
62b289e022613169f9778a4ec1e2fa8e20a44d68
Ruby
Anthony7147/Ruby-Codes
/hamming.rb
UTF-8
1,260
3.609375
4
[]
no_license
strand_1 = "GAGCCTACTAACGGGAT"; strand_2 = "CATCGTAATGACGGCCT"; a = strand_1.split(//); b = strand_2.split(//); ##def hamming(arr1, arr2) ## counter = 0 ## arr1.zip(arr2) do |a, b| ## if a != b ## counter += 1 ## end ## end ## puts counter ##end ##a = ["g", "a", "g", "c", "c", "t...
true
af338c68cb53d6187981c33598db12df3591e34e
Ruby
jkufro/CavEatAPI
/app/models/food.rb
UTF-8
637
2.53125
3
[]
no_license
class Food < ApplicationRecord has_many :food_ingredients, dependent: :destroy has_many :ingredients, -> { order(is_warning: :desc, id: :asc) }, through: :food_ingredients has_many :nutrition_facts, dependent: :destroy validates_numericality_of :upc, only_integer: true, greater_than_or_equal_to: 0 validates_...
true
ac90dc12c5ecd21064f00a6ff1af8797effa1921
Ruby
tomciv9000/deli-counter-online-web-sp-000
/deli_counter.rb
UTF-8
640
3.734375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def line(deli_line) custNumber = [] if deli_line.length == 0 puts "The line is currently empty." else line = [] deli_line.each_with_index do |name, index| line.push ("#{index + 1}. #{name}") end puts "The line is currently: #{line.join(" ")}" end end def take_a_number(deli_line, c...
true
0fa3279c536d293fe96be27fafb90706b63c4bb7
Ruby
EPrenzlin/activerecord-tvshow-onl01-seng-pt-030220
/app/models/show.rb
UTF-8
586
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Show < ActiveRecord::Base def self.highest_rating Show.all.maximum("rating") end def self.most_popular_show Show.where("rating").first end def self.lowest_rating Show.all.minimum("rating") end def self.least_popular_show Show.order("rating ASC").first end ...
true
d8a62bce2f5f92985320f236fc94ea6a6e372791
Ruby
TheLastSultan/CorzineSort
/Ruby/course.rb
UTF-8
674
3.3125
3
[]
no_license
require_relative 'student' require 'byebug' class Course attr_reader :name, :size, :students include Enumerable def each(&block) @students.each {|stu| block.call(stu)} end def initialize(name, size = nil, students = []) @students = students @size = size || rand(10..20) @name = name end ...
true
0596c340c205494dbd4b56b001f4c3dcd3008d44
Ruby
raysuke/til
/ruby/sample.rb
UTF-8
137
3.296875
3
[]
no_license
puts 1 + 2 a = 'Hello world' puts a b = 'こんにちは' puts b name = 'Taro' name2 = 'Jiro' puts "Hello #{name}" puts "Hello" + name2
true
d1b4dd528c1506320acb57b990a6e3fa77538254
Ruby
sul-dlss-deprecated/wfs_rails
/lib/wfs_rails/workflow_parser.rb
UTF-8
1,126
2.65625
3
[ "Apache-2.0" ]
permissive
module WfsRails ## # Parsing Workflow creation request class WorkflowParser attr_reader :xml_request, :druid, :repository ## # @param [String] request_body # @param [String] druid # @param [String] repository def initialize(request_body, druid, repository) @xml_request = Nokogiri::X...
true
e55b32f3b2936d243204a9eda5f5cc1ca69e63c6
Ruby
GeovaneDaSilva/console-rock
/app/services/hunts/device_queuer.rb
UTF-8
1,985
2.578125
3
[]
no_license
module Hunts # Creates Devices::QueuedHunt records for a given context class DeviceQueuer def initialize(record, notify_devices = true) @record = record @notify_devices = notify_devices end def call return if @record.is_a?(Hunt) queue_all_devices_for_hunt elsif @re...
true
c52be39a303a7a9de570bba4db1321a8fa2c7d46
Ruby
Trinergy/nand2tetris_projects
/06/assembler.rb
UTF-8
4,204
3.0625
3
[]
no_license
# This assembler was a hack job that ended up being incomplete # It can translate non-symbol assembly into machine language # TODO: Break file down into individual components # Wrap less obvious operations with method names that show clear intention # BUG: Can not handle consecutive jump instruction lines -> Make...
true
15db36d61f82a95c8125e6a1f4bd41f54a6746e3
Ruby
lemon123456/Mobile-Test-Appium-Cucumber-Ruby
/features/support/base_page.rb
UTF-8
3,720
2.671875
3
[]
no_license
module LocatorModule def findByName(name) find_element(:name, "#{name}") end def findById(id) find_element(:id, "#{id}") end def findByXpath(xpath) find_element(:xpath, "#{xpath}") end def clickByName(name) findByName(name).click end def clickById(id) findById(id).click end ...
true
01f1addca0802c5ebcffa017209337956f42f003
Ruby
chris-clifton/100
/smallproblems/easy6/problem1.rb
UTF-8
507
3.265625
3
[]
no_license
DEGREE = "\xC2\xB0" MINUTES_PER_DEGREE = 60 SECONDS_PER_MINUTE = 60 SECONDS_PER_DEGREE = MINUTES_PER_DEGREE * SECONDS_PER_MINUTE def dms(float) total_seconds = (float * SECONDS_PER_DEGREE).round degrees, remaining_seconds = total_seconds.divmod(SECONDS_PER_DEGREE) minutes, seconds = remaining_seconds.divmod(SECO...
true
74ea8655285ebcdddc92395660470aaa716e249f
Ruby
kken339039/leetcode-club
/Ruby/topic_13_roman_integer.rb
UTF-8
1,401
3.78125
4
[]
no_license
def roman_to_int(s) roman_nums = { I: 1, V: 5, X: 10, L: 50, C: 100, D: 500, M: 1000 } less_nums = { I: {i: ["V","X"], val: -1}, X: {i: ["L","C"], val: -10}, C: {i: ["M","D"], val: -10...
true
4378cb97eb24620fe3cbc8e555b06a7e341561e2
Ruby
nla-asia/barometer
/lib/barometer/utils/data_types.rb
UTF-8
5,475
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module Barometer module Utils module DataTypes def self.included base base.send :include, InstanceMethods base.extend ClassMethods end module InstanceMethods def metric=(value); @metric = !!value; end def metric; @metric; end def metric?; @metric || @met...
true
277da33ca30b60a86a24a59b5f53cdef9dd5d5ef
Ruby
GunioRobot/twitter-on-merb
/models/tweet.rb
UTF-8
4,123
2.65625
3
[]
no_license
# referenced API. # http://merbapi.com/classes/Merb/BootLoader/BuildFramework.html class Tweet include DataMapper::Resource property :id, Serial property :message, Text, :length => 255, :nullable => false, :unique => true property :name, String, :length => 20, :nullable => false property :category, String, ...
true
6b85b4835f52c32b11a34148068850214013e8f9
Ruby
yhirano55/active_admin_menu
/lib/active_admin_menu/menu.rb
UTF-8
977
2.546875
3
[ "MIT" ]
permissive
module ActiveAdminMenu class Menu attr_reader :items def initialize @items = [] end def find_item_by(resource_name:) items.detect { |item| item.resource_name == resource_name } end def add(resource_name:, parent: nil) items << Item.new(resource_name: resource_name, parent:...
true
f5eede27c087de40280071c3b7188bea43137df8
Ruby
KurisuLim/ruby_udemy_lessons
/iteration_over_array_with_while_or_until_loop.rb
UTF-8
202
3.40625
3
[]
no_license
animals = ['Lion', "Zebra", 'Baboon', 'Cheetah'] i = 0 # 0, 1, 2, 3, while i < animals.length puts i puts animals[i] i += 1 end until i == animals.length puts i puts animals[i] i += 1 end
true
8b027de604677fe3051654c36bbd62cfa51ec9ba
Ruby
melzreal/ruby-music-library-cli-v-000
/lib/musiclibrarycontroller.rb
UTF-8
2,279
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class MusicLibraryController attr_accessor :path, :musicimporter def initialize(path='./db/mp3s') MusicImporter.new(path).import end def call puts "Welcome to your music library!" puts "To list all of the songs by a particular artist, enter 'list artist'." puts "To list all of the a...
true
4054d54350baf072b42229f2ba459920acccd2c1
Ruby
sokartema/prct05
/tc_racional.rb
UTF-8
492
2.890625
3
[]
no_license
require "./racional.rb" require "test/unit" class Test_Fraccion < Test::Unit::TestCase def test_simple assert_equal("8/2", Fraccion.new(8,2).to_s) end def test_suma assert_equal("31/7", Fraccion.new(8,2).suma(3,7)) end def test_resta assert_equal("2/1", Fraccion.new(8,2).resta(6,3)) end ...
true
600599b59ad8c191c5ab874b73bbfa7c30fca7a2
Ruby
simplificator/simplificator-filter
/test/unit/mixed_test.rb
UTF-8
1,853
2.796875
3
[ "MIT" ]
permissive
require 'test_helper' class Bar < ActiveRecord::Base set_table_name 'orders' include Filterable filter_definition do fuzzy_name :strategy => :like, :attribute => 'product_name' end include Orderable order_definition do product_name end named_scope :carpet, lambda {|value| {:context => {:nam...
true
db1c184aadba5691816fb5beb78ee380521db719
Ruby
angeolea41/launch-school
/programming-foundations/lesson-3/exercise_1/question_5.rb
UTF-8
39
2.6875
3
[]
no_license
num = 42 puts (10..100).include?(num)
true
d89d293298e52495fb81ead74d0447d7d816ed4d
Ruby
mihado/ruby
/rspec_book/codebreaker/lib/codebreaker/marker.rb
UTF-8
882
3.53125
4
[]
no_license
class Marker def initialize(secret, guess) @secret, @guess = secret, guess end def total_match_count secret = @secret.split('') @guess.split('').inject(0) do |count, n| count + (delete_from_secret(secret, n) ? 1 : 0) end end # code.index returns the index of the first object for which ...
true
121a2b9e3edb566bdcb59a6233ddc7f481258280
Ruby
noshaf/DBC_Party
/library/song.rb
UTF-8
128
2.84375
3
[]
no_license
class Song attr_reader :name, :track_id def initialize(name, track_id) @name = name @track_id = track_id end end
true
280bf046bd7b46b4040619785303077c509f3301
Ruby
zohararad/Rmagickable
/lib/resizable.rb
UTF-8
3,660
2.671875
3
[ "MIT" ]
permissive
# = Resizable # === Rmagick image resizing module # # :title:Resizable # Author:: Zohar Arad module Resizable # enable Rmagickable::ClassMethods when plugin is first included def self.included(base) base.extend(ClassMethods) end # configuration class to encapsulate acts_as_resizable configuration class...
true
aab3ec0ffe17204998ded85dfadbf0befdfb05f7
Ruby
alexgrimes/ruby-oo-complex-objects-school-domain-chi01-seng-ft-051120
/lib/school.rb
UTF-8
1,093
4.28125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# code here! class School attr_accessor :name, :roster # initialize for an empty roster def initialize(name) @name = name @roster = {} end # Add a student as a key(grade) value(student name) pair # open up a new array and shovel students and grades into it. # it won't put...
true
af5de55f5a788ab4d3e5db6fae1dacff3622c1ee
Ruby
leonardobussi/api_twitter_ruby
/tweet.rb
UTF-8
891
2.796875
3
[]
no_license
require 'oauth' require 'json' class ApiTwitter CONSUMER_KEY = '' CONSUMER_SECRET = '' OA_TOKEN = '' OA_SECRET = '' BASE_URI = 'https://api.twitter.com/1.1/' def initialize consumer = OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, { site: 'https://api.twitter.com', scheme: :header }) token...
true
837f22b68940a24322d7ec46e9d32921a080cebf
Ruby
andrenho/andrenho
/_done/speeches/speeches.rb
UTF-8
2,269
3.03125
3
[]
no_license
# @q = quote require 'yaml' if ARGV.length != 2 puts 'speeches type file' puts 'where type = latex, html' exit 1 end if ARGV[0] == 'latex' type = :latex elsif ARGV[0] == 'html' type = :html else puts 'type = latex, html' exit 1 end speeches = YAML.load(IO.read(ARGV[1])) speeches.sort! { |x,...
true
694332c7e010857ec56b1237810b3e86eb3bbaec
Ruby
jtc27/makers-bnb
/spec/bnb_spec.rb
UTF-8
3,350
2.71875
3
[]
no_license
require 'bnb' require 'database_helpers' describe Bnb do let (:host_user_id) { create_host } let (:bnb) { Bnb.create( name:'The Shard', location: 'London', price: '300', description: 'wow!', user_id: host_user_id) } before { bnb } # create a new bnb (and object) that can be referenced...
true
e3a7d4d66730b31f07921225ef8a498f69207606
Ruby
tabulapdf/tabula-extractor
/lib/tabula/entities/table.rb
UTF-8
1,848
2.84375
3
[ "MIT" ]
permissive
class Java::TechnologyTabula::Table def to_csv sb = java.lang.StringBuilder.new Java::TechnologyTabulaWriters::CSVWriter.new.write(sb, self) sb.toString end def to_tsv sb = java.lang.StringBuilder.new Java::TechnologyTabulaWriters::TSVWriter.new.write(sb, self) sb.toString end def to...
true
4bee0cac578ab1ec4512ea23514ce55623271c18
Ruby
Andyreyesgo/Gen45
/Intro_objects/Challenge_2/carta.rb
UTF-8
286
3.390625
3
[]
no_license
class Carta attr_accessor :numero ,:pinta def initialize ( numero = Random.rand(1..13), pinta = ["C","D","T","E"].sample) @numero=numero @pinta=pinta end end 5.times do carta_azar = Carta.new() print carta_azar.numero puts carta_azar.pinta end
true
1ebad337c37262ea523e06c35945e8385c10753f
Ruby
phts/bin
/total-file-count-in-folders.rb
UTF-8
313
2.796875
3
[]
no_license
#!/usr/bin/ruby total = 0 (Dir.entries(Dir.pwd) - ['.', '..']).each do |dir| files = Dir.glob(File.join(dir, '**', '*')).reject{|p| File.directory?(p) } file_count_in_dir = files.count total += file_count_in_dir printf("%5d files in %s\n", file_count_in_dir, dir) end printf("%5d files total\n", total)
true
7778732bc90deeeab872136b0f5de20657cf9942
Ruby
telwell/learn_ruby
/09_timer/timer_orig.rb
UTF-8
1,440
4.125
4
[]
no_license
# This is my original answer which, as you can see, is a struggle. # I tried again after viewing some of the other answers. class Timer attr_accessor :seconds def initialize(seconds=0) @seconds = seconds end def time_string hours = 0 minutes = 0 temp_seconds = @seconds # I really only need this if ther...
true
cbc48913a0ee0a26a012697d551e51bb7dd75773
Ruby
Jin246039/tlstest
/tls/lib/record.rb
UTF-8
2,826
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # This file defines the record layer of the TLS protocol require_relative "change_cipher_spec" require_relative "alert" require_relative "application_data" module TLS module Record include TLS::Handshake class ContentType def ContentType.change_cipher_spec ...
true
5f179d8cb6eb5ce189ac00c7ede0e5a12cd826e5
Ruby
dayana-alonso/roadmap_ruby
/class-examp/xmas_example/holidayspirit.rb
UTF-8
323
3.09375
3
[]
no_license
class HolidaySpirit attr_reader :christmas def initialize(christmas) @christmas = christmas end def tree "A Big bushy #{christmas.xmas_tree}, " end def drinks "The smells of #{christmas.xmas_food} around the house fills your" end def spirit "#{christmas.xmas_spirit} with Christmas Joy!!" end en...
true
f64f227294b16ff96eb89668e4d53457bae97aba
Ruby
henri/lbackup_monitoring
/backup_server/backupscan.rb
UTF-8
26,454
2.609375
3
[]
no_license
#!/usr/bin/env ruby # Backup Scan # Licensed under the GNU GPL # (C)2008 Lucid Information Systems and Orion Transfer # Lucid Information Systems # http://www.lucidsystems.org # # Written by Samuel Williams and Henri Shustak # # Version 2.4 # About this script : # # This script is to be installed onto a bac...
true
b3b131b924a520820e65de2043d8ed6f81e52519
Ruby
hnatiwm4/Alberta_Historical_Cemeteries_dev
/app/models/burial.rb
UTF-8
1,121
2.5625
3
[]
no_license
# ############################################################################## # Author: Michael Hnatiw & Patrick Sawyer-Bennett # CMPT 498, Fall 2013 term # Alberta Historical Cemeteries Project # Burial model defines the implicit associations with other database elements #, defines their foreign keys, and correspon...
true
2ee93cdf88440fd2dac451c5fb11a718c4a0390e
Ruby
abdndev/Sinatra_site
/app1.rb
UTF-8
1,320
2.640625
3
[ "MIT" ]
permissive
settings.default_encoding = 'UTF-8' require 'rubygems' require 'sinatra' require 'sinatra/reloader' require 'sqlite3' get '/' do erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>" end ...
true
1328975f9e476ee3b831784f2ba9be7a93ad0473
Ruby
nickkaranatsios/ruby-utils
/movie-sorter.rb
UTF-8
1,101
2.828125
3
[]
no_license
require "fileutils" def make_dir path FileUtils.mkdir_p path unless File.exists? path end scan_dir = ARGV[ 0 ] || "." output_dir = ARGV[ 1 ] || "." Dir.glob( "#{ scan_dir }/**/*" ).each do | d | movie_file = File.expand_path( d ) next if movie_file == "." || movie_file == ".." next unless movie_file.to_s.upca...
true
88a41349ff4dd3de5a3f81f7af429cb5fc72d732
Ruby
verox/sample_app
/app/models/micropost.rb
UTF-8
858
2.703125
3
[]
no_license
class Micropost < ActiveRecord::Base attr_accessible :content belongs_to :user validates :content, presence: true, length: { maximum: 140 } validates :user_id, presence: true default_scope order: 'microposts.created_at DESC' # Return microposts from the users being followed by the given user scope :fr...
true
1bc1c94c7e75143a389f76c4dbac3a2a1687290c
Ruby
Romandsom/Thinknetica
/Lesson_6/passenger_car.rb
UTF-8
479
3.015625
3
[]
no_license
class PassengerCar extend InstanceCounter::ClassMethods include BrandNaming include Validate attr_reader :number def initialize(number) @number = number validate! end def validate! raise "Car must have a number" if number.empty? raise "Number has invalid format, word characters in one wo...
true
283912a558d503a2cb6ed74e299c0adb4a8e8f4c
Ruby
spark712/hang_man
/hang_man/lib/hang_man.rb
UTF-8
3,684
3.484375
3
[]
no_license
require 'yaml' class Hangman attr_accessor :chances, :i, :j, :misses, :correct, :secret_word, :show def initialize @chances = 6 @i = 0 @j = 0 @misses = [] @correct = [] @secret_word = '' @show = [] end def result(shw, scrt_wrd, i) puts `clear` if shw == scrt_wrd puts ...
true
ab69bede6a3c362a49014445618fa6e08ec62933
Ruby
sconover/tumblr2pdf
/spec/pdf/fake_pdf.rb
UTF-8
690
2.78125
3
[]
no_license
class FakePdf attr_reader :pages def initialize @pages = [] start_new_page end def current_font end def select_font(*args) end def start_new_page @pages << [] end def current_page @pages.last end def add_text_wrap(x, y, width, text, size, justification, angl...
true
4f0cf39551bce3c9fb2308395e02369f1872adb8
Ruby
jcole356/ShouldReads
/app/models/book.rb
UTF-8
1,791
2.71875
3
[]
no_license
class Book < ActiveRecord::Base validates :title, :author, presence: true has_many :reviews has_many :book_shelvings # Use this for seeding def self.get_book_from_api(title) query_string = title.scan(/\w+/).join('+') query_url = "https://www.googleapis.com/books/v1/volumes?q="\ "#{query_string...
true
9245d547854d2bd8629846f70a75eadf498b992e
Ruby
ashphy/vlsakurajima_server
/lib/tasks/admin.rake
UTF-8
346
2.53125
3
[]
no_license
namespace :admin do desc 'Add admin user' task :add, ['email', 'password'] => :environment do |task, args| user = User.new( email: args[:email], password: args[:password] ) if user.save puts "Congrats! #{user.email} is now an admin." else puts "Failed to create admin #{user....
true
b9bebe5a2485bfd780f1b88c90be7522958184ea
Ruby
aidenmendez/BotSavesPrincess
/Bot_Saves_Princess_1/spec/princess_spec.rb
UTF-8
405
2.671875
3
[]
no_license
require 'rspec' require './lib/princess' require './lib/grid' describe Princess do describe 'initialize' do it 'is an instance of princess' do grid = Grid.new(3, ["p--", "-m-", "---"]) princess = Princess.new(grid) expect(princess).to be_a Princess expect(princess.x).to eq(0) expec...
true
eaecaaa031a676ff4c67340a395e24561b191160
Ruby
webdevegit/Kre-Ruby
/app/lib/export/reviews_csv_export.rb
UTF-8
2,024
2.53125
3
[]
no_license
module Export class ReviewsCsvExport attr_reader :reviews, :timezone CSV_HEADERS = %w[product_id rating feedback customer_name customer_email comment status review_date verified media1 media2 media3 media4 media5 id product_name].freeze def initialize(reviews: Review.all, timezone: Time.zone) ...
true
3eaebf743ab032d008af46d2b32e143bbdd323bb
Ruby
bexfinken/phase-0-tracks
/ruby/6.6_game/wordgame_spec.rb
UTF-8
1,152
3.125
3
[]
no_license
require_relative 'wordgame' describe Game do let (:game) { Game.new(word, letters)} it "prompts word" do expect(game.word).to be_a_kind_of(String) end it "splits a word string into character strings" do expect(game.letters).to be_a_kind_of(Array) end it "sets the number of guesses" do expect(game.total_...
true
0c885537b55e63e0da278c5fda568152ed4ce8e7
Ruby
rahult/RubyLearning
/ruby_core/week_1/tests/test_table_generator.rb
UTF-8
866
2.59375
3
[]
no_license
require 'initialize/test_setup' require 'lib/table_generator' describe TableGenerator do before do @table = TableGenerator.new end describe "when asked about generating a formatted table of 9" do it "must generate a multiplication matrix of 9" do @table.multiplication_table(9).must_equal <<-eos....
true
4620071d03bfb20d75a3a5e38f377fc17cd5617d
Ruby
apires89/livecode-OOP-255
/app.rb
UTF-8
956
2.609375
3
[]
no_license
# TODO: require relevant files to bootstrap the app. # Then you can test your program with: # ruby app.rb require 'csv' require_relative "router" require_relative "app/models/meal" require_relative "app/repositories/meal_repository" require_relative "app/controllers/meal_controller" require_relative "app/models/cust...
true
3df3c2e8e9b485d9e101a4b9c94bad1d8db595e9
Ruby
asciidoctor/asciidoctor-pdf
/lib/asciidoctor/pdf/formatted_text/formatter.rb
UTF-8
1,709
2.578125
3
[ "MIT", "CC-BY-SA-3.0", "OFL-1.1", "LicenseRef-scancode-other-copyleft", "mplus", "CC0-1.0", "GPL-3.0-only", "GPL-2.0-only", "Apache-2.0", "Ruby" ]
permissive
# frozen_string_literal: true module Asciidoctor module PDF module FormattedText class Formatter include ::Asciidoctor::Logging attr_accessor :scratch FormattingSnifferPattern = /[<&]/ WHITESPACE = %( \t\n) NORMALIZE_TO_SPACE = %(\t\n) def initialize optio...
true
81273a98dc93c0ec29b63d799a8ac06da42153cb
Ruby
oflynned/JS-Assignments
/3D3 Networks/2016/Ruby Proxy/ProxyServer-master/modules/Cache.rb
UTF-8
1,698
3
3
[]
no_license
require 'fileutils' class Cache ##files needed #version.txt in root of site folder #subfolders containing requires files def initialize() puts "Cache module initialized" @directory = [] end def check_version(uri, version) if File.exists?(path) && !File.directory?(path) File.open(uri, ...
true
23be5583393ea2d268019569b4fb45f86c6c1f27
Ruby
Rainbow-Ninja/ruby
/me_playing/flashingStarsWithWords.rb
UTF-8
565
2.84375
3
[]
no_license
start = 0 stars1 = "* * * * * * * * * * * * *\n\n Hey sexy legs\n\n * * * * * * * * * * * * " stars2 = " * * * * * * * * * * * * \n\n Hey sexy legs\n\n * * * * * * * * * * * * " stars3 = " * * * * * * * * * * * * \n\n Hey sexy ...
true
7210aa0355bc9c2909ac8c23876bbb3b9bb42c82
Ruby
benjaminbenedict/Algorithum_Ladder
/Basic_String/First_Duplicate_Character.rb
UTF-8
879
4.3125
4
[]
no_license
# Given a string, find the first occurence of two duplicate characters in a row, and return the duplicated character. # Input: “abcdefghhijkkloooop” # Output: “h” def double_take(string) i = 0 output = "no duplicate letters" while i < string.length j = i + 1 letter_being_tested = string[i] while j <...
true
90f94899621698c06ceb401ed3dc415b97a6e377
Ruby
sodas43/Udemy
/DataAlgo_forPy/Stacks_Queues/queue.rb
UTF-8
417
3.5625
4
[]
no_license
class Queue def initialize @items = [] end def enqueue(item) @items.unshift(item) end def dequeue @items.pop() end def is_empty? @items.empty? end def size @items.length end end myQueue = Queue.new p myQueue.is_empty? myQueue.enqueue(1) myQueue.enqueue(2) myQueue.enqueue(...
true
448eac90d048950fefd89b9ea8f9fb7fcba43321
Ruby
department-of-veterans-affairs/caseflow
/lib/generators/random.rb
UTF-8
970
2.875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# frozen_string_literal: true class Generators::Random @unique_ssns = {} class << self def whitespace(len = 16) from_set([" ", "\n", "\r", "\t"], len) end def word_characters(len = 256) set = ("a".."z").to_a.concat(("A".."Z").to_a).concat(("0".."9").to_a).push("_") from_set(set, len...
true
215cb17f63e3562939aba8a2f9b7260128d445b8
Ruby
nicolefederici/oo-my-pets-v-000
/lib/dog.rb
UTF-8
244
3.453125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog attr_reader :name, :mood def initialize(name) @name = name @mood = "nervous" end def name=(name) raise NameError, "You can't change the name of the dog." end def mood=(emotion) @mood = emotion end end
true
d058a2e5b3c27b9f89b961492f45da418f893f9c
Ruby
thomasarch/inventory_manager
/viewer.rb
UTF-8
1,157
3.125
3
[]
no_license
require 'json' # handles drawing various views class Viewer def format_money(num) format('$%.2f', (num * 0.01)) end def show_sale(product) if product.sale == 1 'not on sale' else "#{product.show_sale} off .. Sale Price: #{product.sale_price}" end end def format_product(item) ...
true
82ff75c9ee96f13346150c75b27d83c564445c1b
Ruby
lolmaus/food_finder2
/lib/db.rb
UTF-8
2,116
3.078125
3
[]
no_license
# coding: utf-8 # «Магический комментарий», задающий кодировку содержимого. #Этот класс — заглушка. В нем декларируются пустые методы работы с БД. Эти методы должны быть реализованы #в дочернем классе. # #DB грузит все дочерние классы. Каждый дочерний класс добавляет в хэш DB.db_types элемент, ключом которого являетс...
true
ea46e6d5589e942ac683c2082b88086b55e20389
Ruby
mannnakakunn/inuinudouga0202
/app/models/animal3.rb
UTF-8
5,677
2.703125
3
[]
no_license
# encoding: utf-8 # URLにアクセスするためのライブラリの読み込み require 'open-uri' # Nokogiriライブラリの読み込み require 'nokogiri' require 'uri' @keys = { 感動: "心揺さぶる,涙,助け,救う,感動,セラピー,保護犬,迷い犬,再会,胸打,rescued,homeless,", かわいい: "かわいい,カワイイ,可愛い,子犬,息子,赤ちゃん,仔犬,ゴールデンレトリバー,少女,フレンチブルドッグ,ポメラニアン,秋田犬,かわいすぎる,孫,puppy", おもしろ: "激オコ,51匹,小春,カゴ,うとうと,寝落ち,ウトウト,Ju...
true
2c23d74c7e346b2eabdba57a98a24c51c6721dda
Ruby
chethan/ProjectEuler
/Ruby/ProblemThree.rb
UTF-8
996
3.765625
4
[]
no_license
#The prime factors of 13195 are 5, 7, 13 and 29. #What is the largest prime factor of the number 600851475143 ? require "Utils" class Problem_Three TARGET=600851475143 def self.mine factors=Array.new j=0; half_of_target=Math.sqrt(TARGET).ceil 2.upto(half_of_target){|i|...
true
a482766673bcb9759ef5984811cf94929af15c68
Ruby
mipqim/jungle-rails
/spec/models/user_spec.rb
UTF-8
2,876
2.640625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before(:each) do @user = User.new( first_name: 'Ftest', last_name: 'Ltest', email: 'test@test.com', password: 'password', password_confirmation: 'password' ) end describe 'Validations' do it 'is in...
true
07a9f45326d8f98cb051132f22226187934a56d0
Ruby
bgoodspeed/dopewars
/lib/palettes/i_s_b_p_result.rb
UTF-8
981
2.625
3
[]
no_license
class ISBPResult include ScreenOffsetHelper attr_reader :surface attr_accessor :actionable def initialize(sdl_surface, actionable, wrapped_surface) @surface= sdl_surface @actionable = actionable @wrapped_surface = wrapped_surface end extend Forwardable def_delegators :@actionable, :activate...
true
580afe890478d0734d924f1a99e1705de60c22d5
Ruby
markpothers/keys-of-hash-houston-web-career-021819
/lib/keys_of_hash.rb
UTF-8
482
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" class Hash def keys_of(*arguments) keys_array = [] self.each do |key, value| x = 0 while x < arguments.length if value == arguments[x] keys_array << key end x += 1 end end keys_array end end #animals = {"sugar glider"=>"Australia","aye-aye"=>...
true
a85f36e7c6c904d71bf5990cb7b041469b1d00ce
Ruby
teamon/railsbin
/web/app/services/client.rb
UTF-8
682
2.53125
3
[]
no_license
class Client attr_reader :address def initialize(address) @address = address end def info connection.get("info").body end def get(cid) connection.get("containers/#{cid}").body end def run(files) connection.post("containers", files).body end def stop(cid) connection.post("con...
true
b0be4367cda89b588394006bb4e8c073ca6f552e
Ruby
fanjieqi/LeetCodeRuby
/701-800/781. Rabbits in Forest.rb
UTF-8
245
3.171875
3
[ "MIT" ]
permissive
# @param {Integer[]} answers # @return {Integer} def num_rabbits(answers) count = 0 answers.sort! while !answers.empty? num = answers.shift count += (num+1) num.times { answers.shift if answers.first == num } end count end
true
3126399f0df9077f10439c3308876cca7f886ed6
Ruby
briemcnally/Whiteboarding
/lib/two_sum.rb
UTF-8
807
4.0625
4
[]
no_license
# Given an array of integers, return indices of the two numbers such that # they add up to a specific target. # You may assume that each input would have exactly one solution, and you # may not use the same element twice. # Example: # Given nums = [2, 7, 11, 15], target = 9, # Because nums[0] + nums[1] = 2 + 7 = 9, ret...
true
3a307888990edf2707a5fd89c9a050c528c0c029
Ruby
53cr/generate-vhosts
/generate-vhosts.rb
UTF-8
1,526
2.640625
3
[]
no_license
#!/usr/bin/env ruby begin require 'rubygems' rescue LoadError end require 'yaml' CONFIG_PATH = '/etc/httpd/conf' # No syntax checking whatsoever on the yaml files. You're on your own. class Vhost def initialize(args) # This might be dangerous? I'm pretty sure we can trust whoever's # writing our vhost ...
true
a64b7d406cabb7e381d2e199647af6a6eb606d34
Ruby
bradtacs/ruby_fundmentals1
/excercise3.rb
UTF-8
102
3.40625
3
[]
no_license
puts "What is your name" # gets stopps for a an answer name = gets puts "Hello #{name} how are you"
true
56c679c420da0c3acc19f5ed60b07b596d298495
Ruby
sogapalag/contest
/atcoder/arc061/b.rb
UTF-8
207
3.265625
3
[]
no_license
a=gets.chomp b=gets.chomp c=gets.chomp t=[a,b,c] cur = 0 while 1 if t[cur].size == 0 puts [:A,:B,:C][cur] exit end ch = t[cur][0] t[cur] = t[cur].slice(1,t[cur].size) cur = ch.ord - 97 end
true
c255b9a8399156c8a3a385f52019a46b37f0428a
Ruby
ckammerl/phase_0_unit_2
/week_5/3_guessing_game_solo_challenge/my_solution.rb
UTF-8
4,941
4.6875
5
[]
no_license
# U2.W5: Build a simple guessing game SOLO CHALLENGE # I worked on this challenge [by myself]. # 2. Pseudocode # Input: integer # Output: # #guess returns :symbol; # #solved? returns bolean value; # Steps: =begin WRITE a class GuessingGame WRITE a instance method #initalize to initalize new instances of the cl...
true