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
2bdfb3b662e76c103623633cfa4329cb52819334
Ruby
cklim83/launch_school
/02_rb101_rb109_small_problems/03_easy_3/01_searching_101.rb
UTF-8
1,729
4.46875
4
[]
no_license
=begin Searching 101 Write a program that solicits 6 numbers from the user, then prints a message that describes whether or not the 6th number appears amongst the first 5 numbers. Examples: ==> Enter the 1st number: 25 ==> Enter the 2nd number: 15 ==> Enter the 3rd number: 20 ==> Enter the 4th number: 17 ==> Enter...
true
11465913fb2202eea55f0d3a1ec475ad8d996850
Ruby
k1LoW/bun
/lib/bun/extractor.rb
UTF-8
1,501
2.625
3
[ "MIT" ]
permissive
# coding: utf-8 require 'natto' require 'ltsv' module Bun class Exctractor def self.extract_line(line) line.strip! line.gsub!(/([>"'])/, '\1 ') # @dirty fmt = { node_format: 'word:%M\ttype:%s\tfeature:%H\n', unk_format: 'word:%M\ttype:%s\tfeature:%H\n', eos_format: 'EOS\...
true
83f0e1cf5df68d860a6f5b1f362804a7086ce77f
Ruby
iiom/codewars
/Alternating_Split.rb
UTF-8
8,270
3.90625
4
[]
no_license
# For building the encrypted string: # Take every 2nd char from the string, then the other chars, that are not every 2nd char, and concat them as new String. # Do this n times! # Examples: # "This is a 14-2 v1 v2!", 1 -> "hsi etTi sats!" # "This is a 14-2 v1 v2!", 2 -> "hsi etTi sats!" -> "s eT ashi tist!" # моё de...
true
0e66427fb19d1b582bdf5dae9793fe350c152be9
Ruby
egrueter-dev/Other-challenges
/ab_check.rb
UTF-8
534
3.984375
4
[]
no_license
#A/B_Check.rb # Return the string true if the characters a and b are # separated by exactly 3 places anywhere in the string at # least once (ie. "lane borrowed" would result in true # because there is exactly three characters between a and b). # Otherwise return the string false. def ABCheck(str) i = 0 while i ...
true
16b9a5c5b528d21c81545c5c9c5849d2965da558
Ruby
emilyjspencer/student-directory
/directory.rb
UTF-8
3,190
4.34375
4
[]
no_license
@students = [] # an empty array accessible to all methods def print_menu puts "1. Input the students" puts "2. Show the students" puts "3. Save the list to students.csv" puts "4. Load the list of students from students.csv" puts "9. Exit" # 9 because we'll be adding more items end def interactive_menu l...
true
19ac706d5ef58e5521097ad433c1cfe71680dab6
Ruby
phebal/matasano-crypto-ruby
/s2c12.rb
UTF-8
1,706
3.21875
3
[]
no_license
#!/usr/bin/env ruby require 'pry' require 'openssl' require 'base64' require './cryptlib.rb' key = random_bytes(16) target = Base64.decode64('Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvd...
true
e1a46166470adc2f152377579e5fe124173f4d71
Ruby
DamonClark/mystuff
/calculatorex4.rb
UTF-8
285
3.328125
3
[]
no_license
#How many cases are in Sugar? VSA = 16 Support = 9 Open = VSA + Support puts Open #How many cases are in my Sugar? MySupport = 2 MyAwaitingResponce = 8 MyCases = MySupport + MyAwaitingResponce puts # A string is how you make something that your program might give to a human.
true
e8075b34c88587ef2ab9f1586f5238a5b05d01b6
Ruby
yyytuit/ruby_gold
/弱い問題/26.rb
UTF-8
727
2.84375
3
[]
no_license
オブジェクトのマーシャリングについて、適切な記述を全て選びなさい。(複数選択) 1.IOクラスのオブジェクトはマーシャリングできない。 2.特異メソッドを持つオブジェクトはマーシャリングできない。 3.ユーザが作成したオブジェクトはマーシャリングできない。 4.無名のクラスやモジュールはマーシャリングできない。 答え1,2,4 システムの状態を保持するオブジェクト(IO、File、Dir、Socket) や特異メソッドを定義したオブジェクトは、マーシャリングできません。また、無名のクラスやモジュールもマーシャリングできません。
true
81a514572d30ac78c5614191edeb67a137740ec6
Ruby
kwgt/envlog
/lib/envlog/schema.rb
UTF-8
805
2.515625
3
[ "MIT" ]
permissive
#! /usr/bin/env ruby # coding: utf-8 # # Environemnt data logger # # Copyright (C) 2020 Hiroshi Kuwagata <kgt9221@gmail.com> # require "yaml" require "json_schemer" module EnvLog module Schema using DeepFreezer class << self def read(path) data = YAML.load_file(path) data.keys.ea...
true
b55d105584c6343f111522e6e089d74302a07b59
Ruby
lionellionel/tealeaf_prep_course
/intermediate_quiz.ex9.rb
UTF-8
682
3.34375
3
[]
no_license
munsters = { "Herman" => { "age" => 32, "gender" => "male" }, "Lily" => { "age" => 30, "gender" => "female" }, "Grandpa" => { "age" => 402, "gender" => "male" }, "Eddie" => { "age" => 10, "gender" => "male" }, "Marilyn" => { "age" => 23, "gender" => "female"} } age_groups = { kid: (0..17), adult: (18..64), s...
true
335465c723a16141cb387983b4a11939f7de21f3
Ruby
shelleyyz/WDi28-Homework
/zabrina_lagamayo/week_04/day_04/main.rb
UTF-8
1,738
2.6875
3
[]
no_license
require 'sinatra' require 'sinatra/reloader' require 'sqlite3' require 'pry' require 'youtube_embed' # remember Create Read Update Delete get '/' do erb :home end get '/instruments' do @instruments = query_db 'SELECT * FROM instruments' erb :instruments_index end get '/instruments/new' do erb :instruments_...
true
2390ddcb558f751e5711e29be85dde80c050c858
Ruby
RomanADavis/challenges
/euler/ruby/solved/problem_set(1-25)/problem21/solutions/solution.rb
UTF-8
381
3.609375
4
[]
no_license
def sum_of_proper_divisors(n) divisors = [1] (2..((n**0.5).to_i)).each do |candidate| divisors += [candidate, n / candidate] if n % candidate == 0 end divisors.uniq.inject(:+) end def amicable?(n) n == sum_of_proper_divisors(sum_of_proper_divisors(n)) && n != sum_of_proper_divisors(n) end puts (1...10_...
true
6d44cfd8b99f35c25f86b6f0791492a4bc1e1ddf
Ruby
stefanos1316/Rosetta_Code_Data_Set
/tasks/concurrent-computing/ruby/concurrent-computing.rb
UTF-8
194
2.84375
3
[ "CC0-1.0" ]
permissive
(0..1000000).each do |i| %w{Enjoy Rosetta Code}.map do |x| Thread.new do sleep 0.001 puts "#{i} #{x}" end end.each do |t| t.join end end
true
760ea2e531db08522c51c86b92ca4cf1ad58e51e
Ruby
fcofdez/biimail
/app/models/repository.rb
UTF-8
243
2.640625
3
[]
no_license
class Repository def initialize @repositories ||= {} end def register(type, repository) repositories[type] = repository end def repositories @repositories ||= {} end def for(type) repositories[type] end end
true
3d04eff435f2bff48081e33c344e09b68f33d4ab
Ruby
antman999/ruby-oo-object-relationships-kickstarter-lab-nyc01-seng-ft-042020
/lib/backer.rb
UTF-8
509
3
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Backer attr_accessor :name def initialize(name) @name = name end def back_project(project) ProjectBacker.new(project, self) # create a project backer # connect the project with the backer end def backed_projects projects_backed = ProjectBacke...
true
176e53c270d6ba01e253a8674735db69aa33f9bd
Ruby
jmartenstein/streetfood
/server/streetfood.rb
UTF-8
3,136
2.515625
3
[]
no_license
#!/usr/bin/ruby require 'sinatra' require 'haml' require 'compass' require 'active_support/core_ext/integer/inflections' require './model/stop.rb' require './model/truck.rb' require './model/location.rb' configure do Compass.configuration do |config| config.project_path = File.dirname(__FILE__) confi...
true
066fb3b6fea7b359b38c0f8dcce6b59bda049c8a
Ruby
iMears/ruby_practice
/nick1.rb
UTF-8
259
3.8125
4
[]
no_license
class Personal_chef def make_milkshake(flavor) puts("making the milkshake #{flavor}.") end def make_eggs(quantity) puts("making #{quantity} eggs for you sir..") end end frank = Personal_chef.new frank.make_milkshake("chocolate") frank.make_eggs(9)
true
8208a3202b8ac54c04fcfce98a08d78ef53b398c
Ruby
343334/pokemon-webhook
/lib/pokedex.rb
UTF-8
780
3.5
4
[]
no_license
require 'json' class Pokedex DATAFILE = 'lib/pokemon.json' def initialize (id=0) file = File.read(DATAFILE) @@dex = JSON.parse(file) @current = id end def show puts @@dex end def find (id=0) if id.is_a? String p = @@dex.select {|k,v| v['name'].downcase==id.downcase} @c...
true
6f069a7e5615a7387658cf4333bc95aa7b12a425
Ruby
hariskov/ruby-fi
/databaseConfig.rb
UTF-8
218
2.578125
3
[]
no_license
require 'sequel'; class DatabaseConfig attr_reader :table; def initialize() db = Sequel.sqlite; db.create_table :fibonacci do primary_key :id String :contents end @table = db[:fibonacci]; end end
true
6eaf6379b4415e947491b1d42da6a9ec4fc3a5f6
Ruby
lev18d/FamilyMosaic
/FamilyMosaic/app/helpers/application_helper.rb
UTF-8
12,540
2.640625
3
[]
no_license
module ApplicationHelper # Common helpers sit under lib/helpers include TextFormattingHelper def bootstrap_flash_class(flash_type) { success: 'alert-success', error: 'alert-danger', alert: 'alert-warning', notice: 'alert-info' }[flash_type.to_sym] || flash_type.to_s end def re...
true
b0b542d709745dd07f0734845961f7b35381da55
Ruby
groovad/dawn-ce
/script/backup_db.rb
UTF-8
2,849
2.578125
3
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
# -*- coding: utf-8 -*- # DBからバックアップファイルを作るスクリプト # rakeから使う。 $:.unshift(File.join(File.expand_path('.'), 'src')) require 'find' require 'pathname' require 'optparse' require 'sequel' require 'sequel/extensions/inflector' require 'unlight' OUTPUT = false SEPARATOR = ',' ORIG = true # 漢字取り出しに使う物だけバックアップ FILE_LIST = /Ac...
true
2fa2f5200a66949e4cdd6d0a67ea86c75d4d7650
Ruby
bastianorte/actividad11
/2 ciclos/ejercicio8.rb
UTF-8
245
3.734375
4
[]
no_license
# Generar -utilizando un ciclo iterativo- un string con la siguiente estructura: # a = '1impar 2par 3impar 4par 5impar 6par 7impar 8par 9impar 10par' a = 0 10.times do |i| a += 1 print "#{a}par " if a.even? print "#{a}impar " if a.odd? end
true
b9eb0a2091c1c952bb627dc51ba5b1737b34ef6e
Ruby
BDiumula/Itsa-me-Mario
/exo_03.rb
UTF-8
202
3.140625
3
[]
no_license
puts "Bonjour, monde!" #puts "Et avec une voix sexy, ça donne : Bonjour, monde!" --> Mettre en # devant la ligne transforme celle-ci en commentaire. Il n'y a donc que la première ligne qui s'affiche.
true
07f4ca755f35da0789911df5bd35d5efc1f62379
Ruby
google-code/applicationwiki
/base/base_scrap.rb
UTF-8
4,953
2.625
3
[]
no_license
# this is some stuff for youthgive specifically that is in base_utils but seems to crash # it is a mess anyway ######################################################################### # utilities # xxx move this ######################################################################### # dump all an...
true
ee4a7a7e2f03d7234f94c123c5b9e7c503abb7ed
Ruby
ga-chicago/sinatra-mvc-crud
/controllers/ApplicationController.rb
UTF-8
2,181
2.578125
3
[]
no_license
# this will take the place of app.rb from now on # it's the primary class in our app # note that it inherits from Sinatra Base application class ApplicationController < Sinatra::Base require 'bundler' Bundler.require() # enable sessions enable :sessions # yep that's it # set up db connection ActiveRecord...
true
d9c97d27f425c57b5697945ee843a4a4a1c69f60
Ruby
brewster1134/yuyi
/lib/yuyi/cli.rb
UTF-8
1,310
2.609375
3
[]
no_license
require 'thor' class Yuyi::Cli < Thor desc 'list', 'Show all rolls available based on the sources defined in your menu.' option :menu, :aliases => '-m', :desc => 'Path to your menu file' def list Yuyi::Menu.new options[:menu] # Collect all rolls from all sources # rolls = [] Yuyi::Menu.sourc...
true
8fe3612a6abb11e7f2973772475af101e03cad4b
Ruby
Andyreyesgo/patrones
/x.rb
UTF-8
278
3.390625
3
[]
no_license
def xletter2(n) n.times do |i| n.times do |j| if j == n-(i+1) print "*" elsif j==i print "+" else print " " end end print "\n" end end xletter2(5)
true
60d1323ddf1288b307c160c0901d2e4c6efc8eeb
Ruby
raecoo/thinking-sphinx-chinese
/lib/thinking_sphinx/index.rb
UTF-8
2,614
2.796875
3
[ "MIT" ]
permissive
require 'thinking_sphinx/index/builder' require 'thinking_sphinx/index/faux_column' module ThinkingSphinx # The Index class is a ruby representation of a Sphinx source (not a Sphinx # index - yes, I know it's a little confusing. You'll manage). This is # another 'internal' Thinking Sphinx class - if you're using...
true
0fcd3101670e2dafea2d177408cffb2eda9b7d13
Ruby
ffaker/ffaker
/lib/ffaker/lorem_ua.rb
UTF-8
1,168
2.890625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true module FFaker module LoremUA extend ModuleUtils extend self def word fetch_sample(WORDS) end def words(num = 3) fetch_sample(WORDS, count: num) end def sentence(word_count = 7) elements = words(word_count + rand(0..9)) elements.inse...
true
4da376f0760676fc691ea91a5918f00108c4d322
Ruby
kconnellmail/ruby_for_metadataists
/ruby/marc_fixes.rb
UTF-8
4,852
2.5625
3
[ "Apache-2.0" ]
permissive
require 'marc' ### Error detection ## Find indicators that are non-numeric def invalid_indicators?(record) record.fields.each do |field| next unless field.class == MARC::DataField return true unless field.indicator1 =~ /^[0-9 ]$/ && field.indicator2 =~ /^[0-9 ]$/ end false end ## Find discrepancies bet...
true
a696efb30802ed6e88ce5bcd9e830d8883229a65
Ruby
albertbahia/wdi_june_2014
/w02/d05/jon_porras/weekend_assignment/lib/apartment.rb
UTF-8
949
3.359375
3
[]
no_license
require_relative 'tenant.rb' class Apartment attr_reader(:name, :floor, :price, :sqftage, :bedrooms, :bathrooms, :tenants) def initialize(name, floor, price, sqftage, bedrooms, bathrooms) @name = name @floor = floor @price = price @sqftage = sqftage @bedrooms = bedrooms @bathrooms = bathroo...
true
e344f29d3dc36fe74bf78e04851ea1bbf2b3907e
Ruby
vbabison/jungle-rails
/spec/user_spec.rb
UTF-8
3,264
2.546875
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do context "Validations" do it "has all valid properties " do @user = User.create(firstname:"Alex", lastname: "Lock", email: "alex@lock.com", password:"123456", password_confirmation: "123456") @user.validate! ...
true
70683379558c0a4c0ade4fe029ae22e2b1d4a484
Ruby
mrflip/lorkbong
/vendor/wukong/lib/wukong/extensions/pathname.rb
UTF-8
597
3.40625
3
[ "Apache-2.0" ]
permissive
require 'pathname' class Pathname # Append path segments and expand to absolute path # # file = Pathname(Dir.pwd) / "subdir1" / :subdir2 / "filename.ext" # # @param [Pathname, String, #to_s] path path segment to concatenate with receiver # # @return [Pathname] # receiver with _path_ appended and exp...
true
e84948b1148ee7002c7235c0a350549bae044a42
Ruby
thesteady/test-r
/app/models/analyzer.rb
UTF-8
421
2.71875
3
[]
no_license
class Analyzer # def new # @survey_data = survey_data # end def run puts "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" puts "Running Analyzer!!!!" puts "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" output = %x(`ruby lib/r_scripts/hello.rb`) return output # run a simple R script # get the value ...
true
a4a4ba1a12dd1fcb19b25b36d2d039f68b0d2369
Ruby
goronfreeman/alfred-mixed-case
/generator.rb
UTF-8
466
3.40625
3
[]
no_license
require "json" def letter?(look_ahead) look_ahead.match?(/[[:alpha:]]/) end def mixed_case(string, upcase: true) string.each_char.map do |char| next char unless letter?(char) (upcase = !upcase) ? char.upcase : char.downcase end.join end input = ARGV[0].split(" ") output = input.map { |string| mixed_c...
true
13b4c7ba403e178fc4f0ad351f5659797706c548
Ruby
skateonrails/flower_shop_ruby
/app/models/order_input_line.rb
UTF-8
558
2.84375
3
[]
no_license
# frozen_string_literal: true # OrderInputLine represents one line from order input # it will be used to validate each line of order input class OrderInputLine attr_reader :quantity, :product_code def initialize(args) @check_value = nil @value = args[:value] parse_value end private def parse_va...
true
daa67ed6e2e3a9bece26b97834e6c1292149c77f
Ruby
janlelis/az
/lib/az/string_ext.rb
UTF-8
175
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative "../az" class String # Optional core extension for your convenience def az(font) Az.az(self, font = :ascii) end end
true
7026b2d272ee28fd44e117f3dcb11d60afe80930
Ruby
Lokideos/ruby-think-project
/lesson-8/hw-les-8/route.rb
UTF-8
1,310
3.296875
3
[]
no_license
class Route attr_reader :stations, :station_names, :name def initialize(first_station, last_station) @stations = [first_station, last_station] validate! @name = "route#{object_id}" end def add_station(station) @stations.insert(-2, station) end def delete_station(station) return false ...
true
9c4138f0981ca55d4057b8bf9ba56e0e31722de7
Ruby
BadMinus/devise
/lib/devise/encryptors/bcrypt.rb
UTF-8
558
2.625
3
[ "MIT" ]
permissive
require "bcrypt" module Devise module Encryptors # = BCrypt # Uses the BCrypt hash algorithm to encrypt passwords. class Bcrypt < Base # Gererates a default password digest based on stretches, salt, pepper and the # incoming password. We don't strech it ourselves since BCrypt does so internal...
true
caa79aa379bcd22d9254ec2cc0e449010ef67bc6
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/nucleotide-count/ec06ff872e6542f8b5009667c2634ff6.rb
UTF-8
617
3.671875
4
[]
no_license
class DNA attr_reader :strand, :nucleotide_counts def initialize(strand) @strand = strand @nucleotide_counts ||= { 'A' => strand.count('A'), 'T' => strand.count('T'), 'C' => strand.count('C'), ...
true
54c49086973ba645a51bcbc9947b53381019cb8b
Ruby
wtfspm/advent_of_code
/2020/08/computer.rb
UTF-8
1,589
3.203125
3
[]
no_license
#!/usr/bin/env ruby def parse(input) instruction = /(\w+) ([+-]\d+)/ input.split(/\r?\n/).map { |line| instruction.match(line).captures.tap { |cap| cap[1] = cap[1].to_i } } end def run(instructions) registers = { pc: 0, acc: 0, } seen = Array.new(instructions.size, false) until see...
true
1ed3d398b10d90d147c9bc9a25cc98b0e37e8671
Ruby
jmc282/D2
/location.rb
UTF-8
1,746
3.640625
4
[]
no_license
# Class defining location object class Location attr_accessor :max_silver attr_accessor :name attr_accessor :max_gold attr_accessor :amt_neighbors attr_accessor :neighbors # Initialization of location def initialize(name, max_silver, max_gold, amt_neighbors) @name = name @max_silver = max_si...
true
0c284f2d6904e3d9fa39209696428e7b57ef0c3f
Ruby
mrinsin/Ruby_recap
/ruby_basics.rb
UTF-8
2,459
4.21875
4
[]
no_license
#Write a program which takes a number and prints "Valid" if the number is between 1 and 10 (inclusive) and "Invalid" otherwise. def is_valid(num) (1..10).include?(num.to_i) ? "Valid" : "Invalid" end #PASSWORD CHECKER CHALLENGE # Challenge: Write a function called same that takes a user ID and a password, and retu...
true
cad3567719c0df155790cd50e4ea34c013c5998a
Ruby
JoJordan/one_stop_shop
/lib/services.rb
UTF-8
442
2.515625
3
[]
no_license
require 'yaml' class Services class << self def init @services ||= YAML::load(File.open('./services.yaml')) end def services init @services end def service_url(service_name, post_code) init @services[service_name]['where'].gsub(':post_code', post_code) end...
true
f0cdd7cb7d0bab4076281dea78191eba5acb5d80
Ruby
cielavenir/procon
/codeforces/tyama_codeforces722B.rb
UTF-8
103
2.765625
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby gets a=gets.chars.chunk{|c|c}.select{|k,v|k=='B'}.map{|k,v|v.size} p a.size puts a*' '
true
57b7643329932445df93f86a3a0db7e4532c6f28
Ruby
luchrist777/ruby-music-library-cli-onl01-seng-pt-050420
/lib/concerns/findable.rb
UTF-8
356
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
module Concerns::Findable # defines a module named Concerns::Findable (FAILED - 1) def find_by_name(name) self.all.detect{|song| song.name == name} end def find_or_create_by_name(name) # is added as a class method to classes that extend the module (FAILED - 1) self.find_by_name(name)...
true
e60ef092376c3268d987810b4d7dd765bea6e8a0
Ruby
mariofsalles/minicurso-ruby
/Modulo3/blocos.rb
UTF-8
609
3.640625
4
[]
no_license
def bloco puts "Esse é o inicio do bloco" yield #Aqui virá o código passado no bloco ao chamar o método puts "Esse é o fim do bloco" end bloco { puts "Fui chamado no bloco da chamada do método" } puts "---------------------------------------------------" bloco do puts "Dessa forma, pode-se chamar várias instr...
true
69b66c7c0dc227a2563ab6c19e606e02ffc0e356
Ruby
mawaldne/exercism_solutions
/ruby/space-age/space_age.rb
UTF-8
568
3.359375
3
[]
no_license
class SpaceAge ORBITAL_PERIOD_EARTH_YEARS = { earth: 1, mercury: 0.2408467, venus: 0.61519726, mars: 1.8808158, jupiter: 11.862615, saturn: 29.447498, uranus: 84.016846, neptune: 164.79132 } EARTH_YEARS_SECONDS = 31557600 def initialize(seconds) @seconds = seconds end ...
true
d7e4bcc5ceb1bb0ae521de5744129d21b32c9ae6
Ruby
lucidstack/nascunna
/lib/nascunna.rb
UTF-8
1,795
2.5625
3
[ "MIT" ]
permissive
require "configuration" require "cacheable" module Nascunna def self.redis @redis end def self.redis=(redis_instance) @redis = redis_instance end def self.add_model(model) @model = model yield(self) Nascunna::Configuration.cacheables.each do |model| model.class_eval <<-EOS ...
true
413d33a668bf7aa80d1f0ed78ec4803389bb38dc
Ruby
KenEucker/jackpine-biketag-api-rails
/app/models/notifications/successful_guess_notification.rb
UTF-8
294
2.578125
3
[]
no_license
class Notifications::SuccessfulGuessNotification < Notifications::DeviceNotification attr_reader :guesser_name def initialize(guess) @guesser_name = guess.user_name end def push_notification Houston::Notification.new( alert: "#{guesser_name} captured your spot!" ) end end
true
580e2c03ba969d00af6dd59e30e4f0aeac6a52ba
Ruby
adam-mrachek/launchschool120-old
/lesson_4/easy_3/question_7.rb
UTF-8
576
4.09375
4
[]
no_license
# What is used in this class but doesn't add any value? class Light attr_accessor :brightness, :color def initialize(brightness, color) @brightness = brightness @color = color end def self.information return "I want to turn on the light with a brightness level of super high and a color of green" ...
true
1014309795ea294f2d461643ad80fe327252314d
Ruby
ksefcovic/CYBR4580
/find_my_device_app/application/lib/data_token.rb
UTF-8
468
2.8125
3
[ "Apache-2.0" ]
permissive
class DataToken < TokenBuilder include InitLater def initialize(extract_data = ->(x) { x }, token_builder) @token_builder = token_builder @extract_data = extract_data end def build(data) puts "builds_data" cons(extract_data.(data), token_builder.build(data)) end ...
true
d076cea54b14d8d64e653c2dd2c260205a2a0bf9
Ruby
myles-i-appdev/each-chapter
/each_spell_word.rb
UTF-8
230
3.984375
4
[]
no_license
# Write a program that: # # Asks your user to enter any word and have it spelled out letter by letter. p "Enter a word for me to spell:" word = gets.chomp num_letters = word.length num_letters.times do |idx| p word[idx] end
true
1f733075b3e7227d3c6f6782540f1ab34d55c570
Ruby
shakamo/booklyn
/app/models/import_images.rb
UTF-8
728
2.65625
3
[]
no_license
require 'net/https' require 'json' # コンテンツの一覧を取得するクラス # アニメやドラマのタイトル、放送日などを取得する。 # アニメやドラマのタイトル、放送日などを取得する。 class ImportImages # Contentを取得して、データベースに格納する。 # @param site_name [String] Contentを取得するサイトを指定する。Anikore, Rakuten # @param year [String] Contentを取得する範囲を指定する。Anikore のみ。2015 # @param season [String] C...
true
ab1fd1e01786689c73d0b7f3d1ddf3aab17f102e
Ruby
jeanlazarou/swiby
/core/test/test_changing_styles.rb
UTF-8
2,052
2.5625
3
[ "CC-BY-2.5", "BSD-3-Clause" ]
permissive
#-- # Copyright (C) Swiby Committers. All rights reserved. # # The software in this package is published under the terms of the BSD # style license a copy of which has been included with this distribution in # the LICENSE.txt file. # #++ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'te...
true
e5adbf41d5086893fbc598f8e00358422d86aee1
Ruby
peterylai/exercism
/ruby/hamming/hamming.rb
UTF-8
265
2.859375
3
[]
no_license
class Hamming def self.compute(first_strand, second_strand) raise ArgumentError.new if first_strand.length != second_strand.length (0...first_strand.length).count { |i| first_strand[i] != second_strand[i] } end end module BookKeeping VERSION = 3 end
true
ae9752e6d835ba55b0d17d90eab4a16a0c9df40d
Ruby
40grivenprog/homeworks
/HW_04/Boris_Tsarikov/boris_tsarikov_hw_04_t_02.rb
UTF-8
786
2.859375
3
[]
no_license
require 'yaml' def magic_number(pool = 1, timeout = 1000) timeout = 1000 if timeout.nil? pool = 1 if pool.nil? pool * timeout end def selection_of_info(hash = {}) result = {} selection(result: result, hash: hash, id: :db, selec_name: 'database') selection(result: result, hash: hash, id: :user, selec_name:...
true
fbbc7624c65be3199109a7fff4f47007b849fc49
Ruby
Monique1129/practice-folder
/user_practice.rb
UTF-8
1,051
3.359375
3
[]
no_license
class User def initialize @first_name = nil @middle_name = nil @last_name = nil @email = nil @phone_number = nil @address = nil end def set_first_name(identity) @first_name = identity end def get_first_name puts @first_name return @first_name end def set_middle_name(mother...
true
1519dcd6d9542bcffe5b12fa66640332014e04bf
Ruby
KayQuillen/SandBox
/3_11.rb
UTF-8
579
3.890625
4
[]
no_license
#challenge 1 #begin first_name = "Sam" last_name = " Wright" savings = 3000000 checking = 2000 print "#{first_name}#{last_name} has #{savings} dollars in savings and #{checking} dollars in checking." #end #challenge 2 #begin puts "please enter First name" first_name = gets.chomp.to_s puts "please enter Last name" la...
true
85e48d9e2ecae7b7e821592f3b9831206f7b695a
Ruby
RolandeS/customer_relationship_application
/crm.rb
UTF-8
3,251
3.984375
4
[]
no_license
require_relative './rolodex.rb' require_relative './contact.rb' class CRM attr_accessor :name def initialize(name) @name = name #instance variable @rolodex = Rolodex.new end def print_main_menu puts "[1] Add a contact" puts "[2] Modify a contact" puts "[3] Display one contact" puts "[4] Display all ...
true
fafff96d9cbc9e2c647ffa241cf30ef1e7a36745
Ruby
manzugeek/prog_foundation
/lesson_2/test_data.rb
UTF-8
870
3.90625
4
[]
no_license
# produce = { # 'apple' => 'Fruit', # 'carrot' => 'Vegetable', # 'pear' => 'Fruit', # 'broccoli' => 'Vegetable' # } # # def select_fruit(produce_list) # produce_list.select { |k, v| v == "Fruit" } # end # # select_fruit(produce) # do..end # produce_list.select do |k, v| # v == "Fruit" # end arr = [1, 2, ...
true
d707f5244ec0ee072392c1242adb4e32b0c39012
Ruby
erikabalbino/codecore-homework
/homework-5/blog_on_rails/db/seeds.rb
UTF-8
417
2.609375
3
[]
no_license
Post.destroy_all 50.times.each do p = Post.create( title: Faker::Job.title, body: Faker::Lorem.paragraph ) if p.valid? rand(0..10).times.each do Comment.create( body: Faker::Job.field, post: p ) end end end posts=Post.all comments = Comment.all puts Cowsay.say "Cr...
true
f815e0b069e40b8a406db0defd92f7a144594e66
Ruby
ARElton/deli-counter-ruby-apply-000
/deli_counter.rb
UTF-8
627
4.03125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. def line(katz_deli) if katz_deli == [] puts "The line is currently empty." elsif final_message = "The line is currently:" katz_deli.each_with_index do |people, i| final_message << " #{i += 1}. #{people}" end puts final_message.chomp end end def take_a_number(katz_deli...
true
9c0a8af242d5f7b3d47b8018fc509f52643e33d6
Ruby
philjdelong/code_challenges
/recursion.rb
UTF-8
1,279
3.90625
4
[]
no_license
# require 'pry' def combo menu = { 'veggie sandwich' => 6.85, 'extra veggies' => 2.20, 'chicken sandwich' => 7.85, 'extra chicken' => 3.20, 'cheese' => 1.25, 'chips' => 1.40, 'nachos' => 3.45, 'soda' => 2.05, } sorted_menu = menu.sort.reverse receipts = [4.85, 11.05, 13...
true
8f1ac29af30d68fffa74d170a1ba9e9dec8f18f4
Ruby
mattTea/chitter-challenge
/spec/features/posting_peeps_spec.rb
UTF-8
476
2.5625
3
[]
no_license
# As a Maker # So that I can let people know what I am doing # I want to post a message (peep) to chitter feature "Posting peeps" do scenario "a user can add message to form" do visit "/peeps/new" expect(page).to have_selector "form" end scenario "a user can post a peep to Chitter" do visit "/peep...
true
69df198601c9217a584fe7c964af09b0679a8c00
Ruby
Nekitoni4/thinknetica_begin
/lesson_1/quadratic_equation.rb
UTF-8
432
3.34375
3
[]
no_license
puts "Input a coefficient plz, sir:" a = gets.to_i puts "Input b coefficient plz, sir:" b = gets.to_i puts "Input c coefficient plz, sir:" c = gets.to_i d = b**2 - 4 * a * c if d < 0 puts "No roots. bro;(" elsif d == 0 x = -b/(2.0 * a) puts "Discriminant is #{d}, x is #{x}" else discRoot = Math.sqrt(d) x1 =...
true
4faa20de601f820c8bfe2759812236e0b1f45e03
Ruby
thefrankharvey/key-for-min-value-prework
/key_for_min.rb
UTF-8
531
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# ```ruby # ikea = {:chair => 25, :table => 85, :mattress => 450} # key_for_min_value(ikea) # # => :chair # # name_hash = {"apple" => -45, "banana" => -44.5, "carrot" => -44.9} # # key_for_min_value(veggies) # # # => "apple" # # ``` def key_for_min_value(name_hash) values = [] hash_array = name_hash.to_a name_hash....
true
b6da3ac52d73a8cd421d919d218267f8b371543a
Ruby
jukinner/Coding-Practice-Codewars-Codility-Hackerrank-etc.-
/playing_with_numbers-7ku-strong_number.rb
UTF-8
1,931
4.125
4
[]
no_license
# Definition # Strong number is the number that the sum of the factorial of its digits is equal to number itself. # For example : 145 , since # 1! + 4! + 5! = 1 + 24 + 120 = 145 # So, 145 is a Strong number. # Task # Given a number, Find if it is Strong or not . # Warm-up (Highly recommended) # Playing With Numbers ...
true
2a68286043be8da46e7eddb8c2429d0aeb6d3251
Ruby
UKGovernmentBEIS/beis-report-official-development-assistance
/app/models/benefitting_region.rb
UTF-8
1,297
2.828125
3
[ "MIT" ]
permissive
class BenefittingRegion include ActiveModel::Model attr_accessor :name, :code, :level DEVELOPING_COUNTRIES_CODE = "998" class << self def all @all ||= Codelist.new(type: "benefitting_regions", source: "beis").map { |region| new_from_hash(region) } end def all_for_level_code(level_code = 3) ...
true
844cffb2343e15a7fa37cb32d28d9d68dddf0617
Ruby
henrygambles/Boris_Bikes
/spec/docking_station_spec.rb
UTF-8
2,552
3.09375
3
[]
no_license
require "./lib/docking_station.rb" describe DockingStation do it { is_expected.to respond_to :release_bike } it "returns a bike object when release_bike method is called and a bike is docked" do docking_station = DockingStation.new docking_station.dock(Bike.new) expect(docking_station.release_bike.is_...
true
f020dee596a70edc61390780510efda7dc08f056
Ruby
PatrickMcConnell88/advent-of-code-2018
/dec-02/part1.rb
UTF-8
638
3.625
4
[]
no_license
#!/usr/bin/ruby input_array = File.readlines('input.txt') num_doubles = 0 num_triples = 0 input_array.each do |id| contains_double = false contains_triple = false char_array = id.chars hash_map = {} char_array.each do |char| if hash_map[char] == nil hash_map[char] = 1 else hash_map[ch...
true
59419961a07f385f8c74ff676552c75892477021
Ruby
punsammy/ruby_fundamentals2
/exercise7.rb
UTF-8
173
3.09375
3
[]
no_license
puts "type something" text = gets text = text.chomp symbol = "###===" def wrap_text(text, symbol) "#{symbol.reverse}#{text}#{symbol}" end puts wrap_text(text, symbol)
true
f368623d93f96b6bfaff008c289005e42f5cab09
Ruby
jeremyevans/sacruby
/2015-08-rpssl/tests/tc_cfh_random_player.rb
UTF-8
339
2.703125
3
[]
no_license
require_relative '../players/cfh_random_player.rb' require 'test/unit' class MyPlayerTest < Test::Unit::TestCase def test_choose_rock p = CfhRandomPlayer.new('cfh') choice = p.choose assert( [:spock, :rock, :paper, :scissors, :lizard].any? do |move| move == choice end ...
true
cef7ca11f9339202927d5e62d5c52f0971c69d82
Ruby
EJLarcs/rake-todo-web-0715-public
/Rakefile
UTF-8
1,308
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# This is an example of a Rake Task called "hello_rake" task :hello_rake do puts "Hello, from rake" end task :default do puts "Hello, from default task!" end #creates a defaul rake task :environment do require_relative './config/environment' end #creates the environment task :upcoming_todos => [:environment] d...
true
100f8dbe8688219fe3dd4b8cedee690845c4e6bb
Ruby
musiccity365/pfwtfp-practice-with-array-integers-lab-dc-web-mod1-repeat
/lib/array_practice.rb
UTF-8
1,314
4.09375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
array_of_integers = *0...50 def all_odds(array) # return all odd numbers from the input array array.select { |i| i.odd? } end def all_evens(array) # return all even numbers from the input array array.select { |i| i.even? } end def all_squares(array) # return the square of all numbers from the input array ...
true
745f92a922c96aa46d31d8a90f11f00a67491051
Ruby
togiberlin/algorithmic_challenges
/coderbyte/a_easy/ruby/17_array_addition/array_addition.rb
UTF-8
201
3.015625
3
[ "MIT" ]
permissive
def array_addition_i(arr) largest_number = arr.max arr.delete(largest_number) arr.repeated_combination(arr.length) .to_a .map { |ary| ary.uniq.inject(:+) }.include? largest_number end
true
8f2dbac0535fa87012507862486ad894e7a62328
Ruby
xxuejie/cuckoo
/spec/routes/api_spec.rb
UTF-8
4,839
2.609375
3
[]
no_license
require 'spec_helper' describe 'api' do def post_json(loc, hash) post loc, hash.to_json end def fetch_json last_response.should be_ok JSON.parse(last_response.body, symbolize_names: true) end def signin post_json '/api/signin.json', {login_name: @login_name, password: @pass} end def e...
true
3f841b61b626027cc7d4f10b13f8db22a4fc1c1e
Ruby
ABaldwinHunter/advent_of_code_2020
/day_02/solution.rb
UTF-8
746
3.5625
4
[]
no_license
rows = File.read("./input.txt").split("\n") items = rows.map { |row| row.split(" ") }.map do |item| item[0] = item[0].split("-").map(&:to_i) # range item[1] = item[1].split(":").first item[2] = item[2] item end ## Part 1 # def valid?(range, letter, password) # occurrences = password.count(letter) # if (o...
true
3c2778125adba23457f7a606c865b94dec08c044
Ruby
raptor-xx/bakalar
/config/initializers/active_record.rb
UTF-8
666
2.625
3
[]
no_license
module ActiveRecord module ConnectionAdapters class Column def self.string_to_date_with_european_format(string) begin Date.strptime(string, '%d.%m.%Y') rescue string_to_date_without_european_format(string) end end def self.string_to_time_with_european_...
true
d9bc097950d7af87347030d26f84ac324d600732
Ruby
ameliend/rails-longest-word-game
/app/controllers/games_controller.rb
UTF-8
1,135
3.34375
3
[]
no_license
require 'json' require 'open-uri' class GamesController < ApplicationController def new @letters = [] @voyelles_select = [] @voyelles = ['a','e','i','o','u'] 7.times { @letters << ('a'..'z').to_a.sample } 3.times { @voyelles_select << @voyelles.to_a.sample } @voyelles_select.each do |voyelle...
true
1696645bbd322c5143771919bc523a257337bcfd
Ruby
dpneumo/simplestate
/test/dummy/dummy_state.rb
UTF-8
450
2.90625
3
[ "MIT" ]
permissive
require 'dummy/dummy_state_holder' # Designed to match the public interface of decendents of State class DummyState attr_reader :holder def initialize( holder: , opts: nil ) @holder = holder @opts = opts end def name 'DummyState' end alias :to_s :name def symbol :Dummy...
true
c5ca11daac9bea5e8ee87fb4d09207e93b8e5eb2
Ruby
esmaeilmirzaee/rubycode
/udemy/number_of_vowels.rb
UTF-8
135
3.4375
3
[]
no_license
class String def number_of_vowels gsub(/[^aeiou]/, '').size end end p "hello".number_of_vowels p 'something'.number_of_vowels
true
df282a5894e2fa1873d4e764f5cd2d9844e9c676
Ruby
plamengj/Algorithms-in-ruby
/gnome_sort/gnome_sort.rb
UTF-8
702
3.875
4
[]
no_license
# include RSpec # require 'pry' def gnome_sort(array) i = 1 # If you are at the start of the array then go to the right element (from arr[0] to arr[1]). while i < array.size # Repeat till ‘i’ reaches the end of the array # If the current array element is smaller than the previous array element then swap thes...
true
170df159c5030f8f2a7f6409be2ee2234aafc4bf
Ruby
bradbann/kermitweb
/github_issues.rb
UTF-8
1,197
2.65625
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require 'rubygems' require 'curb' require 'json' F=File.open('source/code/issues.md','w') repo = "https://api.github.com/users/kermitfr/repos" def mdwrite(s) F.write("#{s}\n") end header = <<EOT --- layout: page title: "issues" comments: true sharing: true footer: true sidebar: false --- Issu...
true
773a98f9f34c535032fbfb2c5eddbe167678083d
Ruby
pikender/my_ruby_projects
/gol/lib/composite_command.rb
UTF-8
422
2.71875
3
[]
no_license
class CompositeCommand < Command attr_reader :commands def initialize @commands = [] end def add_command(cmd) @commands << cmd end def delete_command(cmd) @commands.delete(cmd) end def execute @commands.each {|cmd| cmd.execute} end def description description = '' @comma...
true
80ba25c1214cb109c50b43f0fdb9d67a2f5d70ed
Ruby
tianhe/tradewinds
/lib/marketplace/craigslist.rb
UTF-8
5,929
2.671875
3
[]
no_license
class Marketplace::Craigslist def initialize url @url = url end def fetch_listings proxies = HideMyAss::ProxyList.new.fetch request = HideMyAss::Request.new(proxies) response = request.run(@url) @rss = SimpleRSS.parse response.response_body end def populate_listings @rss.items.each d...
true
b7f2507a9eef5cbffa22a2e650379e96899ddb44
Ruby
ladeeluc/deli-counter-ruby-apply-000
/deli_counter.rb
UTF-8
1,061
3.859375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def line(position) index = 0 if position.empty?# should say the line is empty puts "The line is currently empty." else #should display the current line #works with different people in line string = "The line is currently:" position.each_with_index do |item, index| string...
true
7a524b095b28ec32ebfdb8665d3ffc3ab3d49a4a
Ruby
Siphonay/epitech_projects
/projects/projet_103architect/103architect/103architect
UTF-8
6,004
3.46875
3
[]
no_license
#!/usr/bin/env ruby # coding: utf-8 # PROJECT 103architech # TEAM "2 GUYS 1 PROJECT" # ALEXIS "SAM" VIGUIÉ <alexis.viguie@epitech.eu # ALEXANDRE "KARIBOU" LARONCE <alexandre.laronce@epitech.eu> # No license applied. We are not liable in any way from anything caused by any possible use of the following code. # Started ...
true
78eea8d021e8235299645bcd531af628391aee38
Ruby
iSarCasm/codebreaker-app
/lib/models/game.rb
UTF-8
887
2.703125
3
[ "MIT" ]
permissive
class Game < SessionStorage extend SingleUnitStorage attr_reader :codebreaker_game def self.storage_path :game end def initialize(difficulty:) @codebreaker_game = Codebreaker::Game.new @codebreaker_game.start(difficulty.to_sym) end def guess(code) code = code.split('').map { |x| x.to_i(...
true
b7432c0c2c79288efea0fe9d4b7f6be8f6ab1e8a
Ruby
natashamcintyre/oystercard2
/spec/journey_spec.rb
UTF-8
1,228
2.625
3
[]
no_license
require "journey" RSpec.describe Journey do let(:exit_station) { double :exit_station, zone: 1 } let(:entry_station) { double :entry_station, zone: 1 } # let(:completed) { double :completed, zone: 1 } it "knows if a journey is not complete" do expect(subject).not_to be_completed end it "has a penalty f...
true
be2478708a38a1e1c6f65fd5a0ea2e72c27dc1b4
Ruby
TonyCWeng/w2d4
/two_sum.rb
UTF-8
1,141
3.703125
4
[]
no_license
def bad_two_sum?(arr, target) (0...arr.length-1).each do |i| (i+1...arr.length).each do |j| return true if arr[i] + arr[j] == target end end false end def okay_two_sum?(arr, target) sorted = arr.sort (0...sorted.length).each do |i| remainder = target - sorted[i] return true if b_search(...
true
5ce04d9c92bd74a889669ecd0ed8c86e6375f8b4
Ruby
unheavenlycreature/sinatra-mastermind
/lib/mastermind.rb
UTF-8
1,288
3.1875
3
[]
no_license
# frozen_string_literal: true require_relative 'codemaker' # A game manager for the board game "Mastermind" class Mastermind def initialize @codemaker = RobotCodeMaker.new @remaining_turns = 12 end def new_game @remaining_turns = 12 @codemaker.create_secret_code end def correct_guess?(gues...
true
a6400d5594aae10048ee42d59498a791d6c308c0
Ruby
moralesalberto/my_game
/my_game.rb
UTF-8
724
3.046875
3
[]
no_license
require 'rubygems' require 'gosu' require 'player' require 'ball' class MyGame < Gosu::Window def initialize super(1000,1000,false) @player1 = Player.new(self) @balls = 3.times.map {|count| Ball.new(self,5+count)} end def update if button_down? Gosu::Button::KbLeft @player1.move_left...
true
9ac838db54d6c6a275cb95ad8bc7ec7108d7dc20
Ruby
polyfox/moon-packages
/spec/moon/packages/std/core_ext/integer_spec.rb
UTF-8
519
2.75
3
[ "MIT" ]
permissive
require 'spec_helper' require 'std/core_ext/integer' describe Integer do context '#pred' do it 'should return the preceeding integer' do expect(1.pred).to eq(0) end end context '#round' do it 'should round the integer' do expect(1.round(2)).to eq(1.0) end end context '#masked?' ...
true
d55ccb5e8d443e519af7bf66d7cf32f52b348477
Ruby
Franerial/Thinknetica_Ruby_Base-Railway
/lesson_7/wagon.rb
UTF-8
353
3.03125
3
[]
no_license
require_relative "manufacter" require_relative "validation" class Wagon include Manufacter include Validation attr_reader :type def initialize(type) @type = type validate! end private def validate! raise ArgumentError, "Введён неверный тип вагона" unless [:passenger, :cargo].include? type ...
true
49033153e1db5e3f50b6d75da4505c24c650bbed
Ruby
koheiyamada/jenkins_test
/script/bank_accounts/reset_bank_id.rb
UTF-8
669
2.59375
3
[]
no_license
yucho = Bank.find_by_code 'yucho' mitsu = Bank.find_by_code 'mitsubishi_tokyo_ufj' ActiveRecord::Base.transaction do BankAccount.all.each do |bank_account| if bank_account.bank.blank? account = bank_account.account if account.is_a? YuchoAccount puts "Bank account of user #{bank_account.owner....
true
9456f55234e92c982b45e89b7229727d45043e82
Ruby
jason/url-shortener
/app/models/url.rb
UTF-8
952
2.546875
3
[]
no_license
require 'launchy' class URL < ActiveRecord::Base belongs_to :user has_many :comments has_many :clicks # attr_accessible :title, :body # def get_url(url) # @long_url = url # save # end # def get_short_url # @short_url = @id # save # end def self.create_url(long_url, user_id = nil) ...
true
2e6dff1fe805b3a0b2d63ba66cb92a2f8c5f619b
Ruby
hale4029/backend_module_0_capstone
/day_2/exercises/iteration_practice.rb
UTF-8
866
4.46875
4
[]
no_license
#Iteration and each Practice #doubles x = (1..10).to_a x.each { |x| puts x * 2 } print "-----------\n" #triples x.each { |x| puts x * 3 } print "-----------\n" #print even numbers x.each { |x| puts x if x.even? } print "-----------\n" #create new array whcih contains each number multiplied by 2 x_new = x.collect...
true
e853da75901ee887517a0ae44d428c693aebcd18
Ruby
jgonzalezd/codility
/02/cyclic_rotation.rb
UTF-8
1,755
3.1875
3
[]
no_license
require 'benchmark' require 'byebug' require 'test/unit' include Test::Unit::Assertions # [0,1] # [1,0] n= 1 # [0,1] n= 2 # [0,1,2] # [2,1,0] n=1 # [0,1,2] 1 2 3 # [0,1,2] n= 3 [2,0,1] | [1,2,0] | [0,1,2] # [0,0,0,0,0,0,1,1,1,1] # [1,1,1,0,0,0,0,0,0,1] # [0,0,0,0,0,1,1,1,1,0] def solution(ar...
true
5d2def01d16cdb653946d9a65edd6560f37efbfa
Ruby
pickleburns/TB-tdd
/hashtag/spec/lib/fake_twitter_spec.rb
UTF-8
1,040
2.65625
3
[]
no_license
require 'spec_helper' require 'fake_twitter' describe FakeTwitter do context '#search' do it 'returns an array of objects who respond to text' do fake_twitter = FakeTwitter.new('#awesome', [{'text' => 'cool yo'}, {'text' => 'sweet bud'}]) results = fake_twitter.search('#awesome') results.map(&:text).should...
true