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
9c68a5ca925b2fb5dfa8cfe70f56d92dac87c024
Ruby
jhannah/odlug.org
/pet_paradise/ruby_1/Reservation.rb
UTF-8
905
3.015625
3
[]
no_license
#Pet Paradise Challenge for ODynUG #author: Juan Vazquez http://javazquez.com #Class will read in file of reservations and use scheduler to find most profit require 'Scheduler' class Reservation attr_accessor :reservation_file, :reservation_list attr_reader :scheduler def initialize @reservation_file="" ...
true
800b4ddb5f082fe29d269f4f6f2a8f4b25ed85fc
Ruby
ForSetGeorgia/Scrapers
/vizhack-2018-literacy/process_files.rb
UTF-8
3,617
2.953125
3
[ "MIT" ]
permissive
# pull in all data from the original_data folder, clean it, and merge into one spreadsheet require 'csv' start = Time.now all_data = [] data_files = Dir.glob('original_data/*.csv') idx_cols_to_add = [ 10,20,21 ] idx_cols_to_remove = [ 0,1,2,3,4,16,17,18,19,20 ] idx_image = 7 idx_death = 9 idx_age = 10 idx_org =...
true
68af821421471af9c39061d8f0f6d5d3fb406859
Ruby
jwperry/headcount_repo
/headcount/lib/headcount_analyst.rb
UTF-8
5,178
2.859375
3
[]
no_license
require 'pry' require_relative 'district_repository' class HeadcountAnalyst def initialize(dr) @dr = dr @swt = @dr.statewide_test_repo.statewide_tests end def kindergarten_participation_rate_variation(dist1, dist2) d1_part = get_avg(get_kp_data(@dr.find_by_name(dist1))) d2_part = get_avg(get_kp...
true
c018bc493ac1f64a6a2b04ac8985b7ac48fb33ae
Ruby
perezfelix/Semaine0_jour4
/exo_05.rb
UTF-8
1,151
3.8125
4
[]
no_license
#va juste ecrire une phrase : puts "On va compter le nombre d'heures de travail à THP" #va écrire une phrase + faire un calcul + assembler les deux :puts "Travail : #{10 * 5 * 11}" #éxactement pareil qu'au dessus : puts "En minutes ça fait : #{10 * 5 * 11 * 60}" #écrit une phrase : puts "Et en secondes ?" #écrit un c...
true
27d9b5f9936732cc16bf7a1aeb2e746560315475
Ruby
elais/CS620
/Elais Jackson HW1/system1/circular_shift.rb
UTF-8
718
3.234375
3
[]
no_license
class CircularShift def initialize(lines) @HOME= File.dirname(File.expand_path(__FILE__)) @lines= lines @shifted= Array.new @i= 0 @num = @lines.length @stopwords = File.open(@HOME + "/english.txt", "r").readlines.map!(&:chomp) begin sentence = @lines[0].downcase sentence = sen...
true
ea4a64981fe1d556a78a70a63395ec9c1cd0729e
Ruby
rajmohand/L-99-Ninety-Nine-Lisp-Problems-Solutions-Ruby
/8.rb
UTF-8
97
2.890625
3
[]
no_license
def last(arr) array=arr.uniq puts array end data=%w[e e e s a a s a s a s a s s] last(data)
true
cbf0438e5b253347d719456c46bb7f616d7cf5d4
Ruby
cpdundon/ruby-music-library-cli-v-000
/lib/genre.rb
UTF-8
750
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "../config/environment.rb" #require_relative "./music_base.rb" #require_relative "./Concerns::Findable.rb" class Genre # < Music extend Concerns::Findable attr_accessor :name attr_reader :songs @@all = [] def self.all @@all end def self.destroy_all self.all.clear end d...
true
72d6fbe787402d7669ac35e63ab54825f8bbb37a
Ruby
siakaramalegos/project_tdd_minesweeper
/lib/player.rb
UTF-8
1,125
3.953125
4
[]
no_license
class Player attr_reader :name, :board def initialize(board, name=nil) @name = name || get_name @board = board end def take_turn loop do type = ask_move_type if type == 'f' move = ask_turn('flag') if valid_format?(move) break if @board.place_flag(move) ...
true
85f47327f0a6fb75169cb545eb4bdfb468b664a1
Ruby
hole19/evva
/lib/evva/android_generator.rb
UTF-8
5,623
2.640625
3
[]
no_license
module Evva class AndroidGenerator attr_accessor :package_name def initialize(package_name) @package_name = package_name end BASE_TEMPLATE = File.expand_path("./templates/kotlin/base.kt", __dir__) EVENTS_TEMPLATE = File.expand_path("./templates/kotlin/events.kt", __dir__) EVENT_ENUM_TE...
true
7740bc0a25b8ab5a94a2f86b36938391e80e98bb
Ruby
MrAaronOlsen/enigma
/lib/enigma.rb
UTF-8
755
3.109375
3
[]
no_license
require './lib/helper' class Enigma attr_reader :cipher def encrypt(message, key = rand_key, date = today) cipher = Cipher.new(key, date) Encrypt.new(message, cipher).message end def decrypt(message, key = rand_key, date = today) cipher = Cipher.new(key, date) Decrypt.new(message, cipher).me...
true
4c64a17537bfe359266aa3b80660b99891e2f633
Ruby
esbaddeley/airport_challenge
/lib/plane.rb
UTF-8
1,105
3.3125
3
[]
no_license
require_relative 'airport' require_relative 'weather' class Plane def land(airport, weather) too_stormy_to_land(weather) plane_landed_error airport.add_plane(self) @airport = airport end def takeoff(airport, weather) too_stormy_to_takeoff(weather) plane_not_in_an_airport_error plane...
true
68a1f4323699402dd17446299fac8f9782180981
Ruby
ukparliament/thorney
/app/serializers/component_serializer/count_component_serializer.rb
UTF-8
869
2.921875
3
[ "MIT" ]
permissive
module ComponentSerializer class CountComponentSerializer < BaseComponentSerializer # Initialise a count partial. # # @param [String] count_number the number of things counted. # @param [String] count_context the things being counted. # # @example Initialising a count partial # numer_of_i...
true
5bbdc9d6cdfd53a52e05d517fa6c25ecb5274526
Ruby
Sergyenko/lint_fu
/lib/lint_fu/reports/html_writer.rb
UTF-8
8,491
2.5625
3
[ "MIT" ]
permissive
module LintFu::Reports class HtmlWriter < BaseWriter STYLESHEET = <<-EOF table { border: 2px solid black } th { color: white; background: black } td { border-right: 1px dotted black; border-bottom: 1px dotted black } h1 { font-family: Arial,Helvetica,sans-serif } h2 { fon...
true
0d9af57446aeafaacd55a795e7b035459d58d1c6
Ruby
maureendugan/train_system
/train_system.rb
UTF-8
3,309
3.109375
3
[]
no_license
require './lib/line' require './lib/station' require './lib/stop' require 'colorize' require 'pg' DB = PG.connect({:dbname => 'train_system'}) def operator_menu puts "s to add a station" puts "l to add line" puts "'stop' to add a stop" puts "x to return to main menu" input = gets.chomp case input when ...
true
8fcb438faa26cdcb87fa69165c1ca5cfa151e5c1
Ruby
YizheWill/aA_Classwork
/projects/CardGame/Player.rb
UTF-8
3,025
3.34375
3
[]
no_license
require_relative "Person.rb" class Player < Person attr_accessor :alias_name, :cards, :cash def initialize() super() p "please type your alias name" @alias_name = gets.chomp! @cards = [] @cash = @bank.cash_available end def show_cards() sort_cards @cards.each do |card| puts ...
true
584c6b2189c807a49cbb62786693a3ab300c7571
Ruby
alexmcbride/futureprospects
/app/controllers/decisions_controller.rb
UTF-8
2,480
2.609375
3
[]
no_license
# * Name: Alex McBride # * Date: 24/05/2017 # * Project: Future Prospects # Controller class for tracking student applications and managing student decisions/replies. class DecisionsController < ApplicationController before_action :set_application before_action :authorize_user, except: [:completed] # GET /decisi...
true
23dd4bc305298652a3e41511179dd9d7cacd2102
Ruby
bretonics/Learning
/Ruby/inheritance.rb
UTF-8
531
4.09375
4
[]
no_license
#!/usr/bin/ruby ##################### # # Created by: breton # File: inheritance.rb # ##################### class Shape def initialize(x,y) @x = x @y = y end attr_reader :x, :y attr_writer :x, :y def to_s print("X: ", x, "Y: ", y) end def move(x,y) ...
true
1e43be54952e0684a71e06a9d8a6a0620b180062
Ruby
cygnuscygnus/aichak_cloud9_ruby_rails
/ruby_projects/fizz_buzz.rb
UTF-8
253
4.1875
4
[]
no_license
def fizz_buzz(number) if number % 15 == 0 'FizzBuzz' elsif number % 3 == 0 'Fizz' elsif number % 5 == 0 'Buzz' else number end end numbers = (0..20).to_a numbers.each do |number| puts fizz_buzz(number) end
true
dbf51d7cade20f5132e064bb9aae5fca21215747
Ruby
MelanieJae/HackerRank-challenges
/clouds.rb
UTF-8
519
2.9375
3
[]
no_license
cloudbin = [0,0,0,0,1,0] newcloudpos = 0 @jumpcounter = 0 @numcloud = 6 cloudbin.each_index do |i| if i >= newcloudpos and i < @numcloud if cloudbin[i+1] == 1 and cloudbin[i+2] == 0 @jumpcounter = @jumpcounter + 1 newcloudpos = i + 2 end if cloudbin[i+1] == 0 and cloudbin[i+2] == 1 @jumpcounter = ...
true
06add0799ba2291a7ad0379a0124234fbb218a0f
Ruby
Ashishjayandar/phase-0-tracks
/ruby/trial.rb
UTF-8
697
3.515625
4
[]
no_license
def ascending_sorting(array) len=array.length i=1 while i<len z=array[i] j=i-1 while j>=0 && array[j]>z array[j+1]=array[j] j=j-1 end array[j+1]=z i=i+1 end return array end def descending_sort (insert_sort) length=insert_sort.length i=1 while i < length do z= insert_sort[i] j=i-1 whi...
true
6b61e2f51fd7f9d4f66691598688a5801daeb108
Ruby
Eschults/food-delivery
/app/models/order.rb
UTF-8
704
2.953125
3
[]
no_license
class Order attr_accessor :id, :delivered, :employee attr_reader :employee, :customer, :meal def initialize(attributes = {}) @id = attributes[:id].to_i @employee = attributes[:employee] @customer = attributes[:customer] @meal = attributes[:meal] @delivered = attributes[:delivered] == "true" |...
true
a9e10c4f0e313c5a5f76ced66b4456b5181a03dd
Ruby
abagnard/App-Academy-Work
/w1d5/skeleton/lib/00_tree_node.rb
UTF-8
962
3.578125
4
[]
no_license
class PolyTreeNode attr_accessor :children attr_reader :value, :parent def initialize(value, parent = nil, children = []) @value = value @parent = parent @children = children end def parent=(value) if @parent @parent.children.delete(self) end @parent = value value.children ...
true
b04fb131c9d572f61b08ded5251655f3274d8314
Ruby
epoch/codyperry
/04-ruby/intro/conditionals.rb
UTF-8
491
4
4
[]
no_license
if (2+2) == 5 puts "the world has gone mad" end if (2 * 2) == 5 puts "the world has gone mad" else puts "nothing new here, back to work" end person = 'maddy' if person != 'wally' puts "where's wally" end puts "where is wally" unless person == "wally" # switch / case grade = 'B' case grade when "A","B" ...
true
54dcb2364b9cf6c64d663b091077f41704723472
Ruby
mrlhumphreys/just_shogi
/lib/just_shogi/promotion_factory.rb
UTF-8
1,777
3.421875
3
[ "MIT" ]
permissive
require 'just_shogi/pieces/fuhyou' require 'just_shogi/pieces/kakugyou' require 'just_shogi/pieces/hisha' require 'just_shogi/pieces/kyousha' require 'just_shogi/pieces/keima' require 'just_shogi/pieces/ginshou' require 'just_shogi/pieces/kinshou' require 'just_shogi/pieces/oushou' require 'just_shogi/pieces/gyokushou'...
true
2983201f57d45f39e58ebc5c0795f3d8caccda1e
Ruby
ninjudd/functor
/lib/functor.rb
UTF-8
1,156
3.015625
3
[ "MIT" ]
permissive
module Functor class Object include Functor def initialize(method_map = {}) method_map.each do |method_name, proc| define_method method_name, proc end end def method_missing(method_name, proc) method_name = method_name.to_s if method_name =~ /(.*)=$/ define_me...
true
5330ecc1780b9429c6251d177f081aaff1d9ff53
Ruby
jnanavibasavaraj/Ruby
/ruby/ruby1/car.rb
UTF-8
213
3.09375
3
[]
no_license
class Car def initialize end def start puts "car is started" end def stopped puts "car is stopped" end def move puts "car is in motion" end end a=Car.new a.start a.stopped a.move
true
4d605e2a209160ff9f14d16765d6543e55d495d0
Ruby
rob-king/landlord
/db/seed.rb
UTF-8
670
2.65625
3
[]
no_license
require "active_record" require "pry" require_relative "../models/apartment" require_relative "..//models/tenant" require_relative "../db/connection" require "faker" Tenant.destroy_all Apartment.destroy_all rand(1..100).times { Apartment.create( address: "#{Faker::Address.building_number} #{Faker::Address.stre...
true
bc439278604cd961ed1f42fcc4530df5d523f13b
Ruby
biemond/biemond-oradb
/lib/puppet/functions/oradb/oracle_exists.rb
UTF-8
1,289
2.59375
3
[ "Apache-2.0" ]
permissive
require 'puppet/util/log' # Check if the oracle software already exists on the vm Puppet::Functions.create_function(:'oradb::oracle_exists') do # Check if the oracle software already exists on the vm # @param oracle_home_path the full path to the oracle home directory # @return [Boolean] Return if it is found or...
true
93d0f01b6f0f409958aef3ecb8fc40a0dcfb3175
Ruby
pdxwolfy/Challenges
/Bowling/bowling-old.rb
UTF-8
2,709
3.40625
3
[]
no_license
#!/usr/bin/env ruby # Copyright (c) 2016 Pete Hanson # frozen_string_literal: true module Error MESSAGE = { bad_pin_count: 'Pins must have a value from 0 to 10', cannot_score: 'Score cannot be taken until the end of the game', too_many_pins: 'Pin count exceeds pins on the lane' }.freeze def self.in...
true
f1f173b34d023f5ab6c06fa702de93aa0af8c68d
Ruby
souleyman26/thp_mardi
/mar/exo_09.rb
UTF-8
197
2.953125
3
[]
no_license
puts "c'est quoi ton prènom ?" print ">" user_name = gets.chomp puts "c'est quoi ton nom" print ">" user_name = gets.chomp puts "Bonjour #{user_name},''#{nik_name}" puts "Bonjour#{ user_name}! "
true
cbdf7b7b2f310fbc91db730d706465152d61ea08
Ruby
CivicHaxx/TOPoli_Scraper
/vote_scraper.rb
UTF-8
2,171
2.578125
3
[]
no_license
require_relative 'scraper' class VoteScraper < Scraper def initialize(term_id) @term_id = term_id end def url URI("#{BASE_URI}getAdminReport.do") end def report_download_params(term_id, member_id) { toDate: "", termId: term_id, sortOrder: "", sortBy: "", ...
true
5ae6613c6fd8bce53dfc196de28b52f2337e5a19
Ruby
mariapacana/contactconverter
/column.rb
UTF-8
2,020
2.921875
3
[]
no_license
require_relative 'util' require_relative 'constants' require 'pry' module Column include Util include Constants def self.process_duplicate_contacts(contacts, field_hash, field, source_type, headers) contacts_array = self.merge_duplicated_contacts(field_hash.values, headers) ordered_contacts = contacts_a...
true
9b6cad28481aff3776673c422f8edae1bf9880ea
Ruby
Chrisincr/rubyprojects
/first_week_work/range.rb
UTF-8
121
3.0625
3
[]
no_license
x = ("a".."z") z = ("A".."Z") y = [*x,*z] #y= x.to_a puts y puts y.include?('c') puts y.last puts y.max puts y.min
true
646a1a2f2ff6ffcf32616ca4949500263fe6dae5
Ruby
basho/basho_docs
/rake_libs/s3_deploy.rb
UTF-8
20,349
2.515625
3
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
########################### # Deploy rules and helpers $archive_name = "archived_docs.basho.com.tar.bz2" $archive_url = "http://s3.amazonaws.com/downloads.basho.com/documentation_content/#{$archive_name}" def do_fetch_archived_content() # Fetch and extract the archived content that we want to survive from the # ...
true
b026fc60d59f32b334adeacd9838c1ecfee2ea87
Ruby
nog/atcoder
/contests/abc235/c/main.rb
UTF-8
283
2.578125
3
[]
no_license
N, Q= gets.split.map(&:to_i) A = gets.split.map(&:to_i) lists = {} N.times do |i| a = A[i] lists[a] ||= [] lists[a].push(i) end queries = {} Q.times do |i| x, k = gets.split.map(&:to_i) li = lists[x] || [] if li.size >= k puts li[k-1] + 1 else puts -1 end end
true
74160250886250114a68f07c485ce0ece30a3feb
Ruby
emmasmithdev/karaoke-wk2-hwk
/specs/venue_spec.rb
UTF-8
3,083
3.296875
3
[]
no_license
require('minitest/autorun') require('minitest/reporters') require_relative('../venue') require_relative('../room') require_relative('../guest') require_relative('../song') require_relative('../stock') require('pry') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class TestVenue < Minitest::Test def...
true
4065b929cecf94a4a1b50a05384a929487b1e8ac
Ruby
xSSinnerx/Ruby-HW1
/Hw1.rb
UTF-8
1,498
3.59375
4
[]
no_license
#task 1 (Kata 8) def count_positives_sum_negatives(lst) return [] if lst.nil? || lst.empty? [lst.reject { |x| x < 1 }.count, (lst.reject { |x| x > -1 }).sum] end #task 2 (Kata 8) def string_to_number(s) number = s.to_i return number end #task 3 (Kata 7) def locker_run x (1..M...
true
a60759fc7649eb89758399a6ef223ab77eede7e4
Ruby
onurkucukkece/format_parser
/lib/parsers/moov_parser/decoder.rb
UTF-8
8,476
2.53125
3
[ "MIT" ]
permissive
# Handles decoding of MOV/MPEG4 atoms/boxes in a stream. Will recursively # read atoms and parse their data fields if applicable. Also contains # a few utility functions for finding atoms in a list etc. class FormatParser::MOOVParser::Decoder class Atom < Struct.new(:at, :atom_size, :atom_type, :path, :children, :ato...
true
8c02d1fc1b8ccb693f886123f481643b3842acc7
Ruby
dougvidotto/launchschoolprojects
/prepcourses/intro_programming_ruby/exercises/exercise6.rb
UTF-8
77
2.65625
3
[]
no_license
array = [1, 1, 1, 3, 4, 3, 5, 6, 5, 5] uniq_array = array.uniq p uniq_array
true
456ded9e11405456230a5ff9af18a68c62291fbc
Ruby
maksdy/WeatherBot
/weatherbot.rb
UTF-8
588
2.671875
3
[]
no_license
require 'telegram/bot' require 'forecast_io' ForecastIO.api_key = '4e47c04f26c4c84eb507f2215cd9b287' token = '698880021:AAFeMIsjQMx23DrI7_5QGK_OktLgC_HmQsc' forecast = ForecastIO.forecast(50.450418, 30.523541, params: { lang: 'ru', units: 'si' }) Telegram::Bot::Client.run(token) do |bot| bot.listen do |message| c...
true
5efefafafd4bb6cf19116159d94899e55266ed39
Ruby
jacobklinker/hw2fall15
/spec/part4_spec.rb
UTF-8
1,124
3.296875
3
[]
no_license
require 'part4.rb' class Foo attr_accessor_with_history :bar end class Bar attr_accessor_with_history :foo attr_accessor_with_history :bar end RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = [:should, :expect] end end describe "Class" do it "should have an attr_accessor_wi...
true
e6be0c83bcb1a948d7ff219fcc4f483db0a2afb4
Ruby
IgorCSilva/sketchup
/Programas/if.rb
UTF-8
593
3.65625
4
[]
no_license
if (5 > 3) puts '5 is greater than 3!' end line = Sketchup.active_model.entities.add_line [0,0,0], [5,5,5] if line puts "If you can read this, add_line completed successfully." puts "If not, line equals nil and you won't read this." end if (3 == 2) puts "Successful!" elsif (2 < 3) puts "Nil!" el...
true
0a1700a6ee1cbeed24c1e1cc9758e0ff596c05e6
Ruby
anickel101/ruby-oo-inheritance-modules-lab-nyc01-seng-ft-080320
/lib/concerns/findable.rb
UTF-8
109
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
module Findable def find_by_name(name) self.all.detect {|thing| thing.name == name} end end
true
b3a9764940f6c4346de61ee693dc1b9689edfa94
Ruby
leizzer/distroaulas
/app/controllers/import_controller.rb
UTF-8
3,568
2.703125
3
[]
no_license
class ImportController < ApplicationController def import @log = "INICIO DE IMPORTACION \n" begin @log += "Intentando acceder a Carreras.txt \n" c = File::read('importer/Carreras.txt') @log += "Acceso logrado... Leyendo... \n Se encontraron #{c.lines.count} registros... \n" c.each_line...
true
8e37aa66dd07e0b3efe4c819037cb5141d31cc9c
Ruby
bsheehy9/ls-challanges
/easy/scrabble/scrabble_score.rb
UTF-8
624
3.5625
4
[]
no_license
class Scrabble POINTS = { 'AEIOULNRST' => 1, 'DG' => 2, 'BCMP' => 3, 'FHVWY' => 4, 'K' => 5, 'JX' => 8, 'QZ' => 10 } def initialize(word) @word = word end def score return 0 if word.nil? letters = word.upcase.gsub(/[^A-Z...
true
f4eebdf372647a68cdba2471cc21a198a7d8d920
Ruby
portertech/ruby-pam
/test/check_user.rb
UTF-8
2,918
2.53125
3
[ "BSD-3-Clause" ]
permissive
# -*- ruby -*- # $Id: check_user.rb,v 1.1 2002/11/06 08:04:49 ttate Exp $ =begin You need to create the /etc/pam.d/check_user file which contains the following in the /etc/pam.d directory. -- auth required /lib/security/pam_pwdb.so shadow nullok account required /lib/security/pam_pwdb.so password r...
true
0691aec2425524a6bd7b640eefd5792304251291
Ruby
chungphuoc/roomorama_foosball
/app/services/match_service.rb
UTF-8
1,685
2.609375
3
[]
no_license
class MatchService def self.create(params) @teams = [] params.each do |team, user_id| t = Team.create() @teams << t user_id.each do |uid| TeamUser.create(team: t, user_id: uid.to_i) end end Match.create(team_1_id: @teams[0].id, team_2_id: @teams[1].id) end def self...
true
eeed05747f5f88eeb9899dfde7af98780eb76041
Ruby
kojix2/cumo
/test/cudnn_test.rb
UTF-8
17,004
2.53125
3
[ "MIT" ]
permissive
require_relative "test_helper" class CUDNNTest < Test::Unit::TestCase float_types = [ Cumo::SFloat, Cumo::DFloat, ] if ENV['DTYPE'] float_types.select!{|type| type.to_s.downcase.include?(ENV['DTYPE'].downcase) } end float_types.each do |dtype| sub_test_case "conv_2d" do setup do ...
true
550b0d8764add8aac0b7314cc0893dde31ad04aa
Ruby
reverbdotcom/once
/lib/once.rb
UTF-8
1,377
3.109375
3
[ "Apache-2.0" ]
permissive
require "once/version" require 'digest' # Usage: # # 1. Connect to redis: # Once.redis = Redis.new(...) # # If you don't specify the redis connection, we will assume the presence of a $redis global # # 2. Use to wrap a call that you want done uniquely # Once.do(name: "sending_email", params: { email: "foo@bar.com...
true
ae9c291769d4dc70153fbf47436aa36c867be213
Ruby
ZirconCode/Scrapah
/lib/scrapah/cache.rb
UTF-8
1,117
2.765625
3
[ "MIT" ]
permissive
require 'json' module Scrapah class Cache # TODO: 'throws away' whole cache after timeout, # -> treat entries as seperate objects/files/dates @@cache_dir = 'cache/' def initialize() Dir.mkdir(@@cache_dir) unless File.exists?(@@cache_dir) @Cache = Hash.new @keep_time = 1*24*60 # in minutes...
true
19a6abb8553bb62a629294658449bafed3ccc9ce
Ruby
muhammednagy/bittrex-ruby
/lib/bittrex/websocket/frame.rb
UTF-8
699
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Bittrex::WebSocket class Frame attr_reader :hub, :marker, :messages, :result, :index RESULT_KEY = 'R'.freeze MARKER_KEY = 'C'.freeze DATA_KEY = 'A'.freeze MESSAGES_KEY = 'M'.freeze INDEX_KEY = 'I'.freeze def initialize(frame_data) @r...
true
39f8863791de6d686aca1b90583c48d69e68f141
Ruby
joelvh/aftermath
/lib/framework/core.rb
UTF-8
169
2.515625
3
[]
no_license
String.class_eval do def to_underscore! (gsub!(/(.)([A-Z])/,'\1_\2') || self).gsub(/\s/,'').downcase! end def to_underscore clone.to_underscore! end end
true
c87bd5eedd4011b468b6d84ee69d475e4b7efc6c
Ruby
TactilizeTeam/photograph
/lib/photograph/artist.rb
UTF-8
1,617
2.8125
3
[ "MIT" ]
permissive
require 'capybara/poltergeist' require 'mini_magick' Capybara.default_wait_time = 15 module Photograph class Artist attr_accessor :options attr_reader :image MissingUrlError = Class.new(Exception) DefaultOptions = { :x => 0, # top left position :y => 0, :w => 1280, ...
true
ef11caf01c66df61ba7644273a1733bd0a9ad0a6
Ruby
dan-waters/advent_of_code_2020
/day12/directions_reader.rb
UTF-8
131
2.5625
3
[]
no_license
require 'open-uri' class DirectionsReader def directions_from_file(filename) open(filename).readlines.map(&:strip) end end
true
b4dbe3fac5e83062f5ecc3c7bd426ff1264f27ef
Ruby
vkurup/Amion-Schedule-Parser
/amion_schedule_test.rb
UTF-8
1,826
2.828125
3
[]
no_license
require 'test/unit' require File.expand_path(File.join(File.dirname(__FILE__)), 'amion_schedule') class TestAmionSchedule < Test::Unit::TestCase # def test_bad_password_returns_error # exception = assert_raise(RuntimeError) { # get_one_file("badpwd") # } # assert_equal "Invalid AMION password.", ex...
true
cac8165393130cfe9aaeb99f3244f9f2a7ade27d
Ruby
krsmith7/MediaRanker
/app/models/work.rb
UTF-8
844
2.640625
3
[]
no_license
class Work < ApplicationRecord WORK_CATEGORIES = %w(album movie book) has_many :votes, dependent: :destroy validates :title, presence: true, uniqueness: true validates :category, presence: true, inclusion: { in: WORK_CATEGORIES} def votes_count return self.votes.count end def self.get_category_me...
true
26bcaf6775780bace532d902db60eb289818b7f8
Ruby
paulnicholsen27/canwesingit
/app/models/part.rb
UTF-8
337
2.59375
3
[]
no_license
class Part < ApplicationRecord belongs_to :song has_many :singer_parts has_many :singers, through: :singer_parts def primary_singer has_primary = self.singer_parts.find {|sp| sp.primary? } if has_primary return has_primary.singer else return nil ...
true
1dc8062076628bb223d5e64755225c66a2f04d56
Ruby
elia/model
/lib/lotus/model/adapters/implementation.rb
UTF-8
2,997
2.53125
3
[ "MIT" ]
permissive
module Lotus module Model module Adapters # Shared implementation for SqlAdapter and MemoryAdapter # # @api private # @since 0.1.0 module Implementation # Creates or updates a record in the database for the given entity. # # @param collection [Symbol] the targ...
true
1be22b752eaf78529fa251e9d9b800479f326a24
Ruby
Capleugh/backend_module_0_capstone
/day_7/ceasar_cipher.rb
UTF-8
965
3.390625
3
[]
no_license
class CeasarCipher def encode(phrase, shift_num) p phrase.downcase.chars # if x[0] == a[7] # #find away to dynamically code x[0] - x[10 or however many letters there are in a string] # p shift = a.rotate(5) # p shift[7] # if x[1] == alphabet[4] # p shift = alphabet.rotate(5) ...
true
e6861222e321268a7a8a1ab690d7ad4d3329e8de
Ruby
averysoren/ls-core-curriculum
/rb101/lesson3/easy2.rb
UTF-8
1,530
3.609375
4
[]
no_license
# easy2.rb =begin ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 402, "Eddie" => 10 } Question 1 ages.key?("Spot") ages.has_key?("Spot") ages.member("Spot") ages.include?("Spot") Question 2 munsters_description = "The Munsters are creepy in a good way." "tHE mUNSTERS ARE CREEPY IN A GOOD WAY." "The munsters...
true
926a4eaf81c3c54517d9e7f604d8959cf258ebb4
Ruby
RenatoRosaFranco/rspec-book
/spec/models/contact_spec.rb
UTF-8
1,730
2.53125
3
[]
no_license
# frozen_string_literal: true require 'rails_helper' RSpec.describe Contact, type: :model do subject(:contact) { FactoryBot.build(:contact) } it 'has a valid factory' do expect(contact).to be_valid end it 'is a valid with a firstname, lastname and email' do expect(contact).to be_valid end it 'i...
true
258ecd7e2dc8b1ab55d82ac315e46619e8ad8b64
Ruby
eduardosasso/bullish
/services/percent.rb
UTF-8
373
2.921875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Services class Percent def initialize(new, original) @new = new @original = original end def self.diff(new, original) Percent.new(new, original) end def value (((@new.to_f - @original.to_f) / @original.to_f) * 100).round(2) end ...
true
c40d99dea3d61765c60440056a1299624538c944
Ruby
chriswhitehouse/bowling-challenge-ruby
/lib/game.rb
UTF-8
1,408
3.421875
3
[ "MIT" ]
permissive
require 'frame' class Game MAX_FRAMES = 10 def self.create Game.new end def score(scores) @scores = scores scores_to_frames add_bonuses_to_frames cumulative_scores end private def initialize(frames_collection_class = FramesCollection) @frames = frames_collection_class.new en...
true
6e483a3b4b18da5f7023bd7a68394b3bc8bd0cf3
Ruby
terryg/haze
/models/asset.rb
UTF-8
1,657
2.71875
3
[]
no_license
require 'digest/md5' class Asset include DataMapper::Resource property :id, Serial, :index => true property :s3_fkey, String property :created_at, DateTime property :deleted, Boolean, :default => false property :md5sum, String property :type, String validates_presence_of :s3_fkey, :created_at after...
true
208cb04c4ecc2862fb7e0207e8a135e914898809
Ruby
hanseuly/coderbyte
/TimeConvert.rb
UTF-8
282
3.34375
3
[]
no_license
def TimeConvert(num) time = num/60 minute = (num-time*60).modulo(60) out = [time, minute] return out.insert(1, ':').to_s.inject(:+) end # keep this function call here # to see how to enter arguments in Ruby scroll down TimeConvert(STDIN.gets)
true
99ae10aeb91b2f6e9825a0b7f30cbb2ffa8d1ef4
Ruby
toryu1121/puyoaptana
/作ったプログラム群/sousa.rb
UTF-8
1,914
3.59375
4
[]
no_license
require './matrixx' class Sousa def initialize #操作空間 @sousapuyo = Matrix.new(5, 3) @widthcon = 2 @roll = [0, 1, 2, 3] #初期位置 @sousapuyo.inputstr("nil") @sousapuyo.mat[0][@widthcon] = "a" @sousapuyo.mat[1][@widthcon] = "b" @sousapuyo.tdisp loop do story01 s...
true
d2718303d7787aec29e7b02660d3f026d3b0e9ea
Ruby
gustavokath/advent-of-code-2020
/9A/main.rb
UTF-8
560
2.578125
3
[]
no_license
line_idx = 0 PREABLE_SIZE = 25 preable_hash = {} import = [] $stdin.each_line do |line| value = line.strip.to_i if line_idx < PREABLE_SIZE preable_hash[value] = true import.append(value) else found = false preable_hash.each_key do |key| dif = value - key if preable_hash.key? dif ...
true
eda090a7bec363d6bf95e2b21307b60d83244f13
Ruby
duffuniverse/duff-exercism
/ruby/anagram/anagram.rb
UTF-8
413
3.546875
4
[]
no_license
class Anagram attr_reader :subject def initialize(subject) @subject = subject.downcase end def match(candidates) candidates.select do |candidate| subject != candidate.downcase && char_count(subject) == char_count(candidate.downcase) end end private def char_count(word) ...
true
680ef90c36b495eb2834b298f394dd94a42e2102
Ruby
DougWelchons/enigma
/test/enigma_test.rb
UTF-8
4,244
2.78125
3
[]
no_license
require 'simplecov' SimpleCov.start require 'minitest/autorun' require 'minitest/pride' require 'mocha/minitest' require './lib/enigma' class EnigmaTest < Minitest::Test def test_it_exists enigma = Enigma.new assert_instance_of Enigma, enigma end def test_it_can_generate_a_random_key enigma = Enig...
true
15fb65ab5033f407fbc87448ed346725eb6cb8bf
Ruby
osbornebrook/sanitize_email
/lib/sanitize_email/sanitize_email.rb
UTF-8
2,381
2.625
3
[ "MIT" ]
permissive
#Copyright (c) 2008 Peter H. Boling of 9thBit LLC #Released under the MIT license module OBDev module SanitizeEmail def self.included(base) # Adds the following class attributes to the classes that include OBDev::SanitizeEmail base.cattr_accessor :force_sanitize base.force_sanitize = nil ...
true
6d253cd5f2bb6f3df6964d7d929f82f97661ae36
Ruby
mybuddymichael/poke
/test/test.rb
UTF-8
2,734
2.984375
3
[ "Ruby", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require_relative "test_helper.rb" class TestWindow < MiniTest::Unit::TestCase def setup @window = Window.new end def test_that_window_is_created refute_nil(@window) end end class TestControls < MiniTest::Unit::TestCase def setup @window = Window.new @controls = @window.controls end ...
true
9019f48097850ea7d70eb2d61752ca958c895a22
Ruby
timmyshen/Coursera_Programming_Languages
/Section7/subclassing.rb
UTF-8
1,001
4.09375
4
[ "MIT" ]
permissive
# Programming Languages, Dan Grossman, Jan-Mar 2013 # Section 7: Subclassing class Point attr_accessor :x, :y def initialize(x,y) @x = x @y = y end def distFromOrigin Math.sqrt(@x * @x + @y * @y) # why a module method? Less OOP :-( end def distFromOrigin2 Math.sqrt(x * x + y * y) # uses ...
true
9229e86e4187322d5cb27c17cf96edea6c8cbfd4
Ruby
iamvery/advent-of-code-2019
/ruby/day9.rb
UTF-8
224
2.5625
3
[]
no_license
$LOAD_PATH.unshift(File.expand_path("./lib/")) require "computer" input_program = File.read("../input/day9.txt") puts "Enter mode ('1' for test mode [part 1], '2' for sensor boost mode [part 2]):" Computer.(input_program)
true
20df2f6667c2d2e21cad8c10e2a145b22346ed21
Ruby
jhunschejones/Ruby-Scripts
/episode_namer/lib/models/episode.rb
UTF-8
768
2.875
3
[]
no_license
class Episode DARLING_IN_THE_FRANXX_MATCHER = /^.*\](.*)\s-\s(\d{2}).*(\d{4}p).*$/ def self.from_file(file) show_name, episode_number, episode_resolution = File.basename(file, ".*").match(DARLING_IN_THE_FRANXX_MATCHER).captures new( file: file, number: episode_number, show_name: show_name...
true
f4343271d99be3b1fa0fe1c16b874ad63457964e
Ruby
Th33x1l3/CRTU
/lib/crtu/utils/logger.rb
UTF-8
4,501
2.90625
3
[ "MIT" ]
permissive
require 'rubygems' require 'singleton' require 'fileutils' require 'log4r' require 'tmpdir' include Log4r GLOBAL_LOGGER_FOLDER = File.join(Dir.pwd, 'logs') GLOBAL_LOGGER_LOG_FILE = File.join(GLOBAL_LOGGER_FOLDER, 'logfile.log') SECONDS_IN_DAY ||= 86400 class GlobalLogger include Singleton attr_reader :global_con...
true
14e727d6acbb64e6fd5c90785142eba767ddcca7
Ruby
plkujaw/fizzbuzz
/lib/fizzbuzzapp.rb
UTF-8
142
3.09375
3
[]
no_license
require_relative "fizzbuzz" def fizzbuzzapp(count) result = [] for i in 1..count result << fizzbuzz(i) end return result end
true
4d85873dfb36678ddd554c150c3d0e33467c0d37
Ruby
marcus-a-davis/phase-0
/week-4/longest-string/my_solution.rb
UTF-8
647
4.21875
4
[ "MIT" ]
permissive
# Longest String # I worked on this challenge [by myself, with: ]. # longest_string is a method that takes an array of strings as its input # and returns the longest string # # +list_of_words+ is an array of strings # longest_string(list_of_words) should return the longest string in +list_of_words+ # # If +list_of_wo...
true
6cd0eba13c2b7d790d313f3ca74ddbd8b3c72477
Ruby
spacetimeltd/sasfeed_automatic
/importize.rake
UTF-8
9,054
2.578125
3
[]
no_license
require 'csv' require 'pry' require 'action_view' require 'fileutils' # gen_sas goes first, then sasmap needs to be generated from the header # after that asproducts, wsproduct, maproducts, can be created # with amendments to the string types #lib/tasks/import.rake task :csv_model_import, [ :filename, :model ] => [ :...
true
bd7021dd2779b90f5c7ecf21add3bedccd9fd5ef
Ruby
kateskips/square_array-dumbo-web-career-012819
/square_array.rb
UTF-8
56
2.78125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) array.each Math.sqrt(array) end
true
6a0ea4faffd1dc89e72e11fe34012e363f2765da
Ruby
nuringa/communication_test
/main.rb
UTF-8
562
2.921875
3
[]
no_license
require_relative 'lib/test_passage' require_relative 'lib/result' require_relative 'lib/file_reader' puts 'ВАШ УРОВЕНЬ ОБЩИТЕЛЬНОСТИ' puts 'Тест поможет определить ваш уровень коммуникабельности.' puts puts 'Правдиво ответьте на вопросы:' test_data = FileReader.new test = TestPassage.new test.proceed_test(test_data....
true
f88fe111a311097fdfeb40e4ca7bc7a7921de576
Ruby
huangzhichong/shooter.cn_downloader
/downloader.rb
UTF-8
2,491
2.703125
3
[]
no_license
require "digest/md5" require "rest-client" require "json" require 'open-uri' require 'open-uri' class Downloader def initialize(movie_path) @shooter_url = "http://www.shooter.cn/api/subapi.php" @movie_path = movie_path @movie_utf8_path = URI::encode(@movie_path.force_encoding("utf-8")) @block_size =...
true
846c5969e80e87692de36ee426ac449be2d1f156
Ruby
traciechang/algorithm-problems
/longest_palindromic_substring.rb
UTF-8
1,282
3.828125
4
[]
no_license
require 'pry' def longest_palindrome(s) return "" if s == "" seen = {} palindromes = {} s.each_char.with_index do |char, idx| if seen[char] # binding.pry if idx - palindromes[idx-1] - 1 == seen[char] || is_palindrome?(s[seen[char]..idx]) palindromes[idx]...
true
a8423091a438c7b34480c9d62a27b50d9d7f88f7
Ruby
dendiflet/THPS03J2
/lib/app/store_into_csv.rb
UTF-8
272
2.71875
3
[]
no_license
#store_into_csv require 'csv' class StoreIntoCSV def create_file_and_write_in(imput) #crée un fichier et écris dedans CSV.open("database/csv_emails_list.csv", "w") do |csv| imput.each do |k , v| csv << [k, v] end end end end
true
93b5ba33fd66ddb702be9d628921b4ef4e5f80e9
Ruby
lsamano/ruby-objects-belong-to-lab-dumbo-web-121018
/lib/post.rb
UTF-8
221
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Post attr_accessor :title, :author @@all = [] def self.all @@all end def self.new_post(title, author) post = Post.new @title = title @author = author self.class.all << post end end
true
3266e4016c81737cd1fe3a3db8819dd69459552f
Ruby
square/connect-api-examples
/connect-examples/v1/ruby/payments-report.rb
UTF-8
6,732
3.125
3
[]
no_license
# Demonstrates generating the last year's payments report with the Square Connect API. # Replace the value of the `ACCESS_TOKEN` variable below before running this script. # # This sample assumes all monetary amounts are in US dollars. You can alter the # formatMoney function to display amounts in other currency format...
true
5f739dc9a0880e82792c98df0c4ccfc5b837b8df
Ruby
ntnga/hoc-ruby
/Ruby/Chuong 10/ex10_2.rb
UTF-8
605
2.578125
3
[]
no_license
require "./Chuong 10/lib_json" include Lib_json url = "http://dev-er.com/service_api_ban_sach/api_service_sach.php?task=sach_noi_bat" content = doc_json_httparty(url) puts "===========================THỐNG KÊ SÁCH NỔI BẬT===========================" tong_sach = content.size puts "Tổng số sách nổi bật : #{tong_sach} đầ...
true
279fb0714e0a06c034fab750906b29da7a78918b
Ruby
estebanz01/ruby-statistics
/spec/statistics/math_spec.rb
UTF-8
4,997
3.53125
4
[ "MIT" ]
permissive
require 'spec_helper' describe Math do describe '.factorial' do it 'is not defined for numbers less than zero' do expect(described_class.factorial(rand(-100...0))).to be_nil end it 'returns one for zero or one' do expect(described_class.factorial(0)).to eq 1 expect(described_class.fact...
true
819ba2c85c046c68dc801e817e55c3b9d9089036
Ruby
ColtAdkins/calculator-cucumber
/features/step_definitions/addition_steps.rb
UTF-8
665
3.328125
3
[ "MIT" ]
permissive
require 'calculator' When /^I add two numbers$/ do @value = Calculator.new.sum 6, 23 end Then /^I get their value$/ do expect(@value).to eq 29 end When /^I add zero to a number$/ do @value = Calculator.new.sum 6, 0 end Then /^the value is that number$/ do expect(@value).to eq 6 end When /^I add the same nu...
true
19f615cd1aee408bafd9fabd5be090e24d8ef6d9
Ruby
govindarajanv/ruby
/sololearn/namespacing.rb
UTF-8
724
4.34375
4
[]
no_license
#namespacing means organizing similar classes in a module. In other words, we'll use modules to group related classes. module Pet class Dog def speak puts "Woof!" end end class Cat def speak puts "Meow" end end end #We can have the same class names across different modules. blacky...
true
22faf12d2e00bd32a2152426e92dd917a259244e
Ruby
alvarodltp/project-euler-multiples-3-5-dc-web-062518
/lib/oo_multiples.rb
UTF-8
330
3.765625
4
[]
no_license
# Enter your object-oriented solution here! class Multiples attr_accessor :num def initialize(num) @num = num end def collect_multiples (1...self.num).to_a.select do |n| n % 3 == 0 || n % 5 == 0 end end def sum_multiples arr = collect_multiples arr.inject(0){|sum, n| sum + n} ...
true
ce6fcbddba1ea3f34630cfc1c0a85c17f3fcb108
Ruby
dhinojosa/language-matrix
/ruby/arrays/arrays.rb
UTF-8
370
3.53125
4
[ "MIT" ]
permissive
a = [1, 2, 3, 4, 5] b = a.collect do |i| i + 2 end c = a.collect {|i| i + 10} puts "a: #{a}" puts "b: #{b}" puts "c: #{c}" d = a[1] puts "d: #{d}" e = a.select{|i| i % 2 == 0} puts "e:#{e}" a.each{|i| puts i} a.each_index{|i| puts i} a.each_with_index{|o,i| puts "Object: #{o}; Index: #{i}"} f = a.delete_if...
true
00f688bb36c732693072a8a20f2c1938a594068d
Ruby
nacltsutomu/ruby-exercise
/c11_compile.rb
UTF-8
3,653
4.28125
4
[]
no_license
# #puts "金額を入力してください" #bill = gets.to_i #puts "割り勘する人数を入力してください" #number = gets.to_i #warikan = bill / number #puts "1人あたり#{warikan}円です" # <hint> # getsはキーボードからの入力を取り込むメソッド # numberを0で入力した場合、ZeroDivisionError #1 #例外処理 puts "金額を入力してください" bill = gets.to_i puts "割り勘する人数を入力してください" number = gets.to_i beg...
true
4f3deba18e21e5a3737313a9bbb3306e97040a58
Ruby
YulyKo/ruby-tasks
/task55.rb
UTF-8
236
3.21875
3
[]
no_license
a = 35 b = 55 c = 35 d = 22 def check_big_figure(a, b, c, d) if a > 0 and b > 0 if a >= c and b >= d puts "one rectangle inside another rectangle" else puts 'no way' end end end check_big_figure(a, b, c, d)
true
ef23c10ea38198d19d4cda7521f7def618424b86
Ruby
loisyang/bread_express
/app/helpers/orders_helper.rb
UTF-8
563
2.546875
3
[]
no_license
module OrdersHelper # create a helper to get the options for the address select menu # will return an array with key being recipient : address so # that customers can choose the right address for this order def get_address_options Address.active.by_recipient.map{|add| ["#{add.recipient} : #{add.street_1}",...
true
c5f46da6fba9b246ea068ec9a95af70b8011eb97
Ruby
edwardkerry/battle
/spec/features/attack_spec.rb
UTF-8
1,941
2.90625
3
[]
no_license
feature 'Attack' do before do allow(Kernel).to receive(:rand).and_return(20) end # As Player 1, # So I can win a game of Battle, # I want to attack Player 2, and I want to get a confirmation scenario 'attacking player 2' do sign_in_and_play click_button('Attack') expect(page).to have_cont...
true
dd7118a9df5852dc51bbdf6d4560c05b900d3219
Ruby
wazsmwazsm/Ruby_prc
/data_type.rb
UTF-8
672
3.578125
4
[]
no_license
#!/usr/bin/ruby # -*- coding:UTF-8 -*- # 次幂计算 puts '计算'; puts 2**(1/4); puts 16**(1/4.0); # 字符串 puts '字符串'; puts 'escape using "\\"'; puts 'That\'s right'; puts "相乘 : #{24*60*60}"; name = "Ruby"; puts "#{name+",ok"}"; # 数组 puts '数组'; arr = ['aa', 10, 3.22, "hello you", 'heheheheh']; arr.each do |i| puts i end ...
true
9630e1b555620fd4ace3a24c349f74271281b3c3
Ruby
KaraAJC/know-yourself
/lib/result.rb
UTF-8
682
3.265625
3
[]
no_license
class Result attr_reader :counts, :summary def initialize @counts = { true: 0, false: 0, skipped: 0 } @summary = { answered_yes: [], answered_no: [] } end def confirm(statement) @counts[:true] += 1 @summary[:answered_yes] << statement end def deny(statement) @counts[:false] += 1 ...
true
b51e7249204d7e1d6d02ab549c3722211bf69ecc
Ruby
dcdc100/launch_school_repository
/intro_to_ruby/hashes/exercise2.rb
UTF-8
278
3.296875
3
[]
no_license
hash1 = { a: 100, b: 200 } hash2 = { c: 300, d: 400 } hash1.merge(hash2) puts hash1 # => {:a=>100, :b=>200} puts hash2 # => {:c=>300, :d=>400} hash1.merge!(hash2) puts hash1 # => {:a=>100, :b=>200, :c=>300, :d=>400} puts hash2 # => {:c=>300, :d=>400}
true
348673336153f55686fb1fe940a5f260e3f96ed4
Ruby
deebot10/enigma
/lib/enigma.rb
UTF-8
1,188
3.0625
3
[]
no_license
require './lib/encryptable' require 'date' class Enigma include Encryptable attr_reader :key, :date def initialize @alphabet = ("a".."z").to_a << " " @key_range = ("A".."D").each_with_object({}) { |chr, hash| hash[chr] = 0 } @offset_range = ("A".."D").each_with_object({}) { |ch...
true
5b1ecfdab14bf8bea73ea87efbdd93bcdb331df8
Ruby
okaryo/Hello-World
/RubyPractice/practice1.rb
UTF-8
170
3.671875
4
[]
no_license
puts 27.to_s(16) puts 12.to_s(2) puts 15.to_s(2) def add(a, b, c) a + b + c end puts add(2, 4, 8) n = 5 puts n puts "hello\nworld" name = "ruby" puts "hello #{name}"
true