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
f6d34da71dfcf405ca13dca1487dae401abd713e
Ruby
BenJohnCarson/chitter-challenge
/app/models/peep.rb
UTF-8
509
2.515625
3
[]
no_license
class Peep include DataMapper::Resource TIME_FORMAT = "%b %e %k:%M" def self.reverse_chronological all(:order => [ :created_at.desc ]) end property :id, Serial property :body, Text, required: true property :created_at, DateTime belongs_to ...
true
ee7f7d3a714e13e36da26970caaf81fd839b9607
Ruby
kiizerd/chess
/lib/display.rb
UTF-8
5,030
3.21875
3
[]
no_license
require 'paint' require 'tty-prompt' module Display def prompt TTY::Prompt.new end def introduction puts `clear` puts Paint[title, "gold", nil] puts Paint[welcome, :black, :white] main_menu end def main_menu options = ['Start Game', 'Configure', 'More Info', "Exit"] case prompt...
true
984417538dfe6c3b148c6d43db0e72b79612b130
Ruby
sergeych/boss_protocol
/spec/boss_spec.rb
UTF-8
8,442
2.9375
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'spec_helper' require 'json' require 'zlib' require 'base64' require 'boss-protocol' require 'socket' class SocketStream def initialize socket @socket = socket end def read length=1 # data = '' # while data.length < length # data << @socket.recv(length - data.length...
true
4f19e6e7d4f2d25981540e94dc354e1a2ae2a1b4
Ruby
Stricks1/TicTacToe
/spec/board_spec.rb
UTF-8
692
3.078125
3
[]
no_license
# rubocop:disable require './lib/winning.rb' require './lib/board.rb' require './lib/messages.rb' describe Board do let(:board) { Board.new } describe '#change_grid' do it 'Return false if the user give string as parameter to fill the board' do expect(board.change_grid('wrong', 'X')).to eql(false) e...
true
1816b57536b5473e75f8c84f048187bc438f8f73
Ruby
darnold001/rack-dynamic-routes-lab-denver-web-060319
/app/item.rb
UTF-8
185
3.28125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Item attr_accessor :name, :price def initialize(name,price) @name = name @price = price end def self.price @price end def self.name @price end end
true
217e9bd695112f5efe081639601e4349b40b0ef4
Ruby
paul-christmann/project-euler
/ruby/lib/project_euler/problems/problem_21.rb
UTF-8
662
3.296875
3
[]
no_license
module ProjectEuler module Problems class Problem21 def initialize(max) @max = max end def amicables @amicable_sums = {} @amicable_pairs = [] (1..@max).each do |i| amicable_sum = Number.new(i).amicable_sum if @amicable_sums[amicable_sum]...
true
15a5b7daaccc66c093c925090b78ff05c7714ee5
Ruby
niuchenming/dotfiles
/bin/itb
UTF-8
2,335
3.21875
3
[]
no_license
#!/usr/bin/env ruby class ITBooks def initialize(args) menu(lookup(args)) end private def lookup(args) require 'net/http' require 'json' books = [] page = 1 query = URI.encode(args.join(' ')) loop do response = Net::HTTP.get(URI("http://it-ebooks-api.info/v1/search/#{quer...
true
73ead24209c37e7116bb1eb25352ccdc17163e90
Ruby
dantrovato/launch-school
/small_problems/easy6/2_delete_vowels.rb
UTF-8
1,255
4.125
4
[]
no_license
=begin # Delete vowels # Write a method that takes an array of strings, and returns an array of # the same string values, except with the vowels (a, e, i, o, u) removed. # # Example: # remove_vowels(%w(abcdefghijklmnopqrstuvwxyz)) == %w(bcdfghjklmnpqrstvwxyz) remove_vowels(%w(green YELLOW black white)) == %w(grn YLLW b...
true
620f7e90a275023aaf0b21e8e63ee89edc9fea49
Ruby
cuon-kakimoto/refactoring_ruby_edition
/10/10_8_replace_parameter_with_method.rb
UTF-8
2,063
3.765625
4
[]
no_license
######################################## # 引数からメソッドへ # [MEMO] # - むむ、引数をどんどん取り除いていってる。 # - 内部の引数がなくなった。。。 # - どんどんメソッド化されていった。これの使いどきを知りたいリファクタリングですね。 # - 最終的に、すべてのメソッドで引数がなくなった。。。 # - 「メソッドが引数として渡される値を他の手段で手に入れられるならそうすべき」 # - 長い引数リストはわかりにくい。 ######################################## # [BAD] #class Item # def initiali...
true
81f09f687fe1b83d6941b3bf57996ed065474e75
Ruby
infovore/alain-de-bot
/alaindebot.rb
UTF-8
1,697
2.84375
3
[]
no_license
#!/usr/bin/env ruby require "rubygems" require "bundler/setup" require "#{File.dirname(__FILE__)}/lib/array.rb" require "#{File.dirname(__FILE__)}/lib/markov_chain.rb" require 'yaml' Bundler.require(:default) DB = Sequel.sqlite("#{File.dirname(__FILE__)}/alain_de_bot.db") def generate_items tweets = DB[:existing_t...
true
5af83dc4eea4ef8329d60b4b28c86d923096f224
Ruby
priestd09/VideoOrganizer
/VideoOrganizer.rb
UTF-8
6,984
2.78125
3
[]
no_license
#!/usr/bin/env ruby require 'find' require 'exifr' require 'mini_exiftool' require "fileutils" require 'optparse' require 'pp' require 'zlib' require './lib/DirWalker' require './lib/FileSignatures' VIDEO_EXTENSIONS = [".MOV", ".mov", ".MTS", ".mts", ".MP4", ".mp4"] class FileOrganizer OTHER_DIR = "Other" #...
true
849bb164c9b26a926ab0532a253d5ae41ebc19f5
Ruby
ALTERNATIF69/MarioRestart
/exo_11.rb
UTF-8
291
3.78125
4
[]
no_license
puts " Donne moi un nombre" print "> " nombre = gets.chomp.to_i compteur = 1 while (compteur <= nombre) puts "Salut, ça farte ?" compteur += 1 end #Écris un programme exo_11.rb qui demande un nombre à #l'utilisateur, puis qui écrira autant de fois "Salut, ça farte ?" #EXO = OK
true
b56245e3a67dc0389b85572074c34b214caed09f
Ruby
rikkimalh/phase-0-tracks
/ruby/santa.rb
UTF-8
1,988
3.90625
4
[]
no_license
class Santa attr_reader :age, :ethnicity attr_accessor :gender def initialize(gender, ethnicity) @gender = gender @ethnicity = ethnicity @reindeer_ranking = ["Rudolph", "Dasher", "Dancer", "Prancer", "Vixen", "Comet", "Cupid", "Donner", "Blitzen"] p "Initializing Santa Instance..." end def speak ...
true
d0c8d78892c152979b35e1f09c3b5aa54773dd32
Ruby
danachen/Ruby
/LS101/easy5/p7.rb
UTF-8
644
3.953125
4
[]
no_license
# Prob 7: Letter Counter (Part 2) # def word_sizes(input) # occurrences = Hash.new(0) # input.gsub!(/[^a-z ]/i, '') # input.split.each do |element| # occurrences[element.size] += 1 # end # occurrences # end def word_sizes(words_string) counts = Hash.new(0) words_string.split.each do |word| ...
true
24f1bf3ab97cd257bb0d0f824b10e8c2a3d523fc
Ruby
mikeebert/ttt-ruby
/spec/command_line_game_spec.rb
UTF-8
6,142
2.953125
3
[]
no_license
require 'command_line_game' require 'human_player' require 'player_factory' require 'mocks/mock_game' require 'mocks/mock_ui' require 'mocks/mock_board' require 'mocks/mock_human' require 'mocks/mock_computer' describe CommandLineGame do before(:each) do @ui = FakeUI.new @cli_runner = CommandLineGame.new(@ui...
true
5b379ad7b26b84ad188e42872687d984bce6b079
Ruby
klavinslab/BIOFAB_Production
/protein_purification/protocol/make_iptg_aliquots/protocol.rb
UTF-8
1,062
2.578125
3
[]
no_license
#Pei, 2019 #Recipe: 0.5M IPTG solution (final concentration in the 450 mL of cell culture is 0.5mM), molar mass of IPTG(Isopropyl beta-D-1-thiogalactopyranoside): 238.30 g/mol class Protocol def main operations.make show do title "Gather the Following Items:" check "<b>18</b> 1...
true
4a725c2cedf129667776e055c6c7d33811171947
Ruby
diceesugar/book-tdd-ruby
/part1/ch15/sum.rb
UTF-8
394
3.046875
3
[]
no_license
# frozen_string_literal: true require './expression' require './money' class Sum include Expression attr_accessor :augend, :addend def initialize(augend, addend) @augend = augend @addend = addend end def plus(_addend) null end def reduce(bank, to) amount = @augend.reduce(bank, to).amo...
true
9fdbc11ce347081be2528c4e9311a4e26f71c981
Ruby
gard/ezpaas-cli
/lib/ezpaas/cli/commands/apps.rb
UTF-8
2,963
2.859375
3
[ "MIT" ]
permissive
require 'thor' require 'tty' require 'random-word' require 'uri' require 'ezpaas/cli/commands/server_commands' require 'ezpaas/http/rest_client' module EzPaaS module CLI module Commands class Apps < ServerCommands desc 'list', 'Lists all apps registered with the EzPaaS server' def list ...
true
0d0cc0d594fb948b797a7bdb7adf87fecc384d54
Ruby
emperorliu/appacademy
/w1/w1d3/mastermind.rb
UTF-8
2,214
4.09375
4
[]
no_license
require 'colorize' require 'byebug' class Code CODES = %i(r g y b o p) # actual words # COLORS = { r: :red, g: :green, y: :yellow, b: :blue, o: :orange, p: :purple } # squares with different shading # COLORS = { # r: "\u25A4", g: "\u25A5", y: "\u25A6", b: "\u25A7", o: "\u25A8", p: "\u25A9" # } # di...
true
235afd3ac0f06db237b1d9b02dcb7458a7d78e72
Ruby
jd1386/importer
/author_name.rb
UTF-8
1,743
3.1875
3
[]
no_license
require 'amatch' require 'namae' require 'awesome_print' names = [] (0...ARGV.size).each do |i| names << ARGV[i].rstrip end author_name_to_query = names.join(' ') authors = [] File.readlines('/Users/jungdolee/projects/importer/data/author_name_source.txt', encoding: 'UTF-8'). each do |line| line.rstrip! authors...
true
e181e770dee4db80d18993269972be6e34217727
Ruby
bisraeli/WDI_Summer_Public
/assignments/city_populations.rb
UTF-8
802
4.09375
4
[]
no_license
city_populations = {:san_francisco => 100000, :nyc=> 900000, :boston => 600000} def annotate_population(city_symbol, city_populations_hash) population_value = city_populations_hash[city_symbol] return "#{[city_symbol]} (Population #{population_value}" end puts annotate_population(:san_francisco, city_populations)...
true
9905f1836569c48ac0e7e077072ed4d3ac8bece8
Ruby
steveoro/goggles_core
/spec/strategies/fin_calendar_meeting_builder_spec.rb
UTF-8
19,478
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'rails_helper' describe FinCalendarMeetingBuilder, type: :strategy do let( :fixture_rows ) { FinCalendar.where( id: [1, 2, 4, 5, 6, 7, 8, 10, 13] ).to_a } let( :matching_meeting_ids ) { [16_232, 16_215, 16_236, 16_358, 16_201, 16_230, 16_237, 16_300, 16_247] } let...
true
1b8bf43dc3e159c7676443f71ad88437493efa98
Ruby
FujitsuEnablingSoftwareTechnologyGmbH/crowbar-ha
/chef/cookbooks/pacemaker/libraries/pacemaker/cib_object.rb
UTF-8
7,264
2.859375
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
require "mixlib/shellout" module Pacemaker class CIBObject attr_accessor :name @@subclasses = { } unless class_variable_defined?(:@@subclasses) class << self attr_reader :object_type def register_type(type_name) @object_type = type_name @@subclasses[type_name] = self ...
true
325aff2904a2f00f6b45a1aad595a465bde6d72e
Ruby
mkolodziej/sckrk_calisthenics
/spec/unit/timelines_repository_spec.rb
UTF-8
622
2.84375
3
[]
no_license
require 'spec_helper' describe TimelinesRepository do it "returns different timelines for different users" do bob = User.new("Bob") alice = User.new("Alice") first_timeline = TimelinesRepository.for(bob) second_timeline = TimelinesRepository.for(alice) first_timeline.should_not eq(second_timelin...
true
0c79fe7163acfd83739b25e650abe3f2fbc851b4
Ruby
bdhunter3141/ar-exercises
/exercises/exercise_5.rb
UTF-8
575
3.140625
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' puts "Exercise 5" puts "----------" # Your code goes here ... @total_revenue = Store.pluck(:annual_revenue).sum @average_revenue = @total_revenue / Store.all.siz...
true
4b8f32fd88cd6b3d37720c4053d9ce719e423681
Ruby
nigoshu/p_production_2
/app/models/twitter_user.rb
UTF-8
494
2.609375
3
[]
no_license
class TwitterUser < ApplicationRecord #引数に関連するユーザーが存在すればそれを返し、存在しまければ新規に作成する def self.find_or_create_from_auth_hash(auth_hash) #OmniAuthで取得した各データを代入していく provider = auth_hash[:provider] uid = auth_hash[:uid] nickname = auth_hash[:info][:nickname] TwitterUser.find_or_create_by(provider: provider, u...
true
00140bb09945458504cf83cfa1a11452e9ed218d
Ruby
paultirlisan/Bus-app
/app/models/station.rb
UTF-8
790
2.71875
3
[]
no_license
class Station < ApplicationRecord belongs_to :company has_many :departure_routes, class_name: "Route", foreign_key: :departure_station_id, dependent: :destroy has_many :arrival_routes, class_name: "Route", foreign_key: :arrival_station_id, dependent: :destroy validates :name, presence: true validates :city...
true
69b73c6c78153aca5df0e2f4ab2f4069faacbe98
Ruby
klueless-io/sample_cmdlet_patterns
/lib/sample_cmdlet_patterns/commands/key_reader_on.rb
UTF-8
1,553
3.09375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative '../command' require 'tty-config' require 'tty-prompt' require 'tty-reader' module SampleCmdletPatterns module Commands # You can register to listen on a key pressed events. This can be done by calling on with a event name(s) class KeyReaderOn < SampleCmdletPa...
true
e6416ecb43307fb92754962c187195f36b80823c
Ruby
JuanDuran85/ejercicios_ruby_basico
/matematica/calculadora_basica.rb
UTF-8
834
4.21875
4
[ "Apache-2.0" ]
permissive
puts "Calculadora básica con Ruby (suma, resta, multiplicacion, division, potencia)" def calculadora(num1,num2,op) if op == "+" "#{num1} + #{num2} = #{sprintf("%.2f",num1+num2)}" elsif op == "-" "#{num1} - #{num2} = #{sprintf("%.2f",num1-num2)}" elsif op == "*" "#{num1} * #{num2} = #{spr...
true
8daaaf6499684b72cd7c07f9d53c306271882add
Ruby
ANamelessBand/jobs-for-charity
/helpers/user_helpers.rb
UTF-8
271
2.546875
3
[]
no_license
module UserHelpers def logged? !session[:user].nil? end def logged_user User.find(id: session[:user]) if logged? end def login_user(user) session[:user] = user.id end def logout_user session[:user] = nil redirect '/' end end
true
0c657280a88d9c94f1fe096060ac06c6d511def0
Ruby
pachisaez/ft-language
/lib/token/url.rb
UTF-8
179
2.546875
3
[]
no_license
require 'colorize' module Token class Url < Token::Base def initialize url super Token::Base::URL, url end def printed @lexeme.colorize :light_blue end end end
true
5147f4c3955d08c2db3ca67464a5f2431f42693f
Ruby
mskeen/rubyfun-tower
/lib/zombie.rb
UTF-8
730
3.265625
3
[]
no_license
require 'gosu' class Zombie SPEED = 1.2 STEP_SPEED = 16 def initialize(window, x, y, direction, scale_x, scale_y, tiles) @tiles, @window = tiles, window @x, @y, @direction = x, y, direction @scale_x, @scale_y = scale_x, scale_y @step = 0 @step_change = STEP_SPEED end def draw @tile...
true
90da29fef907975762feb43cf1e89c8d762299ae
Ruby
mkielan/Ruby_TextMining_
/lib/text_mining/io/sheet_destination.rb
UTF-8
2,202
3.171875
3
[ "MIT" ]
permissive
require 'roo' require 'spreadsheet' require_relative '../n_grams' module TextMining::IO class SheetDestination attr_accessor :sheet def initialize path = nil @path = path @book = Spreadsheet::Workbook.new #open(path, 'wb') @current_row = -1 end def switch_sheet name = nil ...
true
c098863aa177dd4f3e2491689378af66d5d812a1
Ruby
theCrab/potluck
/lib/taxi/subscription.rb
UTF-8
1,412
2.921875
3
[ "MIT" ]
permissive
require 'active_support/core_ext' class Subscription cattr_reader :beginning attr_accessor :interval, :start_date, :frequency attr_reader :residue @@beginning = Date.new(2014, 1, 1) def initialize(args) args.each { |k, v| instance_variable_set("@#{k}", v) unless v.nil? } @frequency ||= :daily c...
true
5d0a5c30b42b36df7d23c5ebf3b7c3d16bef6161
Ruby
substantial/hue_conference
/lib/hue_conference/light.rb
UTF-8
2,245
2.8125
3
[ "MIT" ]
permissive
module HueConference class Light attr_reader :name, :id attr_accessor :client, :location STATE_PROPERTIES = %w[on hue bri sat ct alert effect transitiontime] def initialize(id, properties = {}) @id = id @name = properties['name'] end def on! write_state(HueConference::Att...
true
3bc46ad88175a94e397cb4558e9cd95538cd52f0
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/01ebb0daf3434ef79b3f46775cc1fe54.rb
UTF-8
280
3.328125
3
[]
no_license
class Bob def hey (phrase) phrase.gsub!(/[\n\r]/m, '') return "Fine. Be that way!" if phrase.gsub(/[\W]/,'') == '' return "Whoa, chill out!" if phrase.gsub(/[\W\d]/,'').match(/^[A-Z]+$/) return "Sure." if phrase.match( /\?$/ ) return "Whatever." end end
true
4857688c7ce8d61714235bc1ae9008c10b8d6e65
Ruby
FourtyTwoHQ/enigma
/test/tests/config_test.rb
UTF-8
651
2.53125
3
[ "MIT" ]
permissive
require File.join(__dir__, '..', 'test_helper') require 'lyra/config' require 'minitest/autorun' class ConfigTest < MiniTest::Test def test_parses_strings_correctly config = Lyra::Config.new(path: File.join(__dir__, '..', 'Lyrafile')) assert_equal config.access_key_id, 'MY_AWS_KEY' assert_equal config.se...
true
2ea8cf057539f52baafb01aa14f20aede457b7df
Ruby
sul-dlss/course_reserves
/spec/lib/terms_spec.rb
UTF-8
2,201
2.8125
3
[]
no_license
require 'spec_helper' require 'terms' RSpec.describe Terms do subject(:terms) { Terms } describe "current_term_hash" do it "returns the appropriate term in the middle of a term" do term = terms.send(:current_term_hash, Date.new(2017, 7, 10)) expect(term[:term]).to eq("Summer 2017") end it...
true
a096ede654b072c51734b8810cc8889d821d6b9b
Ruby
hermesdt/minimax-tictactoe
/app/models/strategies/minimax.rb
UTF-8
1,553
3.171875
3
[]
no_license
module Strategies class Minimax def initialize end def find_best_move(board, character, depth = 0, action = :max) # I know this should be generalized for other board sizes, # but runs very slow on other sizes than 3x3 return [[1, 1], 1] if GameStatus.empty?(board) return [[], 0] i...
true
0ad6bd2ef531d70e39a065e9c777c9a52e6f1b02
Ruby
davidcelis/ostatus
/lib/ostatus/author.rb
UTF-8
2,469
2.671875
3
[]
no_license
require_relative 'activity' require_relative 'portable_contacts' module OStatus require 'atom' # Holds information about the author of the Feed. class Author < Atom::Person require 'date' include Atom::SimpleExtensions add_extension_namespace :activity, ACTIVITY_NS element 'activity:object-typ...
true
abe818b63c6f63d0e863009a5ccf0c978cbb6924
Ruby
andrewaguiar/youtube-channel-bcrypt
/app-md5.rb
UTF-8
800
3.015625
3
[]
no_license
require 'sqlite3' require 'digest' class App def initialize # Cria o banco de dados. @db = SQLite3::Database.new('db-md5.sqlite3') # Cria a tabela caso não exista. @db.execute 'create table if not exists users (email varchar(30), password varchar(200))' end def sign_up(email, password) # In...
true
3061352ec3e2251489546de228e10d97883b3bcd
Ruby
jcromerohdz/Ruby_Sand_Box
/complete_ruby_programmer/projects/oop/objects_methods.rb
UTF-8
1,174
3.359375
3
[]
no_license
def something end p self.class class Message @@messages_sent = 0 def initialize(from, to) @from = from @to = to @@messages_sent +=1 end end class Email < Message def initialize(from, to) super end end my_message = Message.new("Ian", "Alex") class Machine @@users = {} def initialize(u...
true
bfa91501d2735237dc3949e8e1b3fb789f7a6af5
Ruby
easternwashingaden/ride-share-rails
/test/controllers/trips_controller_test.rb
UTF-8
4,881
2.734375
3
[]
no_license
require "test_helper" describe TripsController do let (:driver) { Driver.create!( name: "Lee H", vin: "FJSKDJ12", available: true ) } let (:passenger) { Passenger.create!( name: "Lak Mok", phone_num: "(555) 555-5555" ) } let (:trip) { Trip.create!( ...
true
1e329c4eb7a27d7ed0734f59da541b0b1a70a4b1
Ruby
kigster/boxbot
/lib/boxbot/geo/edge.rb
UTF-8
1,108
2.625
3
[ "MIT" ]
permissive
require 'dry-struct' require 'dry-types' require 'boxbot' module Boxbot module Geo class Edge < ::Dry::Struct # noinspection RubyResolve constructor_type :schema attribute :face, Types::BoxFaces attribute :joins, Types::BoxFaces attribute :dimension, Types::Axis attribute :di...
true
6f0deb915413853aed3d953f44a3445f64e420b1
Ruby
vanecanhete/rails-bancard
/modulo-2/practica-2/spec/random_numbers_spec.rb
UTF-8
1,373
3.234375
3
[]
no_license
require 'rspec' require 'rspec/its' describe "Leccion 2" do context "VERIFICACIÓN ARRAY DE SALIDA" do result = `ruby random_numbers.rb` lines = result.split("\n") numbers = [] # process the last line of output values = lines[lines.count-1].split(",").each { |v| number = /([0-9]+)/.match(v...
true
17a5712c74fd8b600c53b25ff986363f94e0e947
Ruby
Uthaeus/codewars_ruby
/6kyu/cut_in_pieces.rb
UTF-8
570
3.953125
4
[]
no_license
# We need a function (for commercial purposes) that may perform integer partitions with some constraints. The function should select how many elements each partition should have. The function should discard some "forbidden" values in each partition. So, create part_const(), that receives three arguments. part_const((1)...
true
6d9aeae60bb9fdd72cd201ce97cc24c9afc24d6f
Ruby
chrismdp/sing_pomodoro
/lib/pomodoro.rb
UTF-8
1,472
2.75
3
[]
no_license
class Pomodoro < ActiveRecord::Base MINIMUM_SECS = 25 * 60 MAXIMUM_SECS = 45 * 60 named_scope :successful, { :conditions => "finished_at IS NOT NULL and (finished_at - started_at) >= #{MINIMUM_SECS}" } named_scope :incomplete, { :conditions => "finished_at IS NOT NULL and (finished_at - started_at) < #{MINIMU...
true
ea643e9e821a18ecebc736dbe6c7e0712a77a574
Ruby
moonglum/halunke
/lib/halunke/interpreter.rb
UTF-8
2,017
2.75
3
[ "MIT" ]
permissive
require "pathname" require "halunke/parser" require "halunke/runtime" module Halunke class Interpreter attr_reader :root_context def initialize @parser = Parser.new @root_context = Context.new @root_context["Class"] = Halunke::Runtime::HClass @root_context["Function"] = Halunke::Run...
true
55228512eb86fc398b94e0ee420cfa4c933c29b0
Ruby
melriffe/AdventOfCode2020
/lib/day_12.rb
UTF-8
11,412
3.53125
4
[ "MIT" ]
permissive
# frozen_string_literal: true require 'forwardable' ## # --- Day 12: Rain Risk --- # https://adventofcode.com/2020/day/12 # class Day12 attr_accessor :data ## # 'data' is an Array[<String>], where "String" is a series of characters # representing a navigational command. # # The set represents navigation i...
true
51aa729c305cbe7b6adac012a53491b564dbbf69
Ruby
bohdankutkovy/bugs_parser
/scrapers/bugzilla/component_scraper.rb
UTF-8
1,278
2.515625
3
[]
no_license
class ComponentScraper < Bugzilla def initialize super end def scrape_all p "Parsing components..." data = read_dump 'products' @progressbar = ProgressBar.create( format: "%a %b\u{15E7}%i %p%% %t", progress_mark: " ", remainder_mark: "\u{FF65}", starting_at: ...
true
73b5285ebe3208a489fea3dd37139dbe312063e3
Ruby
bluepeartree/object-oriented-programming
/library.rb
UTF-8
2,463
3.5
4
[]
no_license
class Book @@on_shelf = [] @@on_loan = [] @@overdue = [] @@current_due_date = 0 def initialize (book_title, author, isbn) @book_title = book_title @author = author @isbn = isbn due_date = 0 end def book_title @book_title end def author @author end def isbn @isbn end def due_date @due_date end...
true
da96a94af23f9dbe0d75da73c187e59edf6aacd7
Ruby
catedm/launch-school-130-ruby-foundations-more-topics
/ls_challenges/medium_1/atbash.rb
UTF-8
510
3.71875
4
[]
no_license
require 'pry' class Atbash LETTER_PAIRS = ('a'..'m').to_a.zip(('n'..'z').to_a.reverse) def self.encode(word) encoded_word = word.delete('^a-zA-Z0-9').downcase.gsub!(/./) do |char| char =~ /[0-9]/ ? char : encode_character(char) end encoded_word.chars.each_slice(5).map(&:join).join(' ') end ...
true
c7bc841243be58cfcc5b91a7bae8ce05b95589b7
Ruby
kgrech/opendatasearch
/indexer/data_extractors/analyse.rb
UTF-8
1,045
2.75
3
[ "Apache-2.0" ]
permissive
#coding:utf-8 require "pry" require "json" require_relative "./sentence_parser.rb" require_relative "./cluster.rb" def flatten() data = JSON.load(File.read("clust.json")) data.map! do |x| x.map do |y| y.map do |z| z.map do |w| w.flatten end end end end File.write("clust_flatten.json" , da...
true
2459adaa3fd56b2b81d708fa8515a74edf202d10
Ruby
nikkigraybeal/rb101
/exercises/easy1/reverse_it2.rb
UTF-8
1,156
4.5625
5
[]
no_license
=begin #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. #Given a string# #split t...
true
64af6a13d5769fb101def0c600900239e2ec0da3
Ruby
joshtkim/ruby-oo-practice-has-many-through-template-nyc01-seng-ft-042020
/app/models/Student.rb
UTF-8
1,574
3.578125
4
[]
no_license
#class for Model2 goes here #Feel free to change the name of the class class Student attr_accessor :name, :budget @@all = [] def initialize(name) @name = name @budget = 300 @@all << self end def self.all @@all end def clubs Membership.all.select d...
true
a8965933c67e4d36e3f56427beedbadd39d616b7
Ruby
majway27/subtask-shuffle
/IssueIDNumbering.rb
UTF-8
502
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'csv' # Open Files target = CSV.open('full-numbered.csv', 'wb') source = CSV.read('full.csv', 'rb', headers:true) # n=1 n=1 # Read row source.select do |row| # If Issuetype != Sub-task || Issuetype !=Null if row['Issue Type'].to_s != 'Sub-task' ### set Issue ID to n row['Issue ID'...
true
368678ee6e25d341294b29a56b1f489c99494491
Ruby
AMSANJEEV28/cafeteria_management
/app/models/menu_category.rb
UTF-8
492
2.5625
3
[]
no_license
class MenuCategory < ApplicationRecord has_many :menu_items def self.get_menu_names MenuCategory.all.map { |menu| menu } end def self.get_name MenuCategory.pluck(:name, :id) end def isActive? active end def makeActive MenuCategory.all.map { |menu| menu.active = false menu...
true
bba4b35350eb4788c26ffccb560f2b13859378de
Ruby
indritselimi/stack_kata
/stack.rb
UTF-8
225
3.53125
4
[]
no_license
class Stack def initialize @array = Array.new end def size @array.length end def push(element) @array << element end def pop @array.pop end end
true
c227dffba830a2fadc66f303ff646bbb4a0df636
Ruby
Marc5690/Programming-In-Ruby
/Practical4/file1_main_declared_bankrupt.rb
UTF-8
1,552
3.515625
4
[]
no_license
require 'csv' require_relative 'bank' require_relative 'developer' #This file should be run in the format "ruby file1_main_declared_bankrupt.rb bank_data.csv" in order to run. #The bank_data.csv file is required for this project. CSV.foreach(ARGV[0]) do |bank| Bank.new_bank(bank[0].to_i,bank[1].to_i,bank[2].to_i,ba...
true
2180167790418ef8a738f608679d8000500d376b
Ruby
bharat55/projects
/ruby/loop.rb
UTF-8
680
4
4
[]
no_license
=begin class Accounts def Accounts.show_balance() puts"you have thi much balance" end end def function() puts "this is a function" end Accounts.show_balance function =end # $i =1 # $j=5 # until $i > $j do # puts "inside the while loop" # $i+=1 # end # result = 70 # case result # when 0....
true
9dad98763d89d83bf8d2594b9e725338ff3fc3bb
Ruby
nayosx/UniversityLibraryAPI
/app/models/book.rb
UTF-8
678
2.546875
3
[ "MIT" ]
permissive
class Book < ApplicationRecord has_many :book_authors has_many :authors, through: :book_authors has_many :book_genders has_many :genders, through: :book_genders has_many :loans has_many :users, through: :loans def self.search(pattern, typeSearch) if pattern.blank? # blank? cover...
true
30e7a7490ade4c5e0f15335863d28022d0b3de46
Ruby
BedfordWest/megdumarra
/entities/traits/moveable.rb
UTF-8
413
2.90625
3
[ "Apache-2.0" ]
permissive
require_relative '../../systems/physics/velocity.rb' require_relative 'locatable.rb' module Moveable include Locatable #move location by the object's velocity and time in s (delta) def move(delta) new_x = self.location.x + (self.vel.x * delta) new_y = self.location.y + (self.vel.y * delta) ...
true
8a504185febc7c8cb1f612fd81398afb02607f7a
Ruby
mheinen/testRubySolution
/app/models/presentation.rb
UTF-8
3,196
2.703125
3
[]
no_license
require 'zip/filesystem' require 'nokogiri' class Presentation attr_reader :files, :narration def initialize(path) raise 'Not a valid file format.' unless (['.pptx'].include? File.extname(path).downcase) # Array for temporary files. Files are closed and unlinked in Presentation.close(). @temp_files =...
true
75dc837c457d7d9f78578b762935b9b99410cee6
Ruby
qhwa/savage
/lib/savage/directions/horizontal_to.rb
UTF-8
700
2.640625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Savage module Directions class HorizontalTo < CoordinateTarget def command_code (absolute?) ? 'H' : 'h' end def transform(scale_x, skew_x, skew_y, scale_y, tx, ty) unless skew_y.zero? raise 'rotating or skewing (in Y axis) an "horizontal_to" direction is not su...
true
44fdb68412a96536ada05d142132692b94d82957
Ruby
alagram/rpn-calculator
/lib/rpn_expression.rb
UTF-8
1,417
4.3125
4
[ "MIT" ]
permissive
require "stack" def factorial(n) result = 1 n.downto(1) do |i| result *= i end result end SYMBOL_TABLE = { "+" => lambda { |x, y| x + y }, "*" => lambda { |x, y| x * y }, "-" => lambda { |x, y| x - y }, "!" => lambda { |n| factorial(n) }, "%" => lambda { |x, y| x % y }, "wiggle" => lambda { ...
true
07f0559fda7afbab6e1cd247a3f53500c127dd73
Ruby
21-Coding/Volunteer-Tracker
/lib/volunteers.rb
UTF-8
1,149
3.03125
3
[]
no_license
class Volunteer attr_accessor :name, :id def initialize(attributes) @name = attributes.fetch(:name, nil) @id = attributes.fetch(:id, nil) end def self.all returned_returned_volunteers = DB.exec('SELECT * FROM returned_volunteers;') returned_volunteers = [] returned_returned_volunteers.each...
true
520750ecde59ac605c70ed449fd5ce8d07aa59b5
Ruby
SarpongAbasimi/Ruby-Notes
/regex_notes.rb
UTF-8
1,436
3.5
4
[]
no_license
=begin Regular expressions are used to match patterns. In ruby patterns are matched inside the two //. eg) 'Hello Boy'.match(/B/) #This is saying is there a match for letter'B' in the 'Hello Boy' string object Another means of matching items in ruby is using the =~ sign.This returns the position of the matched cha...
true
83d917e386144131d72bcc76d647a6a49a79d9a2
Ruby
saralynnazuk/lrthw
/ex34/ex34.rb
UTF-8
509
3.9375
4
[]
no_license
#array location practice animals = ['bear', 'ruby', 'peacock', 'kangaroo', 'whale', 'platypus'] #The animal at 1. ruby #The third (3rd) animal. peacock #The first (1st) animal. bear #The animal at 3. kangaroo #The fifth (5th) animal. whale #The animal at 2. peacock #The sixth (6...
true
ad0beb09201b45d23edc66dccc14334113678a2b
Ruby
apexcodings/new-uoc
/spec/models/expert_spec.rb
UTF-8
2,737
2.75
3
[]
no_license
require 'rails_helper' require 'support/attributes' RSpec.describe Expert do it "is valid with default attributes" do expert = Expert.new(expert_attributes) expect(expert.valid?).to eq(true) end it "returns experts that belong to some categories ordered by position" do bailey = Expert.create!(exper...
true
d9d825ab18ab8c334733fa9dabafb692b9452bf2
Ruby
julianasequeira/api-automation-test
/features/step_definitions/obeter_listas.rb
UTF-8
3,231
2.734375
3
[]
no_license
Dado('que eu faça uma requisição do tipo GET para a url {string} para listar as marcas') do |url| @raia_drogadil = RaiaDrogadil.new @response = @raia_drogadil.get_url(url) puts @response.to_s.force_encoding('UTF-8') end E('localizo o código da marca {string}') do |marca| @marca = @response.find { |aux| aux['no...
true
946a1d3da7d253dfa867d7c24acb80209eea262c
Ruby
Mac-a-Damian-and-Jefferson/RottenDogs.com
/app/models/photo.rb
UTF-8
724
2.53125
3
[]
no_license
require 'httparty' require 'flickraw' require 'byebug' class Photo attr_reader :picture_link def initialize(dog_rating) FlickRaw.api_key="#{ENV['FLICKR_KEY']}" FlickRaw.shared_secret="#{ENV['FLICKR_SECRET']}" flickr = FlickRaw::Flickr.new list = flickr.people.getPhotos(:user_id => "#{ENV['FLIC...
true
bba615cf2f8b3a63ca6bfda255efaf7ee64f2a15
Ruby
msgalenwhite/News-Aggregator-Plus
/spec/features/new_article_spec.rb
UTF-8
1,846
2.703125
3
[]
no_license
require "spec_helper" feature "New Article" do # As a slacker # I want to be able to submit an incredibly interesting article # So that other slackers may benefit from my distraction # Acceptance Criteria: # When I visit '/articles/new' it should have a form to submit a new article # the form...
true
54b002bd4820c928323b5e2e8adcc1cd9dd25723
Ruby
erikwesterberg/Itp_ruby
/dogs.rb
UTF-8
381
3.546875
4
[]
no_license
class Dog attr_accessor :breed, :name def initialize(breed, name) @breed = breed @name = name end def wag_tail puts "Yo motherfucker, my tail is Tail wagging" end def under_stim puts "i want to play more" end end leffe = Dog.new("staffe", "leffe") harry = Dog...
true
3b5c1f07b7d91de45a71ee4eecd031c0d0c4b6b5
Ruby
rubykorea/codingdojo
/2012_12_06/aproxacs & i.am@danielchoi.net/mine.rb
UTF-8
1,169
3.3125
3
[]
no_license
class Mines attr_reader :mines def initialize(n,m) @n = n @m = m @mines = Array.new(n) { Array.new(m) {([0]*7+[1]).sample } } end def display_mines puts "-"*80 puts "Mines" puts "-"*80 puts @mines.map {|r| r.map {|d| d==0 ? "." : "*"}.join(" ")}.join("\n") puts "-"*80 puts "Hints" puts "-"*80 ...
true
211f8d5770eed233ede80c1f576cdbcaae967e5d
Ruby
BGRicker/Udacity-toycity2
/lib/app.rb
UTF-8
5,346
3.203125
3
[]
no_license
def setup require 'json' path = File.join(File.dirname(__FILE__), '../data/products.json') file = File.read(path) $products_hash = JSON.parse(file) $report_file = File.new("report.txt", "w+") end def store_to_file (output="") $report_file.puts output end def date "Report Run At: #{Time.now.strftime("...
true
0c6d1297cb8425d9a078bce5230a0ce73869fcc8
Ruby
ronaldtse/asciidoctor-bibliography
/lib/asciidoctor-bibliography/asciidoctor/bibliographer_preprocessor.rb
UTF-8
3,504
2.6875
3
[ "MIT" ]
permissive
require 'asciidoctor' require 'pp' require_relative '../helpers' require_relative '../database' require_relative '../citation' require_relative '../index' module AsciidoctorBibliography module Asciidoctor class BibliographerPreprocessor < ::Asciidoctor::Extensions::Preprocessor def process(document, reade...
true
7b551c79cc74a26c71f0ccf41a4b1acd4dd5b3ca
Ruby
rubynetix/sparse-matrix
/lib/sparse_matrix_factory.rb
UTF-8
805
2.890625
3
[ "MIT" ]
permissive
require_relative 'sparse_matrix' require_relative 'matrix_factory' class SparseMatrixFactory < MatrixFactory def initialize(suppress_warnings: false) @suppress_warnings = suppress_warnings end def new(rows, cols = rows, val = 0) SparseMatrix.create(rows, cols: cols, val: val) end def zero(rows, co...
true
5146071d7b32824b4bbd82f32f6bd266f807954e
Ruby
avdgaag/laze
/lib/laze/plugins/js_requires.rb
UTF-8
1,961
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
module Laze #:nodoc: module Plugins #:nodoc: # This plugin introduces the +require+ statement to your javascript files. # This is a simple mechanism to concatenate all your javascript files # into a single library and thereby reduce the number of HTTP requests # (improving your website load time). ...
true
4e8718272019f5b46ea8541e40b39f6092b98df4
Ruby
ricardojrt6565/weathermanfits
/models/model.rb
UTF-8
1,862
3.71875
4
[]
no_license
require 'net/http' require 'json' require 'pp' require 'weather-api' class App attr_reader :city, :state, :temp, :clothing def initialize(city,state) @city = city @state = state get_weather # to begin this app city and state are needed end def get_weather b...
true
7342148d4474973e6657320ac04b45297f9e8ee7
Ruby
TravisSpangle/GrokkingAlgorithms
/Travis/recusion/bfs_iteration.rb
UTF-8
532
3.234375
3
[]
no_license
require '../lib/wrapper.rb' require '../lib/bfs_graph.rb' class Search def self.bfs(graph) search_queue = ["you"] parents = {} while search_queue node = search_queue.pop return true if self.seller?(node) graph.delete(node){|k| [] }.each do |child| search_queue.push child ...
true
540ff66bdbcf8eceefd3552d89fa914f6f408298
Ruby
mokus80/learners_directory
/test/controllers/resources_controller_test.rb
UTF-8
3,415
2.515625
3
[]
no_license
require 'test_helper' class ResourcesControllerTest < ActionController::TestCase # test "should get index" do # get :index # assert_nil resources # end # test "should get new" do # get :new # assert_response :success # end test "should create a new resource with given parameters" do ...
true
4f8fb7afe5c51963d5c5d0aa23c070e34da43ea0
Ruby
MODLanguage/ruby-interpreter
/lib/modl/parser/object_cache.rb
UTF-8
3,008
2.84375
3
[ "MIT" ]
permissive
# frozen_string_literal: true # The MIT License (MIT) # # Copyright (c) 2019 NUM Technology Ltd # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limit...
true
176315c205d689ce89f8b4efcbe400d11b411fe5
Ruby
VanDeGraf/Chess
/lib/user_interface/screen_menu_input.rb
UTF-8
1,165
3.0625
3
[]
no_license
class ScreenMenuInput < ScreenInput # @param screen [Screen] # @param actions [Array<MenuAction>] - will draw in initialized order def initialize(screen, actions = []) super(screen, 'Enter the number of the action you would like to perform: ') # @type [Array<MenuAction>] @actions = actions end # ...
true
d5d994d80b2fe46e56719432171679dcd08b3a6b
Ruby
ryantm/lvrug_atomic
/atomic3.rb
UTF-8
122
2.734375
3
[]
no_license
File.open('atomic3.txt', 'w') do |f| puts File.read('atomic3.txt') 1111.times do f.write 'Hello world' end end
true
aca95ab6ceb8b696424a930856453f89c56e8cb5
Ruby
just-ed/sociability-test
/main.rb
UTF-8
690
3.34375
3
[]
no_license
require_relative 'lib/question' require_relative 'lib/test' require_relative 'lib/result_printer' questions_path = "#{__dir__}/data/questions.txt" results_path = "#{__dir__}/data/results.txt" test = Test.new(questions_path) result = ResultPrinter.new(results_path) until test.finished? puts test.ask_question ans...
true
41aa4cf53e0683b64433a50b6435395be7cd2337
Ruby
zettsu-t/examQuestions
/2008math4b.rb
UTF-8
1,153
3.53125
4
[ "MIT" ]
permissive
#!/usr/bin/ruby # coding: utf-8 # # 出題元 # 麻布中学校 2008年 入試問題 算数 問4 解法 class ExprSetFast attr_reader :exprMap def initialize(minNum, maxNum) @exprMap = {} exprSet = ((minNum+1)..maxNum).inject([minNum]) do |xs, i| xs.product(["+", "*"], [i]) end.map(&:join) exprSet.each do |expr...
true
2c86f523a2c13352a6e4efdba17c68d2d10f2bf5
Ruby
harrifeng/mysql-cookbook-code
/apache/tables/tables.rb
UTF-8
1,873
2.75
3
[]
no_license
#!/usr/bin/ruby # tables.rb: generate HTML tables require "cgi" require "Cookbook" title = "Query Output Display - Tables" cgi = CGI.new("html4") page ="" dbh = Cookbook.connect page << cgi.p { "HTML table:" } # _PRINT_CD_TABLE_ table_rows = cgi.tr { cgi.th { "Year" } + cgi.th { "Art...
true
5d3ce6fbea4b54d6d888a7d036baa104561e30c6
Ruby
atduskgreg/ofxaddons.com
/lib/github_data.rb
UTF-8
5,115
2.734375
3
[]
no_license
class GithubData attr_reader :full_name, :repo_json, :commits_json, :contents_json, :has_makefile, :has_src_folder, :example_count, :has_thumbnail, :has_correct_folder_structure # full_name: the github full_name ':owner/:repo' (eg. 'fubar/ofxTrickyTrick') # repo_json: the json response from GET /repos/:...
true
b7902a6e5a0167fe033cc695df67ec1cd551ee5e
Ruby
riddhi-geek/Clockify
/app/models/shift.rb
UTF-8
1,199
2.75
3
[]
no_license
class Shift < ApplicationRecord # Associations has_many :clock_events, dependent: :destroy belongs_to :user # Validations validates :shift_date, presence:true, inclusion: { in: (Date.today..Date.today), message: 'Can not create future or past shift' } validates :title, presence:true, length: { maximum: 255 } va...
true
1f3d56d627cdde431dce20969dd1b671abe57c16
Ruby
AdalegGIT/WebDev2021-classCode
/Topic12::Sinatra/server.rb
UTF-8
726
3.046875
3
[]
no_license
require 'sinatra' #defining local variables name = "Elvis Peter" email = "elvispeter91@gmail.com" todo = [ 'Water the plants', 'Feed the cat', 'Call the girlfriend', 'Cook the dinner', 'Blah blah blah' ]; get '/' do "<h1>hello world</h1>" end get '/helloPeople' do erb :hello_peop...
true
12538d4606d97f400546c206302b508fe69c699b
Ruby
austenhasty/activerecord-validations-lab-seattle-web-career-042219
/app/models/post.rb
UTF-8
501
2.75
3
[]
no_license
class Post < ActiveRecord::Base validates :title, presence: true validates :content, length: {minimum: 250} validates :summary, length: {maximum: 250} validates :category, inclusion: {in: %w(Fiction Non-Fiction)} validate :is_clickbait def is_clickbait @@phrases = [/Won't Believe/, /Secret/, /Top \d/, ...
true
c4a54e0e6928036ae85621c25636b42e02280df2
Ruby
maxiaoan/ruby_notes
/shop2/app/models/product.rb
UTF-8
929
2.5625
3
[]
no_license
class Product < ApplicationRecord scope :available, -> { where(in_stock: true) } scope :cheap, -> { where(:price => 0..1) } scope :cheaper_than, ->(price) { where("price < ?", price) } validates :name, :presence => true, #:length => {is: 8} #:length =>{...
true
1d647cfa7058b8f7bda7cb8edddc8dba25858d91
Ruby
jasminnancy/ruby-boating-school-atlanta-web-82619
/tools/console.rb
UTF-8
690
2.890625
3
[]
no_license
require_relative '../config/environment.rb' def reload load 'config/environment.rb' end spongebob = Student.new("Spongebob") patrick = Student.new("Patrick") puff = Instructor.new("Ms.Puff") krabs = Instructor.new("Mr.Krabs") test1 = BoatingTest.new(spongebob, "Boating 101", puff) test2 = BoatingTest.new(spongeb...
true
b10d4727ac222ed4f43cd4a4f983929cae07a6ca
Ruby
cocolote/Ruby_Practice
/Chris_Pine_exe_&_others/MethodWithHash.rb
UTF-8
4,246
4.09375
4
[]
no_license
# open the file "new-fd" and create a file descriptor: puts '++++ Opening a file ++++' puts fd = IO.sysopen("new-fd", "w") # create a new I/O stream using the file descriptor for "new-fd": p IO.new(fd) #Example of what it means Parse puts '++++ Example of what Parse means ++++' puts module RubyMonk module Parser ...
true
c4046be6750c96eb3d4757a4bd256aabf76e2629
Ruby
c13andrewsmith/backend_mod_1_prework
/section2/exercises/Else_and_If.rb
UTF-8
1,277
4.34375
4
[]
no_license
people = 30 cars = 40 trucks = 15 #checks if cars greater than people if cars > people #prints if cars greater than people is TRUE puts "We should take the cars." #checks if cars less than people elsif cars < people #prints if cars less than people is TRUE puts "We should not take the cars." #executes when all...
true
dc6b47a806748d5e242c4f6546f23fb81fae7e8e
Ruby
phijojo/buildtasks
/spec/mixins/dsl_spec.rb
UTF-8
1,775
2.796875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "buildtasks/mixins/dsl" describe BuildTasks::Mixins::DSL do describe "#set_or_return" do it "returns current value" do c = Class.new do include BuildTasks::Mixins::DSL def initialize @some_attribute = :some_value end end.new expect(c.set_or_return(:some...
true
4ca8fc6b64d80909dc9ee777cbe3da1ef7d9956c
Ruby
theodoros-git2/ruby_exam
/janken.rb
UTF-8
1,575
4
4
[]
no_license
# class du joueur class Player def hand jank = ["Goo", "Choki", "Par"] decision = true while decision do puts "Veuillez saisir un nombre." puts "0: Goo\n1: Choki\n2: Par\n" input_hand = gets.chomp.to_s if (input_hand == "0" || input_hand == "1" || input_hand == "2") decision...
true
511e127e94895c9560462e233c45872681948d69
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/8a3b1b035d084b7a8302b6533f09b7d4.rb
UTF-8
349
3.421875
3
[]
no_license
module Hamming extend self def compute(a, b) count_differences_in valid_pairs a.chars.zip(b.chars) end def count_differences_in(pairs) pairs.count {|(left,right)| left != right } end def valid_pairs(pairs) pairs.reject {|pair| any_nil? pair } end def any_nil?(pair) pair.any? {|elemen...
true
6ad494dab1f13099a9fbbc0024db9f3497f506b0
Ruby
JavaRabbit/UselessJunk
/app/controllers/application_controller.rb
UTF-8
2,624
2.515625
3
[]
no_license
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. helper :all protect_from_forgery with: :exception def logged_user User.find_by id: session[:user_id] end def delete_user(user) user.produc...
true
fec302ca8e03991b78a1153aa5805c3fcc4d266b
Ruby
jackjennings/hey
/lib/hey/account.rb
UTF-8
833
2.609375
3
[ "MIT" ]
permissive
require 'hey/dispatcher' module Hey # Sends requests to the Yo API accounts endpoint. class Account < Dispatcher # Sends a request to create an account using the +accounts+ endpoint. # Raises a +MissingAPITokenError+ error if an API token # hasn't been set on the Hey module or Yo instance. # Accep...
true