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
bdddcd10e8a2035e5c1c03be2b8f02d8e5b0d0eb
Ruby
tomdalling/advent_of_code_2016
/vec3_spec.rb
UTF-8
643
2.984375
3
[]
no_license
require_relative 'vec3' RSpec.describe Vec3 do it 'does vector operations' do v1 = Vec3[1,2,3] v2 = Vec3[4,5,6] expect(v1.to_a).to eq([1,2,3]) expect(v1 + v2).to eq(Vec3[5,7,9]) expect(v1 - v2).to eq(Vec3[-3, -3, -3]) expect(3 * v1).to eq(Vec3[3, 6, 9]) expect(-v1).to eq(Vec3[-1, -2, -3]...
true
5d0a387a9bf7e31b7d86fc350dca8c37affd70f9
Ruby
Cmajewski/ruby-music-library-cli-online-web-pt-071519
/lib/song.rb
UTF-8
913
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" class Song attr_accessor :name attr_reader :artist, :genre @@all=[] extend Concerns::Findable def initialize (name,artist=nil,genre=nil) @name=name self.artist=artist self.genre=genre save end def self.all @@all end def self.destroy_all @@all.clear end de...
true
14878cd9585017cfb1392e04b0149860604944dc
Ruby
ivx/serverless-workshop
/part-9/handler.rb
UTF-8
1,038
2.6875
3
[]
no_license
#!/bin/ruby require 'json' require 'httparty' require 'aws-sdk-dynamodb' DYNAMO_DB = Aws::DynamoDB::Client.new(region: 'eu-central-1') def temperature(event:, context:) db_query = { table_name: 'weather', expression_attribute_values: { ':id' => 1 }, key_condition_expression: 'locationId = :id'...
true
998eafb8118aaf692e789f1e010a7c9622e7dc84
Ruby
proyectoFilas/simulacionFilas
/InputManager.rb
UTF-8
550
3.03125
3
[]
no_license
load 'UI.rb' class InputManager def initialize @userInterface = UI.new() end def inputs input = Array.new() @userInterface.show("Digite:\n 1 Para sistema de única fila\n 2 Para sistema de múltiples filas") input << gets.chomp.to_i @userInterface.show("Ingrese el número de cajas activas") ...
true
2f7133532e75eef53825b9ad4bcb4cb1de7327b1
Ruby
david-meza/algorithms
/warmup/4_staircase.rb
UTF-8
333
3.34375
3
[]
no_license
# https://www.hackerrank.com/challenges/staircase/submissions/code/12571457 # Enter your code here. Read input from STDIN. Print output to STDOUT height = gets.chomp.to_i going_up = 1 going_down = height - 1 while going_up <= height print " " * going_down print "#" * going_up print "\n" going_up += 1 going_...
true
1741a2857e11a905f61417e0d10f4ffdf60c899d
Ruby
lukesherwood/tic-tac-toe-rb-online-web-sp-000
/lib/tic_tac_toe.rb
UTF-8
2,273
4.15625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0,1,2], #top row [3,4,5], #middle row [6,7,8], #bottow row [0,3,6], #left column [1,4,7], #middle column [2,5,8], #right column [0,4,8], #diagonal1 [2,4,6] #diagonal2 ] board = [" "," "," "," "," "," "," "," "," "] def displ...
true
12ab73fc8af4ea5d7c0ba1db652a8d0cddd8ae01
Ruby
dcuddhy/crm-data-challenge
/bin/run_02.rb
UTF-8
602
2.65625
3
[]
no_license
require_relative('../data/crm.rb') require 'pp' result = [] CRM[:companies].each do |company| CRM[:people].each do |person| person[:employments].each do |employment| unless person[:employments].empty? employments_hash = { :company_id => company[:id], :commpany_name => company[...
true
21e83d7fc3b8f45538b621d454b892f0ca23dada
Ruby
gustavoescocard/isbn13_generator
/lib/isbn_calculator.rb
UTF-8
371
3.4375
3
[ "MIT" ]
permissive
class IsbnCalculator attr_accessor :number def calculate_last_digit(number) array_number = number.to_s.chars.map(&:to_i) array_number.each_with_index do |n, index| array_number[index] = index.even? ? n * 1 : n * 3 end mod_isbn = array_number.sum.modulo(10) last_digit = mod_isbn > 0 ? ...
true
adf563d31c980e5ffd4e1e4d21612e0caab625bc
Ruby
JacopoCortellazzi/rubyassignment
/one/src/my_test.rb
UTF-8
946
3.40625
3
[]
no_license
require 'test/unit' class Array def dd(other) return false unless other.kind_of? Array return false unless other.size == self.size return self.all? { |e| other.include?( e ) } end end class TestPerson attr_accessor :name, :age def initialize(name, age) @name, @age = name, age end def <=>(o...
true
22683c20f907181aebfc19cde4af977446505852
Ruby
randallreedjr/getto24-sinatra
/app/controllers/get_to_24_controller.rb
UTF-8
1,905
2.625
3
[ "MIT" ]
permissive
class GetTo24Controller < ApplicationController get '/' do erb :'get_to_24/index' end get '/about' do erb :'get_to_24/about' end get '/problem' do problem = Math24.generate_problem.join(" ") erb :'get_to_24/problem', :locals => {:problem => problem} end get '/solve' do erb :'get_to_...
true
05c6bf63a7e4b91938a51888f6c61ad6f6047faa
Ruby
sgdoolin/ruby_spring_pt
/color.rb
UTF-8
397
4.1875
4
[]
no_license
# Ask the user for their favorite color # If they answer # -Blue # -Green # say good choice" # Otherwise say # Say the color and say it stinks puts "What's your favorite color?" favorite_color = gets.chomp if favorite_color.downcase == "blue" || favorite_color.downcase == "green" puts "Good choice. That's a great co...
true
84f7f1cf81eb80a656f3fb44555347ed3facd8b7
Ruby
josephecombs/Chess
/pieces/knight.rb
UTF-8
1,401
3.125
3
[]
no_license
# require './stepping_piece.rb' class Knight < SteppingPiece attr_accessor :string_representation attr_reader :color def initialize(board, color, coordinates) @string_representation = "n" @color = color @coordinates = coordinates @board = board end def offsets [[ 2, 1], [ 2,-1], ...
true
2708231d7a1fdc84c3bed723af1d9bdf496dc327
Ruby
Rasit1/Exercices-Ruby
/exo_15.rb
UTF-8
164
3.390625
3
[]
no_license
puts "Votre année de naissance? " print ">" anneeUser = gets.chomp age =0 for i in (anneeUser.to_i..2017) puts "En #{i}, vous avez #{age} an(s) " age += 1 end
true
74d5276841bd4615322f6880dfa46a069b76252b
Ruby
geka0396/Ruby
/Leeson_1/hello3.rb
UTF-8
179
2.921875
3
[]
no_license
puts "Как тебя зовут?" name = gets.chop puts "В каком году родился?" year = gets.chop puts "#{name}, privet! Tebe primerno #{2019 - year.to_i} let."
true
1ce716cc0237666683be469e3b7b9244216b7aca
Ruby
matt-morris/project-euler
/5.rb
UTF-8
882
3.796875
4
[]
no_license
# Smallest multiple # Problem 5 # 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. # What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? # (1..Float::INFINITY).each do |n| # if (1..20).select { |i| n % i == 0 }.c...
true
fbb022d9dcf96b09d6751a628f788751ce548f0d
Ruby
Cooky90/LaunchSchool
/ProgrammingFoundations-101/Small-Exercises/Easy-7/Exercise10.rb
UTF-8
310
3.71875
4
[]
no_license
def penultimate(string) string.split[-2] end penultimate('last word') == 'last' penultimate('Launch School is great!') == 'is' # Further Exploration # def middle_word(string) middle = ((string.split.size).to_f/2).round string.split[middle - 1] end middle_word('hello this is a test') middle_word('')
true
e25950eee3e24c45919550eb4be3b1f1964ad774
Ruby
visitvinoth/tw
/app/libraries.rb
UTF-8
468
3.34375
3
[]
no_license
class Fixnum @@roman_literal_map = [["M",1000],["CM",900],["D",500],["CD",400],["C",100],["XC",90],["L",50],["XL",40],["X",10],["IX",9],["V",5],["IV",4],["I",1]] def self.from(roman_string) sum = 0 for key, value in @@roman_literal_map while roman_string.index(key)==0 sum += value roman_string.slice!(k...
true
4d115fd469d9ff9e2c8d770eb5162cef6132424f
Ruby
dominikgrygiel/appetite-0.1.0
/test/test__router.rb
UTF-8
4,801
2.84375
3
[ "MIT" ]
permissive
module AppetiteTest__Appetite class App < Appetite format :html, :xml def index action end def exact arg arg end def post_exact arg arg end def one_or_two arg1, arg2 = nil [arg1, arg2] end def one_or_more arg1, *a [arg1, *a] end def...
true
9f6b488ea1c511067801e52b74091576aa344ee0
Ruby
barruda/invoice-revolution-pro
/app/actions/invoice_pay.rb
UTF-8
913
2.578125
3
[]
no_license
# frozen_string_literal: true class InvoicePay def process(params) @invoice = Invoice.find_by_invoice_id(params[:invoice_id]) if !@invoice || @invoice.status == (InvoiceStatus::CHARGEBACKED || InvoiceStatus::PAID) raise Business::InvalidTransactionException end payment = Payment.new(params) ...
true
73da3394477d909b8e812bb5c20f4499875c03bc
Ruby
sealink/app_launcher
/app/models/service.rb
UTF-8
956
2.59375
3
[]
no_license
class Service attr_reader :id ALLOWED_TYPES = %w(solr resque-pool schedule unicorn) def initialize(app_id, id, service_type) if !ALLOWED_TYPES.include?(service_type) raise ArgumentError, "Unknown service type: [#{service_type}]" end @app_id = app_id @id = id @service_t...
true
71891de8ea90613f4e2c320fa50061aad122a4b3
Ruby
puppetlabs/puppetlabs-amazon_aws
/tasks/cloudfront_aws_create_streaming_distribution2018_06_18.rb
UTF-8
1,995
2.734375
3
[]
no_license
#!/opt/puppetlabs/puppet/bin/ruby require 'puppet' require 'aws-sdk' def CreateStreamingDistribution2018_06_18(*args) puts "Calling task operation CreateStreamingDistribution2018_06_18" argstring=args[0] argstring=argstring.delete('\\') arg_hash=JSON.parse(argstring) #Remove task name from arguments ...
true
4440b81f060b900b54a1001bce75687a7a623547
Ruby
dota2arena/dota2arena_courier
/lib/dota2_arena_courier/team.rb
UTF-8
1,645
2.953125
3
[ "MIT" ]
permissive
class Dota2ArenaCourier::Team attr_reader :win, :players, :kills, :deaths, :assists, :xpm, :gpm, :net_worth, :last_hits, :denies, :lvl_ups, :level def initialize(players, radiant_win) @players = players @win = check_if_win(radiant_win) end def set_attributes kills = 0; deaths = 0; assists = 0 ...
true
660f0148499be09ade8cd3c7ea5f1e7108268dab
Ruby
GeeVeldek/rails-longest-word-game
/app/controllers/games_controller.rb
UTF-8
1,055
3.375
3
[]
no_license
require 'json' require 'open-uri' class GamesController < ApplicationController def new @letters =[] 10.times{ @letters << ("a".."z").to_a.sample.capitalize } end def score letters = params[:letters] letters_a = letters.split(' ') word = params[:word].upcase url = "https://wagon-dictiona...
true
64978f040d123c1b6b9b7bbfa6e23a8da6348644
Ruby
d12/leetcode-solutions
/0392-is_subsequence.rb
UTF-8
250
3.5
4
[]
no_license
# O(n) time, O(1) space def is_subsequence(s, t) if s.length == 0 return true end s_index = 0 t.chars.each do |c| if c == s[s_index] s_index += 1 end if s_index == s.length return true end end false end
true
72d85cbc8f508c000c73b4a983e6e0374facdaa4
Ruby
apricots/learntoprogram-exercises
/Exercises/6.rb
UTF-8
425
3.703125
4
[]
no_license
# puts 'What is your first name?' # name1 = gets.chomp # puts "What is your middle name?" # name2 = gets.chomp # puts "What is your last night?" # name3 = gets.chomp # nametotal = name1 + name2 + name3 # puts 'Did you know there are ' + nametotal.length.to_s + ' characters in your name?' # angry boss # puts "WHAT DO ...
true
07e12722da2b17e0602b4ddddafe91e8367ebbdf
Ruby
andela/ruby-reduce-exercise
/reducer_answers.rb
UTF-8
1,069
3.453125
3
[]
no_license
# attr_reader :object # # def initialize(object) # @object = object # end # # def reduce # object.reduce(Hash.new(0)) do |memo, number| # memo[number] = memo[number] + 1 # memo # end # end # # def initialize(object) # @object = object # end # # def reduce #...
true
a51ea5da53e7369aaea4eb5d03cbbe3f43bfa8a6
Ruby
echobind/cat
/lib/custom_utilities.rb
UTF-8
123
2.671875
3
[ "MIT" ]
permissive
module CustomUtilities def convert_string_array_to_integer_array(strings_array) strings_array.map!(&:to_i) end end
true
ced95ff5692e127907c43ce6d998ac4b93f60005
Ruby
akavinash1994/ruby_training
/code/item.rb
UTF-8
456
3.34375
3
[]
no_license
require_relative 'tax_calculator' class Item include TaxCalculator attr_accessor :name, :cost, :quantity, :detail def initialize(item) @detail = item assign end def assign @cost = detail[-1].to_f @quantity = detail[0].to_f @name = detail[1..detail.length - 3].join(' ') end def displa...
true
cde07430a8f3e8557b174ae66b86416c63330d4a
Ruby
mariusz-kowalski/char_canvas
/lib/char_canvas.rb
UTF-8
373
3.421875
3
[ "BSD-2-Clause" ]
permissive
# documentation in README file class CharCanvas def initialize @canvas = [] end def insert(string, line, column = 0) @canvas[line] ||= [] string.each_char do |char| @canvas[line][column] = char column += 1 end end def paint @canvas.each do |line| line.each { |char| prin...
true
c4fc216c935bfa9a8428544fc0b81e9b19b02c72
Ruby
ldgarber/sinatra-workout-planner
/app/controllers/application_controller.rb
UTF-8
4,580
2.578125
3
[]
no_license
require './config/environment' require 'rack-flash' class ApplicationController < Sinatra::Base ADJECTIVES = ["sexy", "strong", "powerful", "courageous", "hardworking", "beautiful", "intimidating", "classy", "foxy", "studly", "tenacious"] NOUNS = ["beast", "devil", "human", "athlete", "specimen", "fighter", "stud...
true
81bd01e33eef35c6913d2c52b5e8842b0ac7036d
Ruby
yicheng-w/competitive_programming
/contests/codejam/codejam2017/quals/tidynumbers.rb
UTF-8
1,411
3.734375
4
[]
no_license
# Input # T # for q in T # N def main() _T = gets.chomp.to_i _N = nil # puts "TEST T is #{_T}" (1.._T).each do |q| _N = gets.chomp.to_i w = get_last_tidy(_N) print "Case ##{q}: " # test(_N) print "#{w}" puts end # [129, 999, 7, 123, 321, 2220, 12342372 ].each do |n| # # test(n) # end ...
true
1f611cdc645d840d158cbb39d679ded99bf5e546
Ruby
JFVF/cucumber_022015
/Vanessa/Session 6/array.rb
UTF-8
706
4.46875
4
[]
no_license
=begin Array examples =end nums = [1, 3.0, 'something', 'something else'] puts 'Third element:' puts nums[2] puts 'Last element:' puts nums[-1] puts 'Last element:' puts nums.last puts 'First element:' puts nums.first puts "\n" mystuff = ['samsung', 'nokia', 'iphone'] puts 'Length of mystuff' puts mystuff.length ...
true
75043d69726465a33d94e647c2e337699d4782bc
Ruby
phyzical/advent-of-code
/2020/17.1.rb
UTF-8
2,624
3.234375
3
[]
no_license
require_relative "helpers" module DaySeventeenPartOne module_function def solve(file) grid = { "0": prepare_inputs(file) } 6.times { grid = do_cycle(grid) } byebug grid.reduce(0) do |acc, slice| acc + slice.reduce(0) do |acc2, val| acc2 += 1 if val == "#" acc2 ...
true
11b0144cb8f45d1073e00c7b7f49da3dc7a10372
Ruby
deependersingla/ruby_script
/athinkkingapecircle.rb
UTF-8
419
3.078125
3
[]
no_license
def array(a) @array=a #print @array for i in 0...@array.length-1 if (i==1 or i.odd?) #print i @array[i]=@array[i+1] end i=i+1 end m=@array.uniq return m end print " enter n " d=gets.chomp d=d.to_i j=0 #d.chomp #print d #print " ia m here" #print d.type c=(1..d).to_a k=c for l in 0..d ...
true
191f6f7c690f64d6976993fd04960a990329981b
Ruby
IlyaMur/ruby_learning
/Simdyanov_exercises/Chapter 10/1.rb
UTF-8
83
2.921875
3
[]
no_license
num1 = gets.to_i begin num2 = gets.to_i end while num2 == 0 puts num1 / num2
true
2e0e16296e5f6b3afe2d3e62f4ca9f4d2f15a6b0
Ruby
qermyt/miniputer
/lib/miniputer/physics/simulator.rb
UTF-8
877
2.84375
3
[ "MIT" ]
permissive
module Physics class Simulator def initialize @clocks = [] @electric_flow = ElectricFlow.new end def flow_size @electric_flow.wireflow.size end def hook_up_clock(clock) @clocks << clock end def hook_up_electric_flow(flow) @electric_flow = flow end ...
true
bc124022bb7000c255475a345f0d67a5742ae783
Ruby
tarcieri/celluloid-io
/lib/celluloid/io/tcp_socket.rb
UTF-8
2,667
2.78125
3
[ "MIT" ]
permissive
require 'socket' require 'resolv' module Celluloid module IO # TCPSocket with combined blocking and evented support class TCPSocket include CommonMethods extend Forwardable def_delegators :@socket, :read_nonblock, :write_nonblock, :close, :closed? def_delegators :@socket, :addr, :pee...
true
5763e4098352a3dc299b0893ea5d10847c3c76bc
Ruby
evangoad/squidbuilds
/util/splat_scraper/lib/splat_scraper/wikia/article_table.rb
UTF-8
359
2.59375
3
[ "MIT" ]
permissive
module SplatScraper::Wikia::ArticleTable def extract_table(table_node) rows = table_node.xpath("tr[td]") header = table_node.xpath("tr[th]").xpath("//th/text()").map {|n| n.to_s.strip} rows.map do |row| obj = {} header.each_with_index do |h, i| obj[h] = row.xpath("td")[i].text.strip ...
true
843322e145118aaf9fb95e39b9b67b6ebdfaaf73
Ruby
haydenwalls/fibonacci
/lib/fibonacci.rb
UTF-8
690
4.0625
4
[]
no_license
# Computes the nth fibonacci number in the series starting with 0. # fibonacci series: 0 1 1 2 3 5 8 13 21 ... # e.g. 0th fibonacci number is 0 # e.g. 1st fibonacci number is 1 # .... # e.g. 6th fibonacci number is 8 def fibonacci(n) if n == 0 return 0 elsif n == 1 return 1 elsif n.class != Integer || n <...
true
e55db81adaa05057be3bca472ff48920fee5da4c
Ruby
jhelman22/challenges
/project_euler/012.rb
UTF-8
1,264
4.71875
5
[]
no_license
# Problem 12 # # The sequence of triangle numbers is generated by adding the natural numbers. # So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: # # 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... # # Let us list the factors of the first seven triangle numbers: # # 1: 1 # ...
true
aedaa13889b4a2496cf75bdcab8205e3e06df6f3
Ruby
wchu248/MailerTest
/app/models/user.rb
UTF-8
3,632
2.609375
3
[]
no_license
class User < ApplicationRecord # Daily Wellness Survey @ 10 AM everyday def self.email_all User.all.each do |u| UserMailer.pre_practice_email(u).deliver_now end end # Men's Basketball 5 @ 7PM def self.email_mbb User.all.each do |u| if u.team_id == 5 UserMailer.post_practic...
true
0479029b5c97e0c3002548377f37792730aa20a1
Ruby
christiano57/MyProject
/ruby/prework/day2.rb
UTF-8
89
3.171875
3
[]
no_license
class Car def say_broom puts "Broom" end end corvette = Car.new corvette.say_broom
true
284a717bceff427af3950f7ea7849b214d36d431
Ruby
febbraiod/my_find_code_along-v-000
/lib/my_find.rb
UTF-8
125
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def my_find(collection) collection.each do |i| if yield(i) return i end end nil end
true
eea8d5d1955b9ab2aa337cc1e5127642ff564d0d
Ruby
shadefinale/danebook
/spec/models/post_spec.rb
UTF-8
2,221
2.515625
3
[]
no_license
require 'rails_helper' describe Post do let(:post) { create(:post) } describe '#posted_on' do it 'should respond to posted on method' do expect(post).to respond_to(:posted_on) end # This test fails based on local time. # it 'should have a human readable posted on date' do # expect(pos...
true
ad44503ac8b73994505e0ad8b8aed065edf874cb
Ruby
miriamhit02/flash_cards
/spec/round_spec.rb
UTF-8
5,286
3.5
4
[]
no_license
require 'pry' require './lib/card' require './lib/turn' require './lib/deck' require './lib/round' RSpec.describe Round do it 'exists' do card_1 = Card.new("What is the capital of Alaska?", "Juneau", :Geography) card_2 = Card.new("The Viking spacecraft sent back to Earth photographs and reports about the sur...
true
914593b9ca0ec98e5bbb25ad630b9720e924f6e8
Ruby
APWilson97/Ruby-programming-intro
/Arrays/exercise6.rb
UTF-8
162
3.046875
3
[]
no_license
'The user is attempting to change the value of the margaret element in the names array using a string as a key but array indexes are integers.' names[3] = 'jody'
true
1e30f5703993dafbb837c9f3370198939aca69e3
Ruby
tmtysk/mbmail
/lib/tmail/mail.rb
UTF-8
836
2.6875
3
[ "MIT" ]
permissive
module TMail # Mail 構築時に MessageIdHeader が正しく作成できない処理を修正 class Mail def []=( key, val ) dkey = key.downcase if val.nil? @header.delete dkey return nil end case val when String header = new_hf(key, val) when HeaderField # HeaderField が与えられた場合...
true
b6ce95faa0bb5f522fe6cce4e74c99c9a57b913d
Ruby
chischaschos/tic-tac-toe-pairing-with-pollo
/lib/tictactoe/game.rb
UTF-8
222
2.640625
3
[]
no_license
module Tictactoe # Game is the persisted representation of a tictactoe game class Game attr_reader :id def initialize(id: nil) @id = id end def ==(other) other.id == @id end end end
true
c908e7fcec7d236834f875c03ace464a9f24a470
Ruby
ashivkum/OpenWeatherApplication
/app/models/weather.rb
UTF-8
3,635
3.453125
3
[]
no_license
require 'pry' require 'net/http' require 'json' class Weather @@CONVERSION_FACTOR = 1.8 @@KELVIN_FACTOR = 273.15 @@FARENHEIT_FACTOR = 32 # Approximate conversion factor m/s to mph, taken from Google @@WIND_CONVERSION_FACTOR = 2.23694 =begin The following methods handle the external dependencies a...
true
c07451a0a6f7aaf70ad1704369d50ecd328077c7
Ruby
ESCasson/Ruby_Project_The_Gym
/models/member.rb
UTF-8
1,569
3.4375
3
[]
no_license
require_relative('../db/sql_runner.rb') class Member attr_reader :id attr_accessor :first_name, :last_name, :premier_member def initialize(details) @id = details['id'].to_i if details['id'] @first_name = details['first_name'] @last_name = details['last_name'] @premier_member = details['premier_m...
true
1d2dfa5bbdb70e42b96b9d6203804e3903b22d0b
Ruby
LichP/multprimes
/lib/mult_primes/mult_table.rb
UTF-8
1,378
3.53125
4
[ "MIT" ]
permissive
require File.join(File.dirname(__FILE__), 'mult_table', 'formatters') class MultTable attr :multipliers def initialize(*multipliers) @multipliers = multipliers.flatten.sort end # Compute a line of the multiplication table # # @param [Integer] i the number of the line to compute # @return [Array<I...
true
2487884c3b7b642074210ca76ed950fd876ef5b6
Ruby
nbudin/octopi
/lib/octopi/user.rb
UTF-8
2,755
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Octopi class User < Base include Resource find_path "/user/search/:query" resource_path "/user/show/:id" # Finds a single user identified by the given username # # Example: # # user = User.find("fcoury") # puts user.login # should return 'fcoury' def self.fi...
true
0491e01e0486f86d82e1b521bb948601d331bd28
Ruby
vladiim/real_estate_mate
/lib/states/states.rb
UTF-8
447
2.65625
3
[]
no_license
module States def self.get_state_links(url) index = Mechanize.new.get(url) link_columns = index.search('.column') add_link_to_urls link_columns end private def self.add_link_to_urls(link_columns) links = link_columns.search('dd') links.inject([]) { |urls, link| urls << make_allhome_...
true
17e722ee54beac789ad1b3a19fd8ff59b6f17864
Ruby
dcrosby42/conject
/spec/conject/extended_metaid_spec.rb
UTF-8
2,156
2.921875
3
[ "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") # # This set of specs isn't intended to exhaust metaid's functionality. # Just to frame up something as a basis for test driving further mods. # describe "Extended metaid" do # Not testing: # Object#metaclass # Object#meta_eval # because...
true
30427e109d1b82b1acb9c28d4261feedddd7496d
Ruby
naoki-k/Ruby-Cherry-Book
/chapter2/2.3.1.rb
UTF-8
462
3.703125
4
[]
no_license
# 文字列 # シングルクオートとダブルクオート # 特殊文字や式展開をする場合はダブルクオート name = 'Alice' puts "Hello, #{name}!" puts "こんにちは\nさようなら" # バックスラッシュでエスケープ puts "Hello, \#{name}!" # 文字列の比較 # == != < <= > >= 関係が成立でtrue # 大小関係は、文字コードが比較基準になる 'a' > 'b' 'abc' < 'abcd' puts 'a' > 'b' puts 'abc' < 'abcd'
true
65f0fe59e70b0b93776b36eb23c1f4d55950f4b1
Ruby
kukushkin/aerogel-users
/app/helpers/auth.rb
UTF-8
1,560
2.59375
3
[ "MIT" ]
permissive
# Redirects after authentication process to the most appropriate origin URL. # # Possible origins (URLs to redirect to) are tried in following order: # explicit_origin # request.env['omniauth.origin'] # request.params['origin'] # default_origin # def auth_redirect_to_origin( explicit_origin, default_origin = "/...
true
8b0a7a015dbcea3a8640521a035f70a5a633dcdf
Ruby
timuruski/bench-test-suites
/bench.rb
UTF-8
933
2.578125
3
[]
no_license
#! /usr/bin/env ruby SUITES = { 'Bacon' => 'bacon -q spec/bacon_spec.rb', 'Cutest' => 'cutest spec/cutest_spec.rb', 'Minitest' => 'ruby spec/minitest_spec.rb', 'Riot' => 'ruby spec/riot_spec.rb', 'RSpec' => 'rspec spec/rspec_spec.rb' } PATTERN = /([0-9.]+) real +([0-9.]+) user +([0-9.]+) sys/ COU...
true
e5d445911b1ca32b07a6f2a0a87bcfeb4e46e118
Ruby
shsm385/ruby_pra
/2106.rb
UTF-8
251
2.625
3
[]
no_license
# -*- coding: utf-8 -*- require 'rubygems' require 'dbi' dbh = DBI.connect('DBI:SQLite3:students01.db') dbh.select_all( 'select * from students' ) do |row| print "----\n" print "name = #{row[0]}\n" print "age = #{row[1]}\n" end dbh.disconnect
true
3805e4579ebab63c3102f870aa8b98ac21b375e2
Ruby
etienne-bourganel/moving_object
/board.rb
UTF-8
336
3.46875
3
[]
no_license
# frozen_string_literal: true class Board attr_reader :matrix def initialize(width, height) @matrix = create_matrix(width, height) end def create_matrix(width, height) matrix = [] (0..width-1).each do |x| (0..height-1).each do |y| matrix.push([x, y]) end end return m...
true
404b03fc8be259540138858a417b605d0843abdc
Ruby
tarrinros/gallows
/spec/game_spec.rb
UTF-8
1,052
3.34375
3
[]
no_license
require 'game' require 'unicode_utils/downcase' describe Game do before :each do word = 'batman' @game = Game.new(word) end describe '#initialize' do it 'should assign instance variables' do expect(@game.errors).to eq 0 expect(@game.good_letters).to eq [] expect(@game....
true
f8ba548d5cc3b5b8741be65688a0907fc0cd2da7
Ruby
cbear1988uk/day_3_lab-hw
/models/artist.rb
UTF-8
1,161
3
3
[]
no_license
require_relative('../db/sql_runner') class Artist attr_accessor :name attr_reader :artist_id def initialize(options) @name = options['name'] @artist_id = options['artist_id'].to_i @id = options['id'].to_i if options['id'] end def save() sql = "INSERT INTO artists (name) Values ($1) RETURN...
true
55eb469df6453d6da3fba31b0e8bf8a6f07e5885
Ruby
aferreira44/HackSchooling
/stem/technology/backend/ruby/the-odin-project/ruby/book-learn-to-program/flow-control/leap_years.rb
UTF-8
215
3.59375
4
[]
no_license
start_year = gets.chomp.to_i end_year = gets.chomp.to_i def leap_year?(year) year % 400 == 0 || year % 4 == 0 && year % 100 != 0 end (start_year..end_year).each do |year| puts year if leap_year?(year) end
true
188faf60beb468be1eb6f73d349aeb30eea5d458
Ruby
jupiterjs/fitserver
/lib/jits_file_helper.rb
UTF-8
1,272
2.53125
3
[]
no_license
require 'fileutils' if RUBY_PLATFORM.include? "powerpc" $slash='/' elsif RUBY_PLATFORM.include? "x86_64-linux" $slash='/' else $slash="\\" end def clean_files(dir, &block) Dir.foreach(dir+$slash) { |filename| next if filename == "." || filename == ".." if File.file?(dir +$slash+ file...
true
ef37670fd4cbebef006cfe1e084ddc95dcc919e7
Ruby
ameriken/ruby_design_pattern
/02_strategy_pattern/report.rb
UTF-8
365
2.984375
3
[]
no_license
require './html_formatter' class Report attr_reader :title, :text attr_accessor :formatter def initialize(formatter) @title = '月時報告' @text = ['順調', '最高の調子'] @formatter = formatter end def output_report @formatter.output_report(@title, @text) end end report = Report.new(HtmlFormatter.new...
true
761a349ec749563b84de05a5a095372a025b60a9
Ruby
kharigai/ruby
/atcoder/abc132_a.rb
UTF-8
137
3.0625
3
[]
no_license
h = Hash.new(0) gets.strip.split('').each do |c| h[c] += 1 end puts h.size.eql?(2) && h.values.all? { |i| i.eql?(2) } ? 'Yes' : 'No'
true
d657dcb0f1ab0c2f85cdf8c9c42f05abbe11a3f2
Ruby
peteyluu/coderbyte
/Easy/palindrome.rb
UTF-8
525
4.6875
5
[]
no_license
=begin Have the function palindrome(str) take the str parameter being passed and return the string true if the parameter is a palindrome, (the string is the same forward as it is backward) otherwise return the string false. For example: "racecar" is also "racecar" backwards. Punctuation and numbers will not be part...
true
424c230d09f8186a26c438b98d368fdc12c42edb
Ruby
sergio91pt/faulty
/lib/faulty/events/filter_notifier.rb
UTF-8
1,015
2.71875
3
[ "MIT" ]
permissive
# frozen_string_literal: true class Faulty module Events # Wraps a Notifier and filters events by name class FilterNotifier # @param notifier [Notifier] The internal notifier to filter events for # @param events [Array, nil] An array of events to allow. If nil, all # {EVENTS} will be used...
true
8f1c1fef5c0c2a916be68c309e7df85e93637675
Ruby
talkhouse/noyes
/lib/java_impl/speech_trimmer.rb
UTF-8
446
2.5625
3
[ "BSD-2-Clause" ]
permissive
module NoyesJava class SpeechTrimmer def initialize frequency = 16000 @st = Java::talkhouse.SpeechTrimmer.new frequency end def << pcm result = @st.apply(pcm.to_java(Java::double)) result.to_a if result end def enqueue pcm @st.enqueue pcm.to_java(Java::double) end d...
true
605de35bfcaf01315be998bb609b6820e5383942
Ruby
RJ-Ponder/RB101
/exercises/easy_1/reverse_it_2.rb
UTF-8
1,322
4.875
5
[]
no_license
=begin Problem Write a method that takes one argument, a string containing one or more words, and returns the given string with words that contain five or more characters reversed. Each string will consist of only letters and spaces. Spaces should be included only when more than one word is present. Examples/T...
true
21fead833c22a063435039fcba0727ce2b1f39a7
Ruby
marciofrayze/indierank
/backend/app/controllers/services.rb
UTF-8
2,057
2.71875
3
[ "MIT" ]
permissive
require 'json' class SearchService < RackStep::Controller def process_request plate = request.params['plate'] print plate ratings = Ranking.all(plate: plate) ratings = [] if ratings == nil ranking = {} ranking['plate'] = plate ranking['ratings'] = ratings response.header['Ac...
true
79f1172184d1d329937adaed720f368e8be52967
Ruby
USA-ChrisRichards/oo-basics-with-class-constants-chicago-web-062419
/lib/book.rb
UTF-8
792
3.6875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Book attr_accessor :author, :page_count attr_reader :title, :genre #1.Explicitly define the genre= method, to integrate our class constant into the method #2.Remove the attr_accessor for :genre since we no longer need to generate a reader AND a writer. #3.Add an attr_reader for :genre, since we still want Rub...
true
665335e644cb7c7f1df01b39a93c42a24626cefa
Ruby
ikemonn/AOJ
/ITP1/structured_program2/matrix_multiplication.rb
UTF-8
374
3.1875
3
[]
no_license
n, m, l = gets.split.map(&:to_i) a = [] b = [] n.times do |num| a[num] = gets.split.map(&:to_i) end m.times do |num| b[num] = gets.split.map(&:to_i) end b = b.transpose ans = [] n.times do |n_num| l.times do |l_num| sum = 0 m.times do |m_num| sum += a[n_num][m_num] * b[l_num][m_num] end p...
true
b65a5ed319685eba6462852cedfa98d700a03987
Ruby
stavro/viterbi
/three_tier/app.rb
UTF-8
513
2.71875
3
[]
no_license
require 'pg' require 'sinatra' require 'thread' conn = PG.connect(dbname: 'tweets') mutex = Mutex.new get '/' do result = mutex.synchronize { conn.exec('select hashtag, count(*) from tweets group by hashtag') } totals = result .map { |res| "#{res["hashtag"]}: #{res["count"]}"} .join("<br>\n") tota...
true
f46b7676edbcd09f3da1db9185f23afd09e9faff
Ruby
asheren/euler
/lib/problem2/problem2.rb
UTF-8
1,016
4.25
4
[]
no_license
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # find the sum of the even-valued term...
true
df42a043f4a23ec6c9ec78d36610f5cc698ce120
Ruby
hugopeixoto/rlua
/lib/rlua.rb
UTF-8
1,388
3.1875
3
[ "MIT", "LGPL-3.0-or-later" ]
permissive
require 'rlua.so' module Lua class Table # Traverses the table using Lua::Table.next function. def each(&block) key = nil loop { key, value = *self.class.next(self, key) break if key.nil? block.call(key, value) } self end # Non-recursively converts tab...
true
7fdb689a8aabdc856b4a7981a07d16361ec0b721
Ruby
estebanmino/grupo-8
/app/models/match.rb
UTF-8
1,668
2.578125
3
[]
no_license
# == Schema Information # # Table name: matches # # id :integer not null, primary key # date :date # time :time # created_at :datetime not null # updated_at :datetime not null # visit_team_id :integer # home_team_id :integer # tournament_id :integer #...
true
e7c100a0215cd3dd14574df5f65b7097ce2326f3
Ruby
DetectiveAzul/w3_d2_homework
/start_point/console.rb
UTF-8
1,624
2.90625
3
[]
no_license
require_relative('./models/bounty') require('pry') bounty01_hash = { 'name' => 'Han Solo', 'species' => 'Human', 'bounty_value' => '30000', 'danger_level' =>'medium', 'last_known_location' =>'Tatooine', 'homeworld' =>'Coruscant', 'favorite_weapon' =>'Hand Blaster', 'cashed_in' => 'yes', 'collected_by...
true
e695cc8db73eb6ae2b03a51dd1631bf404d3d64e
Ruby
InternationalTradeAdministration/csl
/app/importers/concerns/versionable_resource.rb
UTF-8
1,835
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "charlock_holmes" module VersionableResource extend ActiveSupport::Concern included do raise "Includee must be Importable" unless ancestors.include?(Importable) send(:prepend, Prepend) end module Prepend def import if resource_changed? super ...
true
7cd65272fbc330aceaa9362008e9f5603f9302c7
Ruby
AZatsepa/autobase
/code/card_record.rb
UTF-8
1,054
3.046875
3
[]
no_license
# Написать класс CardRecord # минимальный набор полей: # id пользователя # номер автомобиля # время когда машина выдана в прокат # время когда машина была возвращенна # статус (оплачено, возвр. но не оплачено) # требования к функционалу: # изменение статуса записи + возврат суммы долга # минимальный набор ограничений: ...
true
5c6452be6f1e178281162241f45d1bcab7e28a64
Ruby
jawj/bulb-window-stickers
/build.rb
UTF-8
2,010
2.859375
3
[]
no_license
#!/usr/bin/env ruby # note: sudo npm install -g clean-css html-minifier require 'nokogiri' def pipe cmd, stdin IO.popen(cmd, 'w+') { |io| io.write(stdin); io.close_write; io.read } end def dataURIFor url return url if url.match(%r{^data:|//$}) || ! url.match(/\.(gif|jpg|jpeg|png)$/i) || ! File.exist?(url) || Fi...
true
e8c28c1be320c948a7510c54db9d1e2b580dc298
Ruby
saiury92/ba_chu_heo_con.rb
/BDD/ba_chu_heo_con_spec.rb
UTF-8
2,112
2.53125
3
[]
no_license
# encoding: UTF-8 require_relative './ba_chu_heo_con' require 'minitest/autorun' describe 'Chuyện ba chú heo con' do before(:all) do @sói = Sói.new @heo_út = Heo.new('út') @heo_anh_nhì = Heo.new('anh nhì') @heo_cả = Heo.new('anh cả') end describe 'Heo em út xây nhà' do bef...
true
02073200a50fafc5b916c2be077e94de0e738033
Ruby
mawiegand/game_server
/app/controllers/action/military/found_home_base_actions_controller.rb
UTF-8
2,259
2.53125
3
[]
no_license
class Action::Military::FoundHomeBaseActionsController < ApplicationController layout 'action' before_filter :authenticate # Gives the "found home_base" command to the specified army, # if prerequisits (character as well as army are able to # found a home city now) are met. We also require a location_id ...
true
b60e9166e235141cf69e0faf9b434e7b5a88dcdd
Ruby
jasterix/advanced-hashes-hashketball-dumbo-web-career-042219
/hashketball.rb
UTF-8
5,620
3.296875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here! require 'pry' def game_hash game_hash = { :home => { team_name: "Brooklyn Nets", colors: ["Black", "White"], players: { "Alan Anderson" => { number: 0, shoe:16, points:22, rebounds:12, assists:12, steals:3, blocks:...
true
34781c78c3ae81b4645f0c9e0f7b22e73c52d14f
Ruby
earl-stephens/enigma
/lib/encryption.rb
UTF-8
1,135
3.28125
3
[]
no_license
require './lib/shift' class Encryption include Shift attr_reader :shift_pattern, :alphabet, :shifted_message, :counter def initialize @shift_pattern = [] @shifted_message = "" @counter = 0 end def main_encrypt_method(message, keys, offsets) create_s...
true
79abe1bdf6cc2fd87a74afbe82c5042f6fbdad3c
Ruby
welshstew/basic-dashboard
/jobs/camel-springboot-data-post.rb
UTF-8
2,243
2.546875
3
[]
no_license
require 'logger' require 'net/http' require 'uri' require 'json' require 'logger' require 'openssl' require 'date' require 'kubeclient' stats = ['Uptime', 'State', 'MinProcessingTime', 'MaxProcessingTime', 'LastProcessingTime', 'TotalRoutes', 'TotalProcessingTime'] stat_values = Hash.new({ value: 0 }) label = "proj...
true
a6909a96255cb72b4c67fffd40b16c9490ffc1b3
Ruby
PhilipTimofeyev/LaunchSchool
/RB101/Small_Problems/Medium_2/small_problems_medium_2_Ex6.rb
UTF-8
486
3.515625
4
[]
no_license
def triangle(s1, s2, s3) angle_arr = [s1, s2, s3] case when angle_arr.reduce(&:+) != 180 || angle_arr.any? {|angle| angle == 0} then :invalid when angle_arr.any? {|angle| angle == 90} then :right when angle_arr.all? {|angle| angle < 90} then :acute when angle_arr.any? {|angle| angle > 90} then :obtuse en...
true
cdfe5c8925e43bb789faa4e7ace09f29adcab7b5
Ruby
menor/dbc_advanced_ruby
/part1_ruby-drill-argv-basics-challenge/source/rpn-calculator-sample_01.rb
UTF-8
1,197
3.90625
4
[]
no_license
# INITIAL CODE: # This is the first version of code to pass the rspec tests and get all green. class RPNCalculator attr_accessor :stack def initialize @stack = [0] end def push(value) stack.unshift(value) end def add nums = stack.shift + stack.shift stack.unshift(nums) end def minu...
true
bcd1b6df7b1f7960c5cf89733552dc2ab347970a
Ruby
gmhawash/nablus-tech-talk
/ruby/107_files.rb
UTF-8
351
3.03125
3
[]
no_license
#!/usr/bin/env ruby # Files begin # Read a file content = File.read('000_references.txt') puts content puts "-------" file = File.open('000_references.txt') puts file.read end begin # Write a file file = File.open('/tmp/file.txt', 'w') file.write("hello\n") File.open('/tmp/file2.txt', 'w') do |f| ...
true
1532673d3618fc9e3ebe5cdedf2261941f62d9de
Ruby
mukaer/chef-solo
/cookbooks/init_network/libraries/initconf.rb
UTF-8
901
3.15625
3
[ "Apache-2.0" ]
permissive
class Initconf @org_cont @cont def initialize () reset_cont() end def reset_cont() @org_cont = Array.new @cont = Hash.new end def load_file(path) reset_cont() @org_cont = File.read(path).split("\n") if File.exist? path converter() end def load_str(str)...
true
b76fa6e742afa1d95a2198f5a71717b2974306c5
Ruby
panteha/oystercard
/lib/oystercard.rb
UTF-8
1,291
3.578125
4
[]
no_license
require_relative './station.rb' require_relative './journey_log.rb' # Oystercard class... class Oystercard attr_accessor :balance, :list_of_journeys MAXIMUM_BALANCE = 90 MINIMUM_BALANCE = 1 def initialize(balance = 0) @journey_log = JourneyLog.new(Journey) @journey = nil @balance = balance @li...
true
aa75de0071752a10b597aac5af615b5d3cfe3292
Ruby
prasadsurase/hootcode
/lib/exercism/progress_bar.rb
UTF-8
489
2.8125
3
[]
no_license
module Exercism class ProgressBar StepInstall = "install-cli" StepSubmit = "submit-code" StepDiscuss = "have-a-conversation" StepNitpick = "pay-it-forward" StepExplore = "explore" def self.steps [StepInstall, StepSubmit, StepDiscuss, StepNitpick, StepExplore] end def self.fill?(step, current) ...
true
f237bb82d411df0cef92472cbd91aa6c32812a01
Ruby
mikeebert/user_records
/lib/user_record.rb
UTF-8
699
2.859375
3
[]
no_license
require 'grape-entity' class UserRecord attr_reader :last_name, :first_name, :favorite_color, :date_of_birth def initialize(attributes) @last_name = attributes[:last_name] @first_name = attributes[:first_name] @favorite_color = attributes[:favorite_c...
true
72c8de50c87d4559feff5c7be24d43e3f88e7f23
Ruby
Belyenochi/Programming-Languages
/Ruby/ruby_example2.rb
UTF-8
243
3.828125
4
[]
no_license
class Fixnum def my_times i = self while i > 0 i = i - 1 yield end end end def call_block(&block) block.call end def pass_block(&block) call_block(&block) end pass_block {puts 'Hello, block'} 3.my_times {puts 'mangy moose'}
true
bfd9da9cc61ae5fcae5dcc1900585d4039dd1fd4
Ruby
RichCollinson/design-system
/content/confluence-to-markdown
UTF-8
727
2.625
3
[]
no_license
#!/usr/bin/env ruby require 'find' require 'fileutils' require 'reverse_markdown' SOURCE_DIR = 'docs' TARGET_DIR = 'markdown' puts "Create target directory" FileUtils.mkdir_p(TARGET_DIR) puts "Copy directores" FileUtils.cp_r "#{SOURCE_DIR}/images", TARGET_DIR FileUtils.cp_r "#{SOURCE_DIR}/styles", TARGET_DIR FileU...
true
d3a96b032f7ffbcaf2b243dea5070d1b3137b7ac
Ruby
christinaminh/jump-start-live
/lessons/day1/code/bad_style_madlibs.rb
UTF-8
1,945
4.0625
4
[]
no_license
# Takes in input from the user and outputs a madlib story # Bad style example # susan evans # Last edited 11/25/2016 print "Welcome to my MadLib program. Please enter in some information below.\n\n" # Would be easier to puts instead of print with \n # Add whitespace between each instance of reading user input and assig...
true
d8f590e975f2a0a2ba9ca94aa9543400beef9f2c
Ruby
antonnur/Ruby-Shcool
/10(ARRAY, SYMBOL)/10.3.rb
UTF-8
678
3.90625
4
[]
no_license
# добавление в массив # each - передает каждый ее элемент в блок кода puts "Пример 1:" arr = [] loop do # аналагично while true print "Кого добавить в список:" name = gets.strip # получаем имя strip обрезаем лишние пробелы переносы if name == "" break # прерывает цикл, exit - в...
true
6ec002719b414c27240334940e38440f32630f02
Ruby
Atul9/rubylearning56
/7_week/1e_klass.rb
UTF-8
562
3.90625
4
[]
no_license
=begin Exercise1. Write a Ruby program named lesson7exercise1.rb that defines a class called Klass which will be called in another program as follows: obj = Klass.new("hello") puts obj.say_hello where say_hello is a method in that class, which returns the string sent when an object of Klass is created. Write another...
true
607d7089cca4fe9b51dbdb9e380d8734f3aa2d7a
Ruby
cielavenir/procon
/codeforces/tyama_codeforces743A.rb
UTF-8
73
2.65625
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby n,a,b,s=$<.read.split p s[a.to_i-1]!=s[b.to_i-1] ? 1 : 0
true
092ea037fe97bf6bfb470f1ba85101d01822689c
Ruby
dummied/dgraphy
/lib/dgraphy/node.rb
UTF-8
817
2.65625
3
[ "MIT" ]
permissive
module Dgraphy class Node attr_reader :starter, :filter, :fields, :results def initialize(starter:, filter: nil, fields: []) @starter = starter @filter = filter @fields = fields end def execute puts build_query end def build_query %Q( { d...
true
f29c8a2223bb1329effec28ac4aec8c3625e375b
Ruby
rlee0525/AlgorithmProjects
/Project2/raymond_lee/lib/p02_hashing.rb
UTF-8
600
3.25
3
[]
no_license
class Fixnum # Fixnum#hash already implemented for you end class Array def hash hashing = 0 self.each_with_index do |val, i| hashing += (val * i).hash end hashing end end class String def hash hashing = 0 self.chars.each_with_index do |char, i| hashing += (char.ord * i)....
true