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
9db99348362dfef01f65eadb10c191803310999c
Ruby
axpepper/bringing-it-all-together-v-000
/lib/dog.rb
UTF-8
1,346
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog attr_accessor :id,:name,:breed def initialize(id: id=nil, name: name, breed: breed) @id=id @name=name @breed=breed end def self::create_table # DB[:conn].execute('CREATE TABLE dogs (id INTEGER PRIMARY KEY, name TEXT, breed TEXT)') end def self::drop_table DB[:conn].execute('DROP TABLE IF ...
true
a9d7bdcfe15acd6ef04b1acb93a9bb08fdda8a06
Ruby
glowreeyah/Inspiration-Bot
/lib/save_message.rb
UTF-8
755
3.03125
3
[ "MIT" ]
permissive
require_relative './database_manager' class SaveMessage include DatabaseManager def initialize(message_object) @user = message_object.chat.id @date = Time.at(message_object.date).strftime('%e %b %Y %k:%M') @message = message_object.text.to_s end def save_message date_and_message = "#{@date}: ...
true
650ba0bc1b5e5aa2520fba86691e39ee135b6608
Ruby
andrewslotin/weather_data
/lib/weather_data/humidity/relative.rb
UTF-8
325
2.578125
3
[ "MIT" ]
permissive
# -*- encoding : utf-8 -*- require 'delegate' module WeatherData module Humidity class Relative < ::SimpleDelegator def initialize(points) super points.to_f end def to_s "#{percentage}%" end protected def percentage __getobj__ end end en...
true
ef1774ed510f9239c612cc371c36d2867c67424a
Ruby
iamsammak/UnderstandingAlgorithms
/dijkstra/skeleton/lib/dijkstra2.rb
UTF-8
976
3.109375
3
[]
no_license
require_relative 'graph' require_relative 'priority_map' # O(|V| + |E|*log(|V|)). def dijkstra2(source) shortest_paths = {} possible_paths = PriorityMap.new do |data1, data2| data1[:cost] <=> data2[:cost] end possible_paths[source] = { cost: 0, last_edge: nil } until possible_paths.empty? vertex, da...
true
9ded2adf3ae5fe1810b7ccde9036a96c7fb6c28f
Ruby
firebroo/projecteuler
/problem50/ruby/problem50.rb
UTF-8
773
3.578125
4
[]
no_license
def isPrime(x) high = Math.sqrt(x).to_i for i in 2...(high+1) if x % i == 0 return false end end return true end def generateLimitAndPrimeList() primesSum = 0 #素数和 counter = 0 #计数器 number = 2 #初始化为2 lis = [] #素数列表 while primesSum < 1000000 if isPrime(number) primesSum += ...
true
7cd3770b6ed10212c779c5d5a40be3a88d5c890a
Ruby
rmcwilliam/Tiy-first-couple-weeks
/Unit-Testing/unit_test.rb
UTF-8
1,400
3.171875
3
[]
no_license
require 'minitest/autorun' require './coffee' require './human1' require "pry" ## This assignment made more sense when I wrote it in the morning. class CaffeineTest < MiniTest::Test def test_humans_tend_to_be_sleepy tyler = Human.new "Tyler" assert tyler.alertness < 0.1 # just adding 0.0 to alertness functio...
true
77d36cfdb81fa2cf82fc079449ec59bdf55cb75e
Ruby
tomski80/ProgFoundations-101
/SmallProblems/include.rb
UTF-8
332
3.15625
3
[]
no_license
def include?(array,value) array.each do |element| return true if element == value end false end def include?(array,value) array.any? { |el| el == value } end p include?([1,2,3,4,5], 3) == true p include?([1,2,3,4,5], 6) == false p include?([], 3) == false p include?([nil], nil) == true p include?([], ni...
true
87d16e87049cc5bbef9d2be232e6ba917b0f6592
Ruby
pdxrod/routesfordummies
/lib/routesfordummies.rb
UTF-8
4,910
3.171875
3
[ "MIT" ]
permissive
module Routesfordummies SLASH = '/' COLON = ':' DOT = '.' # Thanks http://openhood.com/rails/rails%203/2010/07/20/add-routes-at-runtime-rails-3/ # :app => Your application as a string - eg. 'Rockonruby' # :controller => The first part of the controller name as a string, eg. 'posts', not 'posts_controller' # :action ...
true
e574529a4fc1cf30a20ef89301431c4d5589501f
Ruby
waltertan12/app-academy
/w2/w2d1-w2d2/chess/piece/rook.rb
UTF-8
249
2.65625
3
[]
no_license
require_relative '../piece' require_relative 'modules' class Rook < Piece include Slideable def all_moves slideable_moves(DIRECTIONS[:vertical] + DIRECTIONS[:horizontal]) end def to_s "R" end def inspect "ROOK" end end
true
9f4c5829cb0d6ba4853a67b6b3754e2fc373b206
Ruby
net7/talia_testing_app
/app/helpers/ipod_dropdown_helper.rb
UTF-8
1,842
2.609375
3
[]
no_license
module IpodDropdownHelper # Includes all the javascript and styles needed for the ipod dropdown # # Note that this does *not* include the jquery framework which is needed # for the widget! def fg_menu_includes result = javascript_include_tag('fg.menu') result << stylesheet_link_tag('ipod-menu/fg.m...
true
0e433b7908ef6dd19ffd3bc2fdcb8bdfef9b42cb
Ruby
alejandrochang/AppAcademy-DailyWork
/W2D4-hw/big_o.rb
UTF-8
1,493
3.875
4
[]
no_license
#Big-O arr = ['fish', 'fiiish', 'fiiiiish', 'fiiiish', 'fffish', 'ffiiiiisshh', 'fsh', 'fiiiissshhhhhh'] # => "fiiiissshhhhhh" # 1) O(n^2) time def quadratic_biggest_fish(arr) arr.each_with_index do |fish1, i| max_length = true arr.each_with_index do |fish2, j| next if i == j max_length = false ...
true
fb666593f64105d6f56e7179977e32b339e66ee0
Ruby
Invoice-build/app-api
/app/models/concerns/tokenable.rb
UTF-8
681
2.78125
3
[]
no_license
# frozen_string_literal: true module Tokenable extend ActiveSupport::Concern def from_units(value) value / 1e6 end def to_units(value) (BigDecimal(value.to_s) * 1e6.to_i).to_i end class_methods do def tokenize(attribute, as:, validate: true) if validate validates as.to_sym, pre...
true
79a02c42b38bfddd276bf88ff35cb0476eb56618
Ruby
carlosmendes/sql_crud_livecode
/controller.rb
UTF-8
699
3
3
[]
no_license
require_relative "task" class Controller def initialize(view) @view = view end def add_task # ask the user for the task title user_task_title = @view.ask_user_for_task_title # create new task object new_task = Task.new(title: user_task_title) # send it to DB new_task.save end ...
true
1f2c9b1be6491cd65c6b9011f11adf53d7f34ff7
Ruby
ilanasufrin/math24
/spec/math24_spec.rb
UTF-8
708
2.828125
3
[]
no_license
require_relative "spec_helper.rb" describe Math24 do let(:math24) { Math24.new } it "should generate an array of numbers" do problem = math24.generate_problem() expect(problem.class).to eq(Array) expect(problem.size).to eq(4) expect(problem[0].class).to eq(String) end it "should generate a di...
true
0ef9a8150ccc1eaa67d6639b1b803f2a7ca11382
Ruby
mariamantar/Ruby_TA_Content
/calculator.rb
UTF-8
362
4.09375
4
[]
no_license
puts "Enter first number:" # store the answer in a variable num1 = gets.chomp().to_f puts "Enter Operator:" op = gets.chomp() puts "Enter second number:" num2 = gets.chomp().to_f if op == "+" puts (num1 + num2) elsif op == "-" puts (num1 - num2) elsif op == "*" puts (num1 * num2) elsif op == "/" puts (num1 /...
true
7a15ad790356589141eb2ad17dae9a892a2c8e80
Ruby
di8905/thinknetika
/lesson2/4.vowels.rb
UTF-8
312
2.90625
3
[]
no_license
ALPHABET = ("a".."z") VOWELS = ["a", "e", "i", "o", "u", "y"] wov_hash = {} ALPHABET.each_with_index do |letter, i| wov_hash[letter.to_sym] = i+1 if VOWELS.include?(letter) end #Несколько избыточно, но для тренировки с константами захотелось p wov_hash
true
65e52ab5bdc83ced787c7d2e35e803d646e808b2
Ruby
naokikurosawa/speed_gun
/lib/speed_gun/config.rb
UTF-8
1,092
2.53125
3
[ "MIT" ]
permissive
require 'hashie' require 'speed_gun' require 'speed_gun/store/memory_store' class SpeedGun::Config < Hashie::Dash # @!attribute [rw] # @return [Boolean] true if enabled speed gun property :enable, default: true # @!attribute [rw] # @return [Object, nil] logger of the speed gun property :logger, default: n...
true
eeccd94d638e606bba153ef13f260db8b5467199
Ruby
alexwebgr/password_manager
/app/models/user.rb
UTF-8
1,032
3.03125
3
[]
no_license
class User < ApplicationRecord validates :name, presence: true validates :password, presence: true, length: { in: UserService::MIN_LENGTH..UserService::MAX_LENGTH } validate :check_lowercase_exists? validate :check_uppercase_exists? validate :check_digit_exists? validate :check_repeating_chars? def check...
true
7d2ac0aec96c858622dcb3aa43da8ec673c1f8e5
Ruby
alexandrasia/Math_Game
/main.rb
UTF-8
134
2.671875
3
[]
no_license
require_relative './game.rb' puts "Welcome to the Math Game" go = Game.new go.play puts "Goodbye! Thanks for playing the Math Game"
true
7171441b1db4b663b3451301d9501f3d155306f4
Ruby
RobHaii/miniMips-Virtual-machine
/assembler/assembler-ruby/argument_validity.rb
UTF-8
4,303
3.1875
3
[]
no_license
#!/usr/bin/ruby $LOAD_PATH << '.' ############################################################################################ # this function is used to validate and # tokenize the arguments provided after instruction ############################################################################################ requir...
true
f6827f9c4460b359531b76be09b5f12c5d9267ee
Ruby
tclab/ruby_monk
/rubyPrimer/7.1-Lambdas_in_ruby.rb
UTF-8
228
3.90625
4
[]
no_license
#Lambdas in ruby # Lambda: A function without a name. # Example l = lambda { "Do or do not" } puts l.call Increment = lambda do |number| number.next() end puts Increment Increment2 = lambda {|num| num.next } puts Increment2
true
c2108970a9fd2c47dfa95cb211dfa412813d3c6a
Ruby
LLLencinas/tadp2013-2c
/tp_aspectos/src/join_point.rb
UTF-8
380
2.71875
3
[]
no_license
class JoinPoint def traer_metodos_una_clase(una_clase) una_clase.instance_methods(false).collect do |un_metodo| una_clase.instance_method(un_metodo) end end def traer_metodos_col_clases(col_clases) col_metodos = [] col_clases.each { |una_clase| col_metodos.concat(self.traer_metodos...
true
3f0e78d4178fc759881cea942de9eb8ea9caf0e5
Ruby
epfl-lasa/TutorialICRA2019.io
/vendor/ruby/2.3.0/gems/aws-sdk-core-2.10.125/lib/aws-sdk-core/checksums.rb
UTF-8
1,404
2.75
3
[ "Unlicense" ]
permissive
require 'openssl' require 'tempfile' module Aws # @api private module Checksums CHUNK_SIZE = 1 * 1024 * 1024 # one MB class << self # @param [File, Tempfile, IO#read, String] value # @return [String<SHA256 Hexdigest>] def sha256_hexdigest(value) if (File === value || Tempfile =...
true
1d66629a4b44ead2ad9cbc499bbe810b2499ce70
Ruby
luisvm/colimma
/app/helpers/main_helper.rb
UTF-8
553
2.84375
3
[]
no_license
module MainHelper def concat_links(*args) options = args.extract_options! raise "You need to pass link names and links respectively" if options[:link_names].blank? or options[:links].blank? raise "You need to pass the same number of link names and links" unless options[:link_names].size == options[:links...
true
38d720e84fb1deee97ab3279c5164b867d5c1876
Ruby
andywenk/page_performance
/lib/page_performance.rb
UTF-8
1,309
2.703125
3
[ "Apache-2.0" ]
permissive
# # This module includes the main method 'run' which is invoked # by the run_page_perfomance script # module PagePerformance # main method to be invoked # # @param [String] args input from command line def self.run(args) @argv_parser = PagePerformance::Utils::ArgvParser.new(args) @logger = PageP...
true
eab6178fff2202c6b9cb819480564e6c04940dc4
Ruby
johnschoeman/aa_algorithms
/W12D2/john_schoeman2/lib/p07_practical.rb
UTF-8
344
3.53125
4
[]
no_license
require 'byebug' require_relative 'p05_hash_map' def can_string_be_palindrome?(string) hash_map = HashMap.new string.split("").each do |ch| if hash_map.include?(ch) hash_map[ch] += 1 else hash_map[ch] = 1 end end odd_count = 0 hash_map.each do |k, v| odd_count += 1 if v.odd? e...
true
5538726ac5a1c4a42a66f1fb62d0c5e1eb2ef1b7
Ruby
bigos/Pyrulis
/Ruby/recursive_each_file.rb
UTF-8
713
2.59375
3
[]
no_license
#! /usr/bin/env ruby ##### some comment def do_it(path,file,level,more='') res=path+'/'+file #p more+res #if res.index 'user' if res[-3..-1] == 'erb' command = "html2haml #{res} > #{res[0..-4] + 'haml'}" p command `#{command}` end end def rec_each_file( path,level=0) Dir.new(path).each do |fi...
true
20c03d22ed6d92f1a1aa057e3d66884dbf9a7972
Ruby
akash121kumar/Training
/Ruby/Programs/find_greatest.rb
UTF-8
233
3.484375
3
[]
no_license
puts "*********To find the greates number in an array*************" a = [1,97,397,45,60,1000,56,78] puts "The array is :" print a , "\n" greatest=0 for i in 0...a.length if a[i] > greatest greatest = a[i] end end puts greatest
true
72973946163ae11f9deb25e9f7cd89b7a3f5c998
Ruby
hmahalik/apple_cloud_notes_parser
/lib/AppleNotesEmbeddedPublicJpeg.rb
UTF-8
3,914
2.875
3
[ "MIT" ]
permissive
require_relative 'AppleNotesEmbeddedThumbnail.rb' ## # This class represents a public.jpeg object embedded # in an AppleNote. This means you either took a picture or selected one that was taken already. class AppleNotesEmbeddedPublicJpeg < AppleNotesEmbeddedObject attr_accessor :primary_key, :uuid, ...
true
46d0a1ca6173df57d655b356b2ccf723361474eb
Ruby
thomthom/explode-images
/src/tt_image_exploder/core.rb
UTF-8
2,249
2.546875
3
[]
no_license
#------------------------------------------------------------------------------- # # Thomas Thomassen # thomas[at]thomthom[dot]net # #------------------------------------------------------------------------------- require 'sketchup.rb' #------------------------------------------------------------------------------- ...
true
b9f2fa78bd440ff5addfcd94ec3eb05897565bcd
Ruby
supreetha-hathwar/ruby_set3
/ruby basics/exercise1.rb
UTF-8
174
3.375
3
[]
no_license
a=[] puts a.empty? puts "print 15 times" 15.times{ puts "qwinix" } puts "Enter the Number" b=gets if(b.to_i%2==0) puts "Number is even" else puts "Number is odd" end
true
bfef00d97a602d4868c9cca7bdd0b52c825aea0c
Ruby
Yardboy/advent-of-code
/2018/puzzle10a/solution.rb
UTF-8
2,328
3.484375
3
[]
no_license
#!/usr/local/bin/ruby Point = Struct.new(:position, :velocity) do attr_reader :original_position, :original_velocity def move @original_position ||= position.dup @original_velocity ||= velocity.dup position[0] += velocity[0] position[1] += velocity[1] end end class Solution # answer is ZAEKAJ...
true
b61827fbb739ff207898d6afe78cb320d22443ed
Ruby
abutler3/RP_Search
/lib/movie.rb
UTF-8
277
2.65625
3
[]
no_license
class Movie attr_reader :id, :title, :year, :score def initialize(hash={}) @id = hash.fetch(:id) @title = hash.fetch(:title) @year = hash.fetch(:year) @score = hash.fetch(:score) end # def self.search(title) # Api.search_by_title(title) # end end
true
2b5e05309f047bbdfc2d487cd6fd1ccc41985983
Ruby
gjoyner09/Ruby_Battleship
/src/user_turn.rb
UTF-8
1,753
3.71875
4
[]
no_license
require_relative('board.rb') require_relative('print_board.rb') # method for the user's turn def user_turn(c_b, u_g_b, boats, fast) puts "Here is your guessed board:" sleep(1) if !fast puts print_board_outside_class(u_g_b) puts sleep(1) if !fast puts "Please enter the space you would like t...
true
928ca66ab523ff371d725632340cc7cb19862277
Ruby
stonegao/pandemic
/lib/pandemic/connection_pool.rb
UTF-8
5,120
2.796875
3
[ "MIT" ]
permissive
module Pandemic class ConnectionPool class TimedOutWaitingForConnectionException < Exception; end class CreateConnectionUndefinedException < Exception; end include Util def initialize(options = {}) @connected = false @mutex = Monitor.new @queue = @mutex.new_cond @available = []...
true
2b91e9e19b19b72b4aedf3b016fdc1ad42b7a12e
Ruby
morgvanny/jan-21
/cleanup-cli/bin/console
UTF-8
1,233
2.875
3
[]
no_license
#!/usr/bin/env ruby require_relative "../config/environment" # 3.times do # u = User.new(Faker::Name.name, Faker::Address.city) # instance_variable_set("@#{u.name.split(' ')[0].downcase.delete('.')}", u ) # end # biff = Character.new_from_hash({ # name: "Biff", # level: 5, # klass: "Knight", # strength:...
true
b1006d4b9c3d1037f54c4fc7ba2db99ddf3251a5
Ruby
andreydeineko/fyber-test
/lib/fyber_offers_request.rb
UTF-8
2,509
2.5625
3
[]
no_license
class FyberOffersRequest DEFAULT_API_HEADERS = { accept: :json, content_type: :json } MANDATORY_ATTRIBUTES = [ :uid, :pub0, :page ] API_CONFIGURATION = Rails.application.secrets[:fyber].symbolize_keys DEFAULT_API_PAYLOAD = API_CONFIGURATION.slice(:appid, :device_id, :locale, :ip, :offer_types) def i...
true
f3c197a8d2f3e63fd67adeb102b1ca91fa43d53f
Ruby
takagotch/ruby0
/awesomeruby/make_easy_possible/sort.rb
UTF-8
666
2.90625
3
[]
no_license
#!/usr/bin/env ruby #--- # Excerpted from "Build Awesome Command-Line Applications in Ruby 2", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that ...
true
4224bda463c56e21374e8677ede234c14e86c1d3
Ruby
p3drosola/Scripts
/tiny_domain.rb
UTF-8
1,000
3.03125
3
[]
no_license
require 'rubygems' require 'json' require 'open-uri' #require 'net/http' length = 4 debug = true a = %w"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 1 2 3 4 5 6 7 8 9 0" def APIRequest ( word ) url = "http://domai.nr/api/json/search?q=#{word}" resp = URI.parse( url ).read data = JSON.parse( resp ) if ...
true
2d56837cc5d2d25765b7b6b0ab6571079e26afce
Ruby
npatkar/Oncology
/app/models/contribution_type.rb
UTF-8
947
2.578125
3
[]
no_license
class ContributionType < ActiveRecord::Base # Table Relationships has_and_belongs_to_many :contributions # Returns an array of contribution_types for specified contribution / user pair # There "should" be only one result def self.find_by_user_and_contribution(user_id, contribution_id) # Ensure we alwa...
true
7af3092c6907e48a33562aa61602d65243e9a433
Ruby
rogeriozambon/hawking
/lib/hawking/job.rb
UTF-8
181
2.609375
3
[ "MIT" ]
permissive
module Hawking class Job class << self def put(queue, &block) @jobs = { "#{queue}" => block } end def all @jobs end end end end
true
81e42092b9fa0a9b3ffd32a3e2d4e49d2369c0bf
Ruby
DetechDev/simple_cms
/app/controllers/sections_controller.rb
UTF-8
4,182
2.53125
3
[]
no_license
class SectionsController < ApplicationController # Call the admin.html.erb layout file. If you don't call a specific file # Rails will default to using the application.html.erb file. layout 'admin' before_filter :confirm_logged_in before_filter :find_page def index list render('list') end de...
true
a096a3c85f0f0b57b1fecdbdad50d3d8abf4dc5f
Ruby
sbartek/almacen-soluciones
/app/models/ficha_proveedor.rb
UTF-8
558
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- class FichaProveedor < ActiveRecord::Base belongs_to :ficha belongs_to :proveedor validates :nombre, presence: true def proveedor_precio rep = "" if self.proveedor rep += "#{self.proveedor}: " else rep += "Desconocido: " end if self.precio rep += ...
true
7269d246899da7a5455e025f7e33badda84d0874
Ruby
WestDragonIroh/TIC-TAC-TOE
/main.rb
UTF-8
455
3.53125
4
[]
no_license
require_relative 'game' require_relative 'board' puts ' ' puts 'Welcome to console edition of TIC TAC TOE !!! ' puts ' ' def play game = Game.new game.start play_again end def play_again puts 'Would you like to play again? Type "Y" or "N".' respond = gets.chomp if respond == 'Y' || respond ...
true
75e95db7fcb6b0d9db65bb8204d5a58607c2a1cb
Ruby
zigvu/kheer
/app/data_importers/video_clip_map.rb
UTF-8
597
2.546875
3
[]
no_license
module DataImporters class VideoClipMap def initialize @videoFnClipId = {} end def getClipId(videoId, videoFn) clipId = nil getVideoFnClipIds(videoId).each do |clId, fnStart, fnEnd| if videoFn >= fnStart and videoFn <= fnEnd clipId = clId break end end clipId end private ...
true
5cdce29fc4ffe7ba9d3ec111aaf44f59098983e3
Ruby
threefoldtech/threefold-forums
/lib/mem_info.rb
UTF-8
524
2.796875
3
[ "Apache-2.0", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-other-copyleft", "GPL-2.0-or-later" ]
permissive
# frozen_string_literal: true class MemInfo # Total memory in kb. On Mac OS uses "sysctl", elsewhere expects the system has /proc/meminfo. # Returns nil if it cannot be determined. def mem_total @mem_total ||= begin system = `uname`.strip if system == "Darwin" s = `sysctl -n ...
true
e09aa078a8ef45e0a505f1b993be6bfd284fbde2
Ruby
ericcf/sapling
/spec/models/user_spec.rb
UTF-8
3,098
2.546875
3
[]
no_license
$:.unshift File.join(File.dirname(__FILE__), '..') require 'spec_helper.rb' describe User do it 'is valid with valid attributes' do User.new(:username => 'Foo', :password => 'Bar', :password_confirmation => 'Bar').should be_valid end it 'is not valid with a missing username' do ...
true
9b7488b4db9351873202726c65c8a3140c9375af
Ruby
rationality6/codewars
/8kyu/rb/opposite.rb
UTF-8
308
3.59375
4
[]
no_license
def opposite(n) if n > 0 return "-#{n}".to_f else return n.abs.to_f end end # puts opposite(5) # puts opposite(-5) # puts opposite(-1) # puts opposite(1) # puts opposite(0) def opposite2(n) -n end puts opposite2(5) puts opposite2(-5) puts opposite2(-1) puts opposite2(1) puts opposite2(0)
true
c483e0464e961176ed8314707e0a07677e6b5cc5
Ruby
mypark88/ProjectEuler
/037.rb
UTF-8
709
3.65625
4
[]
no_license
require 'prime' def truncPrime? n forward = n.to_s length = forward.length index = 0 while index != length unless Prime.prime? forward[index, length].to_i return false end unless Prime.prime? forward[0, index+1].to_i return false end ...
true
684f4bb1b6c1e9bd4ed41cf3cc39dfe3a552c43f
Ruby
jinx/migrate
/spec/csv/join/join_spec.rb
UTF-8
2,978
2.796875
3
[ "MIT" ]
permissive
require 'spec/csv/join/join_helper' shared_examples 'a join for all source fields' do it 'joins each record' do @output.size.should be 10 end it 'writes the output header row' do @output.first.should == ['A', 'B', 'U', 'X'] end it 'writes the matching source and target' do @output[1].should ==...
true
a4d5535d63c7718123388fbc8f217ee4d411f20a
Ruby
roneesh/coin_changer_with_testing
/lib/coin_changer.rb
UTF-8
557
3.765625
4
[]
no_license
class CoinChanger DENOMINATIONS = { 25 => "q", 10 => "d", 5 => "n", 1 => "p"} def make_change(amount) coins = [] DENOMINATIONS.each do |key, coin| while amount >= key coins << coin amount -= key end end # while amount >= 25 # coins << "q" # amount -=...
true
aef3028237c4bec3561aa69a9c911b90378a6a3e
Ruby
torresga/launch-school-code
/lessons/120_lessons/lesson_2/player.rb
UTF-8
1,658
3.96875
4
[]
no_license
require './move' require './input' class Player MAX_SCORE = 10 @@history = {} attr_accessor :name, :score attr_reader :move def initialize set_name @score = 0 @@history[name] = [] end def self.history @@history end def move=(move) @move = move @@history[name] << move end ...
true
275a7704a31e8a679441a1fec7dfaa718f1e899b
Ruby
teppi0512/furima---31074
/spec/models/item_spec.rb
UTF-8
4,035
2.609375
3
[]
no_license
require 'rails_helper' RSpec.describe Item, type: :model do before do @item = FactoryBot.build(:item) end describe 'ユーザー新規登録' do context '出品がうまくいくとき' do it "name,explain,category,sales_status,shipping_fee_status,prefecture,scheduled_delivery,priceが存在すれば登録できる" do expect(@item).to be_valid ...
true
ac9e7494c61876079e2075127470bd12e902da01
Ruby
knub/maglevrecord
/test/test_persistence.rb
UTF-8
2,878
2.546875
3
[]
no_license
require "more_asserts" require "maglev_record" require "example_model" class UnrootedPersistanceTest < Test::Unit::TestCase def setup MaglevRecord.reset end def new_unrooted_example_book UnrootedBook.example end def test_new_creates_new_object b = new_unrooted_example_book assert_not_nil b...
true
db53f7820c324ada3f113524e2ad16c2ffca232b
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/f39c8104239e40ba9f6c8e209d24e511.rb
UTF-8
299
3.296875
3
[]
no_license
class Hamming def self.compute(dna_strand_a, dna_strand_b) hamming_distance = 0 dna_strand_a.each_char.with_index do |base_pair_a, i| base_pair_b = dna_strand_b[i] hamming_distance += 1 if base_pair_b != base_pair_a && base_pair_b != nil end hamming_distance end end
true
c9846da623385a090661c15c6a46893f9a72bdb4
Ruby
zigzag/iTBD
/app/models/diary.rb
UTF-8
1,233
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Diary < ActiveRecord::Base WORKING_HOURS = 8.hours has_many :timelogs belongs_to :current_task, :class_name => "Task" after_initialize :set_default_date def set_default_date self.date ||= Date.today end def pulse timelogs.last.try(:update_attribute,:end_at,Time.now) if (current_task && d...
true
203f5c5ea27c2880513178b66091668f5a2c9d20
Ruby
AlanCramer/Image-Comparator
/deploy.rb
UTF-8
1,806
2.796875
3
[]
no_license
## usage: ruby deploy.rb test or ruby deploy.rb prod if (ARGV.size != 1) then puts "Usage: ruby : #{$PROGRAM_NAME} <env>"; puts "where <env> is either test or prod." puts "e.g. ruby #{$PROGRAM_NAME} test" exit end env=ARGV[0].strip puts "environment is #{env}" moveToFolder="test" if env =="prod" moveToFold...
true
9675c9e40e9be867802f9fa3d72dcb6a491e577c
Ruby
WeTransfer/pg_logger
/lib/pg_logger.rb
UTF-8
1,513
2.703125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module PgLogger # Maps PG notice levels to Ruby Logger levels POSTGRES_ERROR_MAPPING = { 'DEBUG' => :debug, 'LOG' => :info, 'INFO' => :info, 'NOTICE' => :warn, 'WARNING' => :warn, 'EXCEPTION' => :error, } DEFAULT_FORMAT = '[pg] %s'.freeze # Creates a Proc from the given Logger o...
true
47bd64e48e0b5aba77a92bcc506de4863f939ccd
Ruby
narduc/ruby-iteration-practice-cartoon-collections-sfo01-seng-ft-042020
/cartoon_collections.rb
UTF-8
835
3.625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarves)# code an argument here # Your code here dwarves.each_with_index { |v,x| puts "#{x + 1} #{v}" } end def summon_captain_planet(arr)# code an argument here # Your code here arr.map do |v| v.capitalize() + "!" end end def long_planeteer_calls(words)# code an argument here # ...
true
2775d53cc43de90c6b4eb34239f4925daa8a572d
Ruby
Sheep83/game_dev
/games/turn_monster/test/player.rb
UTF-8
2,078
2.96875
3
[]
no_license
require_relative('monster') require_relative('interface') require_relative('loot') require_relative('player') require_relative('game') require_relative( 'db/sql_runner' ) #define class for player class Player attr_accessor :health attr_accessor :name attr_accessor :type attr_accessor :xp attr_acc...
true
cc88758dbf19375153f62dbd057d4061bb817859
Ruby
foton/playlyfe-ruby-client
/lib/playlyfe_client/v2/game.rb
UTF-8
2,489
2.625
3
[ "MIT" ]
permissive
require_relative "./collection/player_collection.rb" require_relative "./collection/team_collection.rb" require_relative "./collection/leaderboard_collection.rb" require_relative "./collection/action_collection.rb" require_relative "./collection/metric_collection.rb" require_relative "./collection/event_collection.rb"...
true
8115ddd2466087e32946670cf44b949167a2a6d3
Ruby
mrkmx/thinknetica
/lesson_02/06_cart.rb
UTF-8
659
3.640625
4
[]
no_license
# cart = {"qwe"=>{:price=>1.5, :quantity=>1.0, :subtotal=>1.5}, "asd"=>{:price=>1.5, :quantity=>2.0, :subtotal=>3.0}, "zxc"=>{:price=>3.0, :quantity=>0.5, :subtotal=>1.5}} cart = {} loop do puts "Product" product = gets.chomp break if product == "stop" puts "Price" price = gets.chomp.to_f puts...
true
1df20cc258858e09a978a60f5bf5a20f3bc10476
Ruby
liannivin/codeable-exercises-wk2
/0305-ennumerable-rspec/tic-tac-toe.rb
UTF-8
2,637
3.859375
4
[]
no_license
# this gem injects a color method to the string when it is displayed by console require 'colorize' @level = 2 def draw_field(val, index) (val.is_a? Integer) ? (index + 1 < 10 ? " #{val}" : val) : " #{val}" end def draw_cell(cell, index) return draw_field(index + 1, index).to_s.white if cell == 0 return draw_f...
true
57efc97f0771159ba63130b7569de380c50291e1
Ruby
al002/exercism-ruby
/series/series.rb
UTF-8
195
3.3125
3
[]
no_license
class Series attr_reader :arr def initialize(s) @arr = s.split("") end def slices(n) raise ArgumentError if n > arr.length arr.each_cons(n).map { |a| a.join("") } end end
true
d78929ec40c305a66b676aebe868b525d9217dbc
Ruby
cdollins/ruby-xr
/lib/ruby-xr/XrTelnet.rb
UTF-8
3,992
2.5625
3
[ "MIT" ]
permissive
require 'net/telnet' require 'pp' class XrTelnet def initialize(console, auxilary, loc) puts "+#{Time.now}: Telnet initialized" `mkdir -p #{loc}` @con_conn = open_console(console, "#{loc}/console.log") @aux_conn = open_console(auxilary, "#{loc}/auxilary.log") @configs = Array.new end def o...
true
50fd4cade775ce10c0d480d5d48aa06b038b8293
Ruby
jkostolansky/codility
/03_time_complexity/01_frog_jmp.rb
UTF-8
84
2.828125
3
[ "MIT" ]
permissive
def solution(x, y, d) div, mod = (y - x).divmod(d) mod == 0 ? div : div + 1 end
true
8a5aae8119c0d26039f256a83e3c2a12c679cf81
Ruby
malakai97/easy_timers
/lib/easy_timers/timers.rb
UTF-8
3,682
3.5
4
[ "MIT" ]
permissive
require 'easy_timers/timer' require 'easy_timers/group' require 'time' module EasyTimers class Timers # Create a new Timers instance to hold our timers. # @return [Timers] def initialize() @group = Group.new() end # @overload after(time, name = nil, &block) # Schedule a block to be...
true
99f89cb457ca5086ae3c9f4d875c85b30e927247
Ruby
KeisukeMurata4210/Object-Oriented_Design_in_Ruby
/1st_time/chapter_3/3_isolating_instances.rb
UTF-8
2,080
3.34375
3
[]
no_license
# 依存を全て取り去るのが理想だが、既に存在しているアプリケーション上では # 厳しい制約があることがある。 その時は隔離を考える。 # 2章でstructクラスを使って責任を隔離したように、 # 状況が許すようになったら、依存を特定し削除できるよう、隔離する。 class Wheel attr_reader :rim, :tire def initialize(rim, tire) @rim = rim @tire = tire end def diameter rim + (tire * 2) end d...
true
007a70beb5e12cb976906d855d5b9744ebe6c24f
Ruby
ThothLogos/appacademy-prep
/08-two-sum.rb
UTF-8
1,216
4.5625
5
[]
no_license
# Write a method that takes an array of numbers. If a pair of numbers # in the array sums to zero, return the positions of those two numbers. # If no pair of numbers sums to zero, return `nil`. # # Difficulty: medium. def two_sum(nums) # Iterate through each number in the incoming array nums.each do |first| ...
true
1d3cf1d1be910e8c9282e8156bb30555b21e8f0a
Ruby
njpa/launchschool-ruby-basics
/08_return/05_breakfast_lunch_dinner_5.rb
UTF-8
722
4.4375
4
[]
no_license
# EX 5 # What will the following code print? # Why? Don't run it until you've attempted to answer. def meal 'Dinner' puts 'Dinner' end p meal # ANSWER # the `meal` method definition returns nil since the last line executed in the # method is a `puts` invocation, which always returns `nil`. # The `p` invocatio...
true
e48c657e3f9c97159e4673f74325a35b80582be3
Ruby
Cloudxtreme/thatsaboy
/api/app/commands/family/person_update_command.rb
UTF-8
952
2.75
3
[]
no_license
# Update a person(an adult or a child) command class Family::PersonUpdateCommand < Core::Command attr_accessor :id, :name, :photo_url, :model attr_accessor :person_repository validates :id, presence: true, 'Core::Validator::Exists' => ->(x) { x.person_repository.find_not_deleted(x.id) } validates :id, 'Core::V...
true
5378b69b3ada0902358b87dd6a511e3039c4b372
Ruby
JoseLopez235/the-last-airbender
/app/poro/character.rb
UTF-8
548
3.109375
3
[]
no_license
class Character attr_reader :name, :affiliation, :image def initialize(character) @name = character[:name] @allies = character[:allies] @enemies = character[:enemies] @affiliation = character[:affiliation] @image = character[:photoUrl] end def all_allies if @...
true
1cef51d3f246742ef3c5a30477da549807ac7ecb
Ruby
Mnargh/oystercard
/lib/journey_log.rb
UTF-8
749
3.4375
3
[]
no_license
# responsible for starting a journey # ending a journey # returning a list of journeys require 'journey' class JourneyLog attr_accessor :journey_class, :current_journey, :journeys def initialize(journey_class = Journey) # @journey_class initializes the Journey class but does not create a new instance @journe...
true
a20366128d36c2b70e8a7b9da40f56d2b7e6e937
Ruby
tecnologiaenegocios/tn_pdf
/spec/tn_pdf/table_column_spec.rb
UTF-8
2,060
3.015625
3
[]
no_license
require 'spec_helper' module TnPDF class Table describe Column do context "to be valid, needs a parameter that is" do specify "an Array" do creating_bad_column = Proc.new { Table::Column.new :not_an_array } creating_bad_column.should raise_error ArgumentError end ...
true
99216861e8562c8c448868afc58a093f0b42980f
Ruby
waltertan12/app-academy
/w2/w2d1-w2d2/chess/game.rb
UTF-8
3,372
3.5625
4
[]
no_license
#!/usr/bin/env ruby require_relative 'board' require_relative 'display' require_relative 'error' require_relative 'player' class Game def initialize @board = Board.new # @board = Board.stalemate_board @display = Display.new(@board) @selected_piece = nil @selected_pos = [] @players = initializ...
true
fd4da469e96b621d9aef4b093171d80619bd10ab
Ruby
latentflip/rubygolf
/lib/golf.rb
UTF-8
911
2.59375
3
[]
no_license
g=Golf=Hash def g.method_missing s, a k=[] case s.to_s[-1] when ?1 a.reduce :* when ?2 a.split.sort_by{|i| i[1] }*' ' when ?3 h1 1..a when ?4 a.map { |i| i. sub(/(man.*)/,'hat(\1)'). sub(/(dog.*)\)/,'\1(bone))'). sub 'cat','dead' } when ?5 a.size.times { |i| k += ...
true
d4aa437a4f167dba937ff6104a706d90af3087ad
Ruby
fariyal/ruby_set2
/ruby_basics/Task_1.rb
UTF-8
1,073
4.28125
4
[]
no_license
# 1) Take the following inputs mentioned below from the terminal console (take the input) and put the values to respective variables and print the variables in different line. # a) Employee name # b) Company name # c) Company address # 2) Write a ruby program to check whether the given number is divisible by 3. # 3)...
true
abd2101dff143f301e9ba1214fcb44e2f4c9e752
Ruby
terminalnode/codewars
/ruby/5k-mean-square-error/solution.rb
UTF-8
837
4.125
4
[]
no_license
# 5k Mean Square Error # https://www.codewars.com/kata/51edd51599a189fe7f000015/ # # Given two arrays of equal length, square the difference of # each entry ((a1[0] - a2[0])^2 and so on), then divide the # sum of the new list by it's length. def solution (a1, a2) a1.zip(a2) .map { |a| (a[0] - a[1]) ** 2 } .s...
true
76cae9680007f07addad49d64189251c2b6c5763
Ruby
sajib-hassan/code-practices
/codesignal.com/Trees-Basic/restoreBinaryTree/restoreBinaryTree.rb
UTF-8
798
3.421875
3
[]
no_license
# # Binary trees are already defined with this interface: # class Tree # attr_accessor :value, :left, :right # def initialize(val) # @value = val # @left = nil # @right = nil # end def restoreBinaryTree(io, po) @preIndex = 0 root = buildTree(io, po, 0, io.length - 1) root end def buildTree...
true
5ccbc1404798694ee40cb5632582597a2c88bcb6
Ruby
romero-c-raul/Ruby-Small-Problems
/easy_6/pr10.3.rb
UTF-8
3,211
4.5
4
[]
no_license
# Further Exploration # Right angle at any corner of grid =begin ALGORITHM - Accept an integer and right angle corner (Helper method 1) - If right angle starts from top left corner/ top right - Start with first row = all asterisks - If we want top left corner - remove asterisk from the front and add a space ...
true
1fba233b191cba1225039002638a81c034fbcb2a
Ruby
josiei/intro-to-ruby
/the_basics/four.rb
UTF-8
136
2.828125
3
[]
no_license
movies = { "A Day to Remember": 1975, "Juno": 2001, "Elmo": 2004, } dates = [] movies.each {| k, v | dates << v } puts dates
true
d15ea397b6becd24c020d41b514ec12184fa8fe8
Ruby
stevendaniels/web_minion
/lib/web_minion/cycle_checker.rb
UTF-8
726
3.140625
3
[ "MIT" ]
permissive
module WebMinion class CycleChecker attr_accessor :checked, :on_stack, :actions, :starting_action, :cyclical def initialize(starting_action) @checked = [] @on_stack = [] @starting_action = starting_action @cyclical = false check_for_cycle(starting_action) end def cycle?...
true
6c29b8b24ee3478bebd3feb804e5fe5b3af69144
Ruby
flatironlabs/mod-1-whiteboard-challenge-multiples-of-three-and-five-sfo-web-030920
/lib/oo_multiples.rb
UTF-8
450
3.78125
4
[]
no_license
# Enter your object-oriented solution here! class Multiples attr_accessor :limit def initialize(limit) @limit = limit end def collect_multiples nums = (1...limit).to_a nums.select do |num| if num.remainder(3) == 0 num elsif num.remainder...
true
8de6639e34961e82cd59a0bbce3029eaff001c3b
Ruby
djbender/netrunner
/bin/netrunner
UTF-8
439
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Trap interrupts to quit cleanly. See # https://twitter.com/mitchellh/status/283014103189053442 Signal.trap('INT') { abort } require 'netrunner' # Output message to $stderr, prefixed with the program name def pute(*args) first = args.shift.dup first.insert(0, "#{$PROGRAM_NAME}: ") args.uns...
true
fd8146243156059ad996fc297cfc35fdea12c330
Ruby
uach2016/ringley_reminder
/app/models/reminder.rb
UTF-8
1,370
2.8125
3
[]
no_license
class Reminder def initialize (rules) @rules = rules end def rules @rules end def on (date, estates) reminders = Array.new estates.each do |estate| charges = Charge.where('estate_code = ?', estate) charges.each do |charge| upcoming_due_dates = upcoming(charge, date) ...
true
f00b6adbeea9a81f185a21ee0255be046abef477
Ruby
33marvil/codea
/remplazar_vocales.rb
UTF-8
188
3.203125
3
[]
no_license
def replace_vowels(cambiar) remplazo = [] cambiar.each{|change| remplazo << change.gsub(/[aeiou]/i, 'x')} remplazo end p replace_vowels(["banana", "apple"]) == ["bxnxnx", "xpplx"]
true
730f479f3cad713aac3be65bbccd993a1c547580
Ruby
manoart/ruby_seminar
/paper/person.rb
UTF-8
350
3.515625
4
[]
no_license
class Person attr_accessor :name, :age, :footsize #fügt getter und setter ein # Konstruktor def initialize(name = "Hans", age = 42, footsize = 45) @name, @age, @footsize = name, age, footsize end # to_String-Methode geerbt von Object def to_s "Name: #{@name}\nAlter: #{@age}\nSchuhgroesse...
true
b64ef44c5b436075f0ed166431fa1d0718a2f820
Ruby
tictoc/savon
/lib/savon/logger.rb
UTF-8
1,298
3.03125
3
[ "MIT" ]
permissive
module Savon # = Savon::Logger # # Savon::Logger can be mixed into classes to provide logging behavior. # # By default, the Logger mixin uses {Ruby's Logger}[http://ruby-doc.org/stdlib/libdoc/logger/rdoc/] # from the standard library, a log level of :debug and is pointing to STDOUT. module Logger mo...
true
ea18ee655f6955c9bb20b1b241fc9e3bc69da94a
Ruby
IainDougan/understanding_programming
/Exercises/functions.rb
UTF-8
771
3.859375
4
[]
no_license
# def greet(name) # words = "Hey #{name}" # return words # end # # # puts greet("Iain") # puts greet("Rose") # puts greet("Jamie") # puts greet("Robert") # def customer_service(time_of_day, name, weather, temperature) # return "Good #{time_of_day} #{name}. The weather is #{weather}. The temperature is #{temperatu...
true
5932bbcf0536172870eb1a8da1f66959d82684a2
Ruby
team-saga/playlister-rb-unit-1
/lib/models/song.rb
UTF-8
507
3.140625
3
[]
no_license
class Song attr_accessor :name, :artist, :genre @@all = [] def initialize @@all << self end def self.all @@all end def self.count @@all.size end def self.reset_all @@all = [] end def genre=(genre) @genre = genre genre.add_song(self) end def artist=(artist) ...
true
346043afccfda5248dc07f12de57907d3e71a467
Ruby
axadn/app-academy-projects
/W2D1/chess/colorized_test.rb
UTF-8
151
2.6875
3
[]
no_license
require "colorize" require "colorized_string" String.colo puts "kuhujohj".colorize(:color => :light_blue, :background => :red) while STDIN.getc; end
true
5b30343917e33fe94877e979537bcdd4470c11d5
Ruby
hanami/helpers
/spec/unit/hanami/helpers/html_helper_spec.rb
UTF-8
4,105
2.65625
3
[ "MIT" ]
permissive
# frozen_string_literal: true RSpec.describe Hanami::Helpers::HtmlHelper do before do @view = HtmlView.new end it "has a private html builder" do expect { @view.html }.to raise_error(NoMethodError) end it "returns an empty tag" do expect(@view.empty_div.to_s).to eq(%(<div></div>)) end it "...
true
4e3c6c04e71403df07eb5bb80500b2c5e137b5de
Ruby
a2un/rubyexperiments
/urlprobe/lib/urlprobe/probe.rb
UTF-8
2,376
2.71875
3
[]
no_license
require_relative 'probelink' class UrlProbe::Probe def initialize(args) @url = args[0].to_s @interval = args[1].to_i #assumption interval in seconds @totaltime = args[2].to_i #assumption total time in minutes @start_time = 0 @countbatch = 1 @upto...
true
aa25e3047f2ec3aa48026872c4120fedfb476169
Ruby
jonzingale/RubyProcessing
/my_vacation/sand_piper.rb
UTF-8
1,399
2.8125
3
[]
no_license
URL_STUB = '/Users/Jon/Desktop/crude/RubyProcessing/my_vacation/' PI = 3.1415926 class SandPiper def initialize(width, height) @w, @h = width, height @r_ary = (0..2).map{|t| t/2.0} render_body end def trigs(theta) %w(cos sin).map{|s| Math.send(s, theta)} end def rota...
true
289b53f63bcd01b5d5a0e759504f4ef72e34adab
Ruby
nicolifelix/Ruby
/POO/POO-variaveis/atributos.rb
UTF-8
854
4.15625
4
[]
no_license
#classe dog com 2 métodos # #1º método lê/devolve variável de instancia(atributo) @name # class Dog # def name # @name # end # #2º método escreve a váriavel @name , parâmetro será recebido de fora # def name= name # #seta o valor # @name = name # end # end # #criando o objeto ...
true
c9f9b17ee80bd506156a0ab7ef7a5d7aa7aa8cc1
Ruby
robertosequeira/ruby-notes
/inheritance.rb
UTF-8
1,672
3.5625
4
[]
no_license
require_relative 'helpers' header('Inheritance') class Vehicle @@class_var = 2 @instance_var = 2 def self.class_var @@class_var end def self.instance_var @instance_var end end class Car < Vehicle @@class_var = 3 @instance_var = 3 end class Truck < Vehicle @@class_var = 4 @instance_var ...
true
1f861d091a8fd84765c61617b6e0be0d624c5dac
Ruby
PhilipDeFraties/backend_module_0_capstone
/day_3/exercises/ex30.rb
UTF-8
1,762
4.46875
4
[]
no_license
=begin people = 30 cars = 40 trucks = 15 if cars > people puts "We should take the cars." elsif cars < people puts "We should not take the cars." else puts "We can't decide." end if trucks > cars puts "That's too many trucks." elsif trucks < cars puts "Maybe we could take the trucks." else puts "We still...
true
595c951f632c387ade3ab6f1892f61c14cb287b7
Ruby
aliyalewis/oo-my-pets-seattle-web-051319
/lib/owner.rb
UTF-8
1,190
3.640625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' class Owner attr_accessor :pets, :name attr_reader :species @@all = [] def initialize(species) @species = species @pets = {fishes: [], cats: [], dogs: []} @@all << self end def self.all @@all end def self.count @@all.size end def self.reset_all @@all = [] end def say_...
true
4f7aeb004e1b17b57f823c1031a2b0c586cf200f
Ruby
chukimthang/drivy
/level3/models/car.rb
UTF-8
582
3.078125
3
[]
no_license
class Car # return array car with rental item def self.all begin data = File.open("./data/input.json") {|io| io.read} list_hash_data = data.empty? ? [] : eval(data) list_cars = list_hash_data[:cars] list_rentals = list_hash_data[:rentals] array_car = [] list_cars.each do...
true
4272c30e2eb6b89e007932f1db481fb0051831da
Ruby
rickpeyton/learntoprogram_chris_pine
/handbrake-helper.rb
UTF-8
784
2.734375
3
[]
no_license
puts 'Handbrake CLI Script Builder' # create a filename to hold the script output filename = 'handbrake.txt' # do a chdir to hold the filename Dir.chdir('/Users/rick/Desktop') puts 'Enter the directory that contains the videos' puts 'example: /Volumes/Media/uTorrent/TV/' video_dir = gets.chomp puts 'Enter the search p...
true