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
d40e47694ffa0024fe9a1128c6cf7e55af1dd6fa
Ruby
sparkleformation/sparkle_formation
/lib/sparkle_formation/composition.rb
UTF-8
5,261
2.9375
3
[ "Apache-2.0" ]
permissive
require "sparkle_formation" class SparkleFormation # Internal template composition class Composition # Component item of composition Component = Utils.silence_warnings do Struct.new("Component", :origin, :key, :block) do def key self[:key].to_s end end end # ...
true
5022ef1d1bf823a41a117ba87884534d42ea4046
Ruby
ifyouseewendy/notes
/ruby/meta_programming/dog.rb
UTF-8
630
3.25
3
[]
no_license
MSG = { :dance => 'is dancing', :poo => 'is a smelly doggy!', :laugh => 'finds this hilarious!' } class Dog def initialize(name) @name = name end def can(*args, &block) args.each do |arg| eigen_class = class << self; self; end instance_name = @name Object.class_eval do define_m...
true
230d999452606f45acd17a07318edf7393371d01
Ruby
eebbesen/minutes_maid
/vendor/cache/ruby/2.5.0/gems/mail-2.7.1/lib/mail/encodings/transfer_encoding.rb
UTF-8
2,321
2.78125
3
[ "MIT" ]
permissive
# encoding: utf-8 # frozen_string_literal: true module Mail module Encodings class TransferEncoding NAME = '' PRIORITY = -1 # And encoding's superclass can always transport it since the # class hierarchy is arranged e.g. Base64 < 7bit < 8bit < Binary. def self.can_transport?(enc) ...
true
5a59ad54e370ad620eb8418981a0a0c82274c715
Ruby
badcab/redit
/run.rb
UTF-8
4,463
2.671875
3
[ "BSD-2-Clause" ]
permissive
#!/usr/local/bin/ruby BEGIN { require 'curses' require "#{File.dirname(__FILE__)}/File_operation.rb" require "#{File.dirname(__FILE__)}/Buffer_mod.rb" require "#{File.dirname(__FILE__)}/Highlight.rb" include Curses Curses.init_screen() Curses.TABSIZE = 4 Curses.ESCDELAY = 0 TOP_MENU_LINES = 3 BOTTOM_MENU_LI...
true
c209e3958e8f195fdb6f5505d2fe7c8b1ac1e675
Ruby
brettgrigsby/tries
/trie.rb
UTF-8
653
3.78125
4
[]
no_license
class Trie attr_reader :root def initialize @root = Node.new end def insert(data) root.push(data.downcase.chars) end end class Node attr_reader :data attr_accessor :links def initialize(data=nil) @data = data @links = [] end def has_link?(data) links.each { |link| return tr...
true
f89318c4115d7da0bdf92d6c640cfcc55a4a3bcf
Ruby
teleological/edtf-ruby
/spec/edtf/uncertainty_spec.rb
UTF-8
7,587
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause-Views", "BSD-2-Clause" ]
permissive
module EDTF describe Uncertainty do let(:uncertainty) { Uncertainty.new } describe '#uncertain?' do it { should be_certain } it 'should be uncertain if at least one part is uncertain' do Uncertainty.new(false, false, true).should be_uncertain end it 'should no...
true
bf03a92c16a4623856bdcd0119d6cd53fdba4b62
Ruby
jonathanpeterwu/GPS_scheduler_twilio
/source/test_module.rb
UTF-8
4,633
3.0625
3
[]
no_license
require 'sqlite3' # As a user, I want to be able to check time slots for a specific teacher. # As a user, I want to be able to check teachers for a specific time slot. # As a user, I want to be able to see all available teachers and their open time slots. # As a user, I want to be able to book a time slot with a speci...
true
a063296f23262d832130170b8295a5140ea8818f
Ruby
berkshelf/berkshelf
/lib/berkshelf/file_syncer.rb
UTF-8
4,353
2.765625
3
[ "Apache-2.0" ]
permissive
require "fileutils" unless defined?(FileUtils) module Berkshelf module FileSyncer extend self # Files to be ignored during a directory globbing IGNORED_FILES = %w{. ..}.freeze # # Glob across the given pattern, accounting for dotfiles, removing Ruby's # dumb idea to include +'.'+ and +'..'+...
true
92bbf482b291038312475cad13c74aba432327f0
Ruby
h4hany/leetcode
/python_solutions/1007.minimum-domino-rotations-for-equal-row.rb
UTF-8
1,942
3.734375
4
[]
no_license
# # @lc app=leetcode id=1007 lang=ruby # # [1007] Minimum Domino Rotations For Equal Row # # https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/description/ # # algorithms # Medium (47.56%) # Total Accepted: 4.8K # Total Submissions: 10.2K # Testcase Example: '[2,1,2,4,2,2]\n[5,2,6,2,3,2]' # # In ...
true
db4a7c1f9c1953352244906e72529d66626db52a
Ruby
akiyama-lab/ruby-em_algorithm
/example/tools/histogram.rb
UTF-8
468
2.53125
3
[ "MIT", "Ruby" ]
permissive
#!/usr/bin/env ruby require 'yaml' require 'gsl' file_path = ARGV[0] bin = ARGV[1].to_i range_from = ARGV[2].to_f range_to = ARGV[3].to_f data_array = YAML.load_file(file_path) v = GSL::Vector[data_array] if range_from != 0 && range_to != 0 h = v.histogram(bin,[range_from, range_to]) h.fprintf($stdout, range_form...
true
96db28709d7b342f72734e9bb9c9297bf13bf8f1
Ruby
Derek68038/2015-01-26-checksplitter
/dinnerclub.rb
UTF-8
2,838
3.921875
4
[]
no_license
require 'pry' # Class: DinnerClub # # Create a dinner club group and keep track of their tabs & where they go. # # Attributes: # @group - String: The group of people who are in the dinner club. # @location - Hash: Receives place as the key and who went there as the values. class DinnerClub attr_accessor :...
true
d16c10deb912e266243b4f2dfebcfd0767c54980
Ruby
grubern/fdlint
/test/js/stat/switch.rb
UTF-8
968
2.578125
3
[ "BSD-3-Clause" ]
permissive
module FdlintTest module JS module Stat module Switch def test_parse_stat_switch js = ' switch (a) { case 1: i++; break; case 2: i--; break; default: break; ...
true
4bb56edc0ab2d9c0b0a44dbef35564c9c5f0db85
Ruby
ivopashov/algorithms-data-structures
/linked_lists/stack_as_linked_list.rb
UTF-8
733
3.765625
4
[]
no_license
class Node attr_reader :data attr_accessor :next def initialize(data) @data = data @next = nil end end class Stack def initialize @head = nil end def push(data) node = Node.new data if @head.nil? @head = node else node.next = @head @head = node end end ...
true
5f2773195cf7cf8f5d89468be35672d4995b8deb
Ruby
mtruman92/cli_project
/unitedstates_cli/lib/unitedstates/scraper.rb
UTF-8
873
3.265625
3
[ "MIT" ]
permissive
class Unitedstates::Scraper def initalize(url = https://www.history.com/topics/us-states) @url = url end #scrapes a history website featuring US 50 states and returns an array of States def us_states @doc = Nokogiri::HTML(open(@url)) state_links = id = 0 state_links.collect do |states| id += 1 s = Un...
true
54a9eead491df3418b20f3b5532a5af6aa169f86
Ruby
okazaki-6012/project-euler
/euler001.rb
UTF-8
102
2.765625
3
[]
no_license
# coding: utf-8 # Problem 1 「3と5の倍数」 def euler001 (999 / 3 + 999 / 5) - 999 / 3 * 5 end
true
9d70644d7f3bd0ac32e8b33b8222ea4cf8313137
Ruby
ChalkyBrush/ruby_fundamentals
/hashkeys.rb
UTF-8
514
3.65625
4
[]
no_license
def assert_equal(arr1,arr2) if arr1==arr2 return true else return false end end class Hash def keys_of(*args) key_array=[] self.select{|k,v| if args.include? v key_array=key_array.push k end } # p key_array.reverse key_array.reverse end end puts assert_equal(["a"], {"a" => 1, "b" => 2, "...
true
e6c33f87833f80de568f2fdfa82973d2459e210f
Ruby
stellarlive/artisanal-model
/spec/artisanal/integration/writers_spec.rb
UTF-8
1,357
2.578125
3
[ "MIT" ]
permissive
RSpec.describe "Model attribute writers" do let(:ns) { Module.new.tap do |mod| module mod::Examples class Address include Artisanal::Model end class Person include Artisanal::Model attribute :name, Dry::Types::Any attribute :email, Dry::Types...
true
0e5dc57a3d607a45b3126c784cb705ccaad8ec24
Ruby
v9n/cracking_the_coding_interview
/test/chapter_one/test_seven.rb
UTF-8
802
2.78125
3
[ "MIT" ]
permissive
require 'config_test' module ChapterOne class TestSeven < Minitest::Test include Seven def test_rows_with_zero_collapse_to_zero m = [[1, 0, 0], [0, 2, 0], [0, 0, 3]] actual = collapse_on_zero(m) expected = Array.new(3) { Array.new(3, 0) } assert_equal(expected,...
true
bfd0e44ab7ca58863d705f66fd12b04258b2308f
Ruby
ktshannon/channeladvisor
/lib/channeladvisor/inventory.rb
UTF-8
1,435
2.65625
3
[ "MIT" ]
permissive
module ChannelAdvisor class Inventory < Base # Update the quantity and/or price data for inventory items # # @raise [ServiceFailure] If the service returns a Failure status # @raise [SOAPFault] If the service responds with a SOAP fault # @raise [HTTPError] If the service responds with an HTTP err...
true
303c8167e8178e0bd975afe9b95637febcc000a6
Ruby
ocruse7/badges-and-schedules-onl01-seng-pt-110319
/conference_badges.rb
UTF-8
767
3.53125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def conference_badges( badge ) return badge end def badge_maker( name ) "Hello, my name is #{name}." end def batch_badge_creator( attendees ) index = 0 badges = [] while index < attendees.size do badges << badge_maker( attendees[index] ) index += 1 end return badges end ...
true
b917013fa39e4bbd24e0db907a26240020ded74a
Ruby
digaev/to_duration
/lib/to_duration/duration.rb
UTF-8
1,514
3.28125
3
[ "MIT" ]
permissive
module ToDuration class Duration UNITS = { years: 315_576_00, months: 259_200_0, weeks: 604_800, days: 864_00, hours: 3600, minutes: 60, seconds: 1 }.freeze attr_reader :seconds def initialize(seconds) @seconds = Integer(seconds) end def years...
true
89f163bc6a11dab92dd7261c3472535bbbed0fd8
Ruby
rudegus/learning_ruby
/my_projects/project3.rb
UTF-8
355
3.5
4
[]
no_license
#user input puts movie and release date puts "What is your oldest favorite movie?" old_title = gets.chomp puts "When was it released?" old_date = gets.chomp puts "What is your newest favorite movie?" new_title = gets.chomp puts "When was it released?" new_date = gets.chomp puts "" puts "#{old_date} -- #{old_title}"...
true
539332cb8668192e5a5f9dfffa5f71e251210387
Ruby
petertseng/rebellion_g54
/spec/action/speculator_spec.rb
UTF-8
1,384
2.5625
3
[ "Apache-2.0" ]
permissive
require 'spec_helper' require 'rebellion_g54/action/speculator' RSpec.describe RebellionG54::Action::Speculator do # I'll ensure that I have at least one non-speculator card I can work with. let(:game) { example_game(2, rigged_roles: [:director], roles: [:speculator, :director]) } let(:user) { game.choice_names...
true
08ab15db4fe26ac56d0269b1f46d3c88aa0c9333
Ruby
kilcmn3/orms-pokemon-scraper-nyc-web-012720
/lib/pokemon.rb
UTF-8
709
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Pokemon attr_accessor :name, :type, :id, :db def initialize(arg) @id = arg[:id] @name = arg[:name] @type = arg[:type] @db = arg[:db] end def self.save(name, type, db) sql = <<-SQL INSERT INTO pokemon (name, type) VALUES (?,?) SQL ...
true
41448d8d35070220cfdaf948d32758fa975b6a2f
Ruby
ajLapid718/DataStructuresAndAlgorithms
/Personal-Notes/Stack/Relevant-Problems/Valid_Braces.rb
UTF-8
4,784
4.40625
4
[]
no_license
# Write a function called validBraces that takes a string of braces, and determines if the order of the braces is valid. validBraces should return true if the string is valid, and false if it's invalid. # # This Kata is similar to the Valid Parentheses Kata, but introduces four new characters. Open and closed brackets,...
true
fae3e36641354154d50129b02699859f5717088b
Ruby
m0h4x/eloquent-ruby
/chapter_03/beware_the_bang.rb
UTF-8
60
2.640625
3
[]
no_license
require 'pp' a = [1,2,3] pp a.reverse pp a a.reverse! pp a
true
6fb00e7eab90e8d32f33fb4b1e2c227442eed035
Ruby
RicardoRojo/workbook-exercises
/advanced/quiz1/exercise5.rb
UTF-8
252
2.78125
3
[]
no_license
require 'securerandom' def newuuid str = SecureRandom.hex(8).to_s[0..7] + "-" + SecureRandom.hex(4).to_s[0..3] + "-" + SecureRandom.hex(4).to_s[0..3] + "-" + SecureRandom.hex(4).to_s[0..3] + "-" + SecureRandom.hex(12).to_s[0..11] end puts newuuid
true
87ef08d9a9287de5285324a7e681d96fb82a239d
Ruby
matrharr/data_structures-algorithms
/quicksort.rb
UTF-8
1,008
3.09375
3
[]
no_license
# unstable sort def quickSort(input) if input.length <= 1 return input end pivot_index = work.length/2.floor pivot = work[pivot_index] before = [] after = [] i = 0 while i < work.length if i != pivot_index if work[i] <= pivot before << work[i] else after << work[i]...
true
007a6d539c4a742d7d37af2d91e105d7cbf0cab6
Ruby
Pistos/weewar-ai
/lib/weewar-ai/map.rb
UTF-8
3,816
3.171875
3
[]
no_license
module WeewarAI # Instances of the Map class provide access to the Hex es of a Map, # either individually, or by means of iterators or filters. class Map attr_reader :width, :height, :cols, :units include Enumerable SYMBOL_FOR_TERRAIN = { 'Plains' => :plains, 'Water' => :water...
true
055374d7d6905c4a6a8b447175b8a1c416350071
Ruby
axelletrt/Exercices_thursday_friday
/pyramide.rb
UTF-8
464
3.453125
3
[]
no_license
print "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?\n> " nb = gets.chomp nb = Integer(nb) if nb < 1 || nb > 25 puts "Merci de choisir un nombre entre 1 et 25." exit end i = 0 while i < nb do space = "" nb_space = nb - (i+1) nb_space.times do space += " " end ...
true
0ce0e9bafe1a7b95c86edf79e90351dce4fa378d
Ruby
sunlightlabs/tcorps-earmarks
/lib/levenshtein.rb
UTF-8
1,292
3.4375
3
[]
no_license
require 'inline' class Levenshtein inline do |builder| builder.c " #include <stdlib.h> #include <malloc.h> #include <string.h> static int distance(char *s,char*t) /*Compute levenshtein distance between s and t*/ { //Step 1 int min, k,i,j,n,m,co...
true
7e2380ab4d9c4f93aa1ff38d3e8b6115b3f4b9db
Ruby
taw/sectalks-september-2017
/ruby/obfuscator
UTF-8
534
2.828125
3
[]
no_license
#!/usr/bin/env ruby decoder = %q[class HAX; def self.method_missing(m, *args); m = m.to_s; TOPLEVEL_BINDING.eval $c.join if m == '-@'; m.scan(/(\w)(\w)/).each { |t| ($c ||= []) << (((t[0][0].ord - 97) * 26) + (t[1][0].ord - 97)).chr }; end; end] puts "#!/usr/bin/env ruby" puts decoder bl = [""] $stdin.each { |line| ...
true
2e8cb33e546f3a3e65879c6243f01ed7967e3e0a
Ruby
kirillzabrodin/gilded-rose-project
/spec/ticket_spec.rb
UTF-8
1,028
2.859375
3
[]
no_license
require 'ticket' require 'item_basic' describe Ticket do let(:subject) {Ticket.new("A ticket",10,20)} it_behaves_like ItemBasic it 'increases quality by 1 when more than 10 days till event' do subject.sell_in = 11 expect{subject.update_quality}.to change{subject.quality}.by(1) end it 'increases q...
true
d73e7b2e259b97afda551cea7d621e8bd92aba8e
Ruby
simpledotorg/simple-server
/lib/seed/config.rb
UTF-8
3,177
2.546875
3
[ "MIT" ]
permissive
module Seed class Config # By default the fast seed config will be used for dev. You can override this via the ENV var SEED_TYPE def initialize @type = ENV["SEED_TYPE"] || case SimpleServer.env when "test" "test" when "android_review" "empty" when "dev...
true
1dc9d86ca289c20d86f8195c6682ee8cd728c97a
Ruby
yoolk/yoolk_liquid
/app/drops/yoolk/liquid/listing/summary_business_hour_drop.rb
UTF-8
1,507
2.84375
3
[ "MIT" ]
permissive
module Yoolk module Liquid class Listing::SummaryBusinessHourDrop < BaseDrop def initialize(days, open, closed) @attributes = { 'days' => days, 'open' => open, 'closed' => closed } end def day_name to_day_names(:'date.day_names') e...
true
48369b052b8531cbbeaa90fbe4213a8f03a292e6
Ruby
dnmcgoy/Magic-Deck-Web
/spec/models/deck_spec.rb
UTF-8
2,270
2.640625
3
[]
no_license
require 'spec_helper' describe Deck do describe "cmc_values" do it "should count cmc for maindeck non lands" do deck = Factory.create(:deck, :name => "Google Chart Test") deck.maindeck.runs = [] deck.maindeck << make_run(:land, 20) deck.maindeck << make_run(:creature, 4, 1) deck.m...
true
108ddb0827917f5c8cb33a8a04353b510958201c
Ruby
brianmock/ruby-code-challenges
/swapNum.rb
UTF-8
206
3.28125
3
[ "MIT" ]
permissive
def swapNum(arr) y = "" arr.each {|x| y = x.insert(0, x[-1]).insert(-1, x[1]) y.slice!(-2) y.slice!(1) print y + " "} print "\n" end File.open(ARGV[0]).each do |line| swapNum(line.split(" ")) end
true
ef46ead7071bcf3582139c3cbf43eb8eb6cf222e
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/robot-name/fec0b7f4d8054dc8b33ae4376bd3fa35.rb
UTF-8
547
3.34375
3
[]
no_license
class Robot def name @robot_name ||= generate_new_name end def reset @robot_name = nil end private def check_if_used_name @used_names ||= [] name if @used_names.any? {|used_name| used_name == @robot_name} @used_names << @robot_name @robot_name end def generate_new_name @...
true
f1925abd87827bbaa0d2a4bacd381e0f60ce99d0
Ruby
VictorW77-ios/Simple-Calculator
/main.rb
UTF-8
263
4.0625
4
[]
no_license
puts "Hey! Welcome to Victor's Lazy Calculator. Enter a number: " num1 = gets.chomp().to_f puts "Enter another number, please: " num2 = gets.chomp().to_f puts (num1 + num2) #to_i would return an integer value, to_f would allow the user to enter a decimal value
true
77723371ab406561968f3321503d9c62884ebfc4
Ruby
AliOsm/credit_debit_card_number_validator
/lib/validator.rb
UTF-8
12,603
3.625
4
[ "MIT" ]
permissive
# CreditDebitCardNumberValidator module # main module contain gem classes # use this module to deal with gem classes, # create objects and work with class methods # to validate your data module CreditDebitCardNumberValidator # Validator class # validate and gathering information about card number # 11 methods ...
true
31f87331a5e351cf7d86c94e757a8127a158f365
Ruby
isiah18/codingchallenges
/recursive_fib.rb
UTF-8
690
3.8125
4
[]
no_license
def iterative_fib(n) ary = [1,1] if n == 0 || n == 1 || n == 2 return 1 else while ary.length <= n @new = ary[ary.length-1] + (ary[ary.length - 2]) ary << @new end end return ary.last end def recursive_fib(n) if n == 0 || n==1 return 1 else recursive_fib(n-1) + recursive_fib...
true
3d338533c2f7414105cf6655e392add6dbeb2401
Ruby
yoshi-self/leetcode
/solutions/0020_Valid_Parentheses.rb
UTF-8
619
3.5625
4
[]
no_license
# @param {String} s # @return {Boolean} def is_valid(s) open = ['(', '{', '['] close = [')', '}', ']'] stack = [] s.each_char do |c| if open.include?(c) stack.push c else l = stack.pop if !parentheses_match?(l, c) return false ...
true
31c18cf08bbf6f0fb9eba634e025e4a247cfff58
Ruby
hugo-lavorel/rails-longest-word-game
/app/controllers/games_controller.rb
UTF-8
1,681
3.171875
3
[]
no_license
require 'open-uri' require 'json' class GamesController < ApplicationController def new @letters = [] @start_time = Time.now 10.times do |i| i = ('A'..'Z').to_a.sample @letters << i end @letters end def parse(word) url = "https://wagon-dictionary.herokuapp.com/#{word}" at...
true
cd9592b8217f5cebf6c536dcc1423081afd3fadd
Ruby
cruzjorge/tutorialruby
/recorridos.rb
UTF-8
863
4.125
4
[]
no_license
class HolaMundo def initialize end def saluda ejemplo = [1, 2, 3, 4, 5, 6] for i in ejemplo print "#{i} " end print "\n" ejemplo.each do |i| print "#{i} " end print "\n" otro = ejemplo.map { |i| i+1 } for i...
true
c4817a1d198203595fac6d934fdddde1790ca0c5
Ruby
calvinsettachatgul/codewars
/ruby/format_string_names.rb
UTF-8
1,140
4.21875
4
[]
no_license
# Given: an array containing hashes of names # Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand. # Example: # list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ]) # # returns 'Bart, Lisa & Maggie' # list([ {name: 'Bart'}...
true
92bfa8a956e39c9807070853c7e68b34bbcd8f41
Ruby
jcbozonier/ConferenceArtifacts
/search_tweet.rb
UTF-8
2,147
3.0625
3
[]
no_license
require "time" class SearchTweet def self.users_referenced_in tweet referenced_users = [tweet['from_user']] tweet_text = tweet['text'] each_screen_name_in tweet_text do |screen_name| referenced_users << screen_name if !referenced_users.include? screen_name end referenced_users end de...
true
4702c634064b0c39e6a0d6005c248c404886f5f4
Ruby
NYPL/MyLibraryNYCApp
/lib/tasks/cleanup.rake
UTF-8
4,380
2.5625
3
[]
no_license
# frozen_string_literal: true namespace :cleanup do # Use it like this with one or more arguments: `rake cleanup:bib_records['book teacher_set']` or `rake cleanup:bib_records['book']` desc "cleanup books or teacher sets" task :bib_records, [:model_names] => :environment do |t, args| args.model_names.split.e...
true
ab22d5648119a0a4664ec40598f4a92c1b439a68
Ruby
chriseppstein/pack-mule
/examples/sleepy_runner.rb
UTF-8
584
2.96875
3
[]
no_license
require 'pack_mule' # This runner enqueue some jobs to sleep for a short time and returns the total time spent asleep. class SleepyRunner < PackMule::Runner def initialize(*args) super @record_return_values = true end def run_async(nap_count = 100) enqueue :run end def run(nap_count = 100) ...
true
a19aaeaa70cbeb8947d4515c8b9d81521b8cc8d4
Ruby
ghostlambdax/recognizeapp
/db/migrate/20191215112212_copy_data_from_approvers_to_approver_in_badges.rb
UTF-8
692
2.625
3
[]
no_license
class CopyDataFromApproversToApproverInBadges < ActiveRecord::Migration[5.0] class Badge < ApplicationRecord serialize :approvers, Array end def up Badge.where.not(approvers: nil).each do |badge| begin # Note: Although `approvers` is a serialized array, the code base only allowed 1 element...
true
c08c6639c200fae5923eeba511de11f061185980
Ruby
DrDhoom/RMVXA-Script-Repository
/Fomar0153/fomar0153_-_equipment_levels_up_1.0.rb
UTF-8
4,898
3.03125
3
[ "MIT" ]
permissive
=begin Equipment Levels Up by Fomar0153 Version 1.0 ---------------------- Notes ---------------------- This script allows weapons to grow stronger and level up when they gain exp or ap. ---------------------- Instructions ---------------------- Requires my individual equipment script. (Make sure it is version 1.1+) Re...
true
4c82df0cf6f2aaba7c2fad7d28632f76716e4fb4
Ruby
lkotek/susemanager-ci
/jenkins_pipelines/cucumber_per_prs/common_scripts/check_pkgs_published.rb
UTF-8
815
2.59375
3
[ "MIT" ]
permissive
#! /bin/usr/ruby obs_branch = ARGV[0] def ck_pkgs_build_failed(obs_branch) ckfailed = "osc -v -A https://api.suse.de pr #{obs_branch} -s F" failed = `#{ckfailed}` puts 'RPM Packages that were FAILED are:' puts failed puts end def ck_pkgs_build_status(obs_branch) ckst = "osc -v -A https://api.suse.de pr #...
true
cc05933eaf54d1ff3b6667eb4f4909457c76cb88
Ruby
thecog19/assignment_self_associations
/db/seeds.rb
UTF-8
520
2.90625
3
[]
no_license
def generate_tennants(n) n.times { Tennant.create(name: Faker::Name.name) } end def generate_tennants_neighbors(n) count = 0 while count < n rn_1 = Faker::Number.between(Tennant.first.id, Tennant.last.id) rn_2 = Faker::Number.between(Tennant.first.id, Tennant.last.id) unless rn_1 == rn_2 Tenna...
true
c44a8a0090e53b7bae7daa294ba6fa4beda4ee8a
Ruby
yaqizhao/projet_THP
/Ruby/exo_14.rb
UTF-8
101
3.484375
3
[]
no_license
puts "Donnez-moi un nombre." number = Integer(gets.chomp) for i in 0..number puts number - i end
true
31bf222ea1805ba23a941fd35830aba244323721
Ruby
justonemorecommit/puppet
/lib/puppet/util/windows/principal.rb
UTF-8
8,846
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
require_relative '../../../puppet/util/windows' module Puppet::Util::Windows::SID class Principal extend FFI::Library attr_reader :account, :sid_bytes, :sid, :domain, :domain_account, :account_type def initialize(account, sid_bytes, sid, domain, account_type) # This is only ever called from lookup...
true
0bb666dd89885c88a50e410fb3b654203c195429
Ruby
dqmrf/dive-in-ruby
/sandbox/enumerable/built_in/strings/each_char.rb
UTF-8
72
2.703125
3
[]
no_license
str = 'abcde' str.each_char { |c| p c } =begin "a" "b" "c" "d" "e" =end
true
f345edacc31ecc53f5aa501f897af6dbed0115f0
Ruby
GuilhermeMedeiross/Code-Wars
/1004 - Binary Addition.rb
UTF-8
228
3.609375
4
[]
no_license
def add_binary(a, b) (a + b).to_s(2) end def add_binary_Best_Pratice(a, b) add_binary(a, b) # because i did the best pratice ;) end a = gets.to_i b = gets.to_i puts add_binary(a, b) puts add_binary_Best_Pratice(a, b)
true
80834ad9d4fdae2ba5b9f363d346fd4b8c3ca3a6
Ruby
juanriglos/TTPS_ruby
/evader/app/models/client.rb
UTF-8
3,281
2.625
3
[]
no_license
class Client < ActiveRecord::Base has_many :contacts,dependent: :destroy validates :contacts, presence: true validates_associated :contacts has_many :bills,dependent: :destroy validates_associated :bills #validates :dni ,uniqueness: true, on: :create validates :name, presence: true,format:{with: /...
true
17236b0feebe56ada929d817cd328ff5e28f8857
Ruby
gumantov/greatbuy
/db/seeds.rb
UTF-8
852
2.59375
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
11ec925c9ade58cdd48a9d1e95853dedcfe3a112
Ruby
entropie/oy
/bin/oyblog.rb
UTF-8
3,983
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # # # Author: Michael 'entropie' Trommer <mictro@gmail.com> # require "rubygems" require "optparse" require "pp" $:.unshift File.join(File.dirname(__FILE__), "../lib") $:.unshift File.join(File.dirname(__FILE__), "../app") require "oy" help = "#{$0}: Simple Blog controller for the Oy! wiki.\n\n"...
true
94cf719c6ef9c8191467940413e941491ba52504
Ruby
Marcodredd/Programming-back-end
/lesson_2/calculator.rb
UTF-8
2,087
4.5625
5
[]
no_license
# Build a command line calculator program that does the following: # asks for two numbers # asks for the type of operatiion to perform: add, subtract, multiply or divide # displays the result require 'yaml' MESSAGES = YAML.load_file('calculator_messages.yml') def prompt(message) puts "=> #{message}" end def valid_n...
true
a7a40612a426f6d54a632d206b60080411773f44
Ruby
Salomanuel/Odin_Project-Ruby-Recursion
/roman_back.rb
UTF-8
916
3.671875
4
[]
no_license
@roman_mapping = { "M" => 1000, "CM" => 900, "D" => 500, "CD" => 400, "C" => 100, "XC" => 90, "L" => 50, "XL" => 40, "X" => 10, "IX" => 9, "V" => 5, "IV" => 4, "I" => 1 } @number ||= 0 def from_roman(literal) puts @number if literal.length < 1 return @number if literal.length < 1 @iteratio...
true
4fddfef25763f6bdc01e7de338abbdbfab098e62
Ruby
TimRobinson1/learn-to-program
/chap-06-flow/leapyears.rb
UTF-8
330
3.828125
4
[]
no_license
puts "Start year, please." start = gets.chomp year = start.to_i puts "Thanks. End year, please." final = gets.chomp puts "The leap years in the range between #{start} and #{final} are:" while year <= final.to_i if (year % 4 == 0) && (year % 100 != 0) puts year elsif (year % 400 == 0) puts year end year...
true
8f124a65accffe202aec17a5327915cd98fff108
Ruby
ali1195shah/course
/gets_methods.rb
UTF-8
275
4.4375
4
[]
no_license
#.to_s converst to a string #.to_i convers to a interger puts "Hi, Whats your name?" name = gets.chomp puts "Great!, Whats your age?" age = gets.chomp.to_i #This turns the string into a interger. puts "Cool, So your name is #{name} and you are #{age} years old"
true
d4c48093776327ad36208177f195b485b8c0fcee
Ruby
Kevin8428/new_dragons
/05_ruby101/kevin_deutscher/ruby_intro/loop_cheatsheet.rb
UTF-8
466
3.84375
4
[]
no_license
#3 loops in rb: while until and for num = 1 #while loop------------------- # while num<11 # p num # num +=1 # end #until loop------------------- # # until num >10 # p num # num +=1 # end #for loop--------------------- # for num in 0..5 # if num >2 # puts"greater than two" # end # p num # en...
true
f9b03b9057eeb56e750cc94f3cf9b68676157c55
Ruby
crievinator/ls_rb101_programming_foundations
/lesson_2/mortgage_calculator.rb
UTF-8
1,961
4.125
4
[]
no_license
require 'pry' # this program is a simple mortgage calculator which calculates # the monthly payment based on APR, loan amout and duration # first we will start with asking for the loan amount def prompt(prompt) Kernel.puts("-> #{prompt}") end def correct_number?(num) Integer(num) rescue false end def correct_d...
true
91ca82ab12021b740d3f25b04c21e9748690d19c
Ruby
matthewwareing/FizzBuzz-Ruby-TDD
/lib/fizzbuzz.rb
UTF-8
378
3.703125
4
[]
no_license
def fizzbuzz n answer = '' answer << 'fizz' if n % 3 == 0 answer << 'buzz' if n % 5 == 0 answer == '' ? n : answer end class Integer def fizzbuzz answer = '' answer << 'fizz' if self % 3 == 0 answer << 'buzz' if self % 5 == 0 answer == '' ? self : answer end end # irb test # 101.times {|x|...
true
2bdf375304f769b9a5fdff6d29e3b2491109ec6a
Ruby
ckaiser79/tiny-forecast
/spec/sigma/YamlDataLoader_spec.rb
UTF-8
2,748
2.609375
3
[ "MIT" ]
permissive
require 'sigma' describe Sigma::YamlDataLoader do CHART_ID = 'sigma' before :each do config = File.dirname(__FILE__) + '/sample-config.yaml' data = File.dirname(__FILE__) + '/sample-data.yaml' @loader = Sigma::YamlDataLoader.new config, data end it "reads a yaml file by absolute path" do ...
true
d3bb3bf4ece369ea25b0598c780f904c63cf486c
Ruby
cianmce/file
/lock_server/lock_server.rb
UTF-8
3,671
2.734375
3
[]
no_license
require 'socket' require 'thread' require 'open-uri' require 'pathname' require 'json' class Server def initialize(student_id) @file_lock = Mutex.new # mutex to edit the file locks @student_id = student_id @local_ip = local_ip @remote_ip = open('http://whatismyip.akamai.com').read puts "remote_...
true
a0330f50df3eec20db7d255e05dc2b6738e29711
Ruby
prashanth-sams/ruby-workshop
/data_structure/quick_sort.rb
UTF-8
249
3.359375
3
[]
no_license
def partition(op, list) list.select { |n| n.send(op, list.first)} end def quicksort(list) return [] if list.empty? quicksort(partition(:<, list)) + [list.first] + quicksort(partition(:>, list)) end arr = [32, 4, 2, 6, 1] p quicksort(arr)
true
b52f11c7f623fe8ce71c6572e08806285a04f531
Ruby
YizheWill/LeetCode
/ruby/atoi.rb
UTF-8
144
3.265625
3
[]
no_license
def find_it(n) return 1 if n == 0 counter = 1 k = n while k > 0 counter <<= 1 k >>= 1 end counter - 1 - n end p find_it(5)
true
6ecc013eaf9f7f455a7f162a8322ea548ac3a392
Ruby
Shanson90/englishNumbers
/English Nums.rb
UTF-8
2,238
4.03125
4
[]
no_license
#Design number: 414,565 system 'cls' puts 'This program will take a number from 0 to 1,000,000 and display it written out in words.' puts 'Enter the number you want to convert.' #Define engNum method def engNum number #Input validation if number > 1000000 return 'Sorry, only numbers up to 1,000,000' en...
true
663a05a50e630cda8159bd5ca636ef9424e794e7
Ruby
SantiagoGuerra/tic-tac-toe
/spec/test_utils.rb
UTF-8
3,074
3.375
3
[ "Unlicense" ]
permissive
# spec/test_player.rb # frozen_string_literal: true require_relative '../lib/utils.rb' RSpec.describe Utils do include Utils let(:default_board) { [1, 2, 3, 4, 5, 6, 7, 8, 9] } let(:string_board) { "1 | 2 | 3\n- + - + -\n4 | 5 | 6\n- + - + -\n7 | 8 | 9 \n " } describe '#validate_chip' do it 'validates a ...
true
7145c209941663fb3a47ddebc4f82642587a1777
Ruby
Schwefelsaeure/Programming
/Projects/Ruby/latex_ide/app/models/project.rb
UTF-8
1,221
2.65625
3
[]
no_license
require "fileutils" class Project < ActiveRecord::Base after_create :create_project_directory after_destroy :delete_project_directory attr_accessible :description, :name validates :name, presence: true belongs_to :user has_many :project_files belongs_to :project_summary def zip if File.directory...
true
c8071aa75f7a47b5113cb5ec8962a397bbad2ded
Ruby
padoauk/Fount
/test/lib/byte_array_editor_test.rb
UTF-8
13,437
2.875
3
[ "BSD-2-Clause-Views" ]
permissive
# encoding: utf-8 require 'test/unit' require 'test/test_helper' require 'lib/well/byte_array_editor' class MyTest < Test::Unit::TestCase # Called before every test method runs. Can be used # to set up fixture information. def setup @byte_array_editor = ByteArrayEditor.new end # Called after every te...
true
76639c86352b94b035fb97550c1069671eb318b5
Ruby
MississippiBrenn/fibonacci
/lib/fibonacci.rb
UTF-8
462
3.96875
4
[]
no_license
# Computes the nth fibonacci number in the series starting with 0. # fibonacci series: 0 1 1 2 3 5 8 13 21 ... # e.g. 0th fibonacci number is 0 # e.g. 1st fibonacci number is 1 # .... # e.g. 6th fibonacci number is 8 def fibonacci(n) raise ArgumentError if n == nil raise ArgumentError if n < 0 return 0 if n == 0 ...
true
74f6b5003d503210cfe95cb76304f852f7218140
Ruby
CorainChicago/exactly_this_much_food
/order_finder.rb
UTF-8
1,499
3.359375
3
[ "MIT" ]
permissive
# initialize it with the arguments needed and then not need them for arguments for the methods. Move it into a class module OrderFinder def get_order_total(items, menu_hash) sum = 0.00 items.each do |item| sum += menu_hash[item].delete("$").to_f end return '%.02f' % sum end def find_order...
true
dcf92fc6e881f03c2e3992d0d58f3b2e1aaed2e4
Ruby
nocnoi/codewars
/isograms.rb
UTF-8
213
3.625
4
[]
no_license
# is_isogram(string) # returns true if isogram (if there are repeating letters in the string) string = "lamb" uniq_char_ary = string.downcase.chars.uniq (string.length == uniq_char_ary.length) ? false : true
true
2d134776598a8a9d42950bd8a1f54982bc2b88c6
Ruby
fanjieqi/LeetCodeRuby
/801-900/853. Car Fleet.rb
UTF-8
337
3.140625
3
[ "MIT" ]
permissive
# @param {Integer} target # @param {Integer[]} position # @param {Integer[]} speed # @return {Integer} def car_fleet(target, position, speed) array = position.zip(speed).sort_by(&:first).reverse stack = [] array.each do |pos, v| t = (target - pos)/v.to_f stack << t if stack.empty? || t > stack.last end ...
true
ff6442e8dfd6b8fbf84030ff8b68abcbe050abf9
Ruby
Brian-Triplett/tts_wilmington
/homework/Casey/1_1.rb
UTF-8
356
3.640625
4
[]
no_license
puts "What is your name?" name = gets.chomp students = ["Casey", "Hannah", "Steven"] teacher = ["Brian", "Mary Kay"] if name == teacher [0] || name == teacher [1] puts "Welcome! Let me take you to where you'll be teaching." else puts "Welcome! Please sign in and take a seat." end #use each function for loop i...
true
e3d851eb838580fe863f32ca49b7a0bb3e0e59d3
Ruby
daleterrell/reverse-each-word-v-000
/reverse_each_word.rb
UTF-8
251
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' # def reverse_each_word(string) # puts reverse_each_word.each do |string| # end # end def reverse_each_word(string) sentence_array = string.split(" ") sentence_array.collect do |w| w.reverse end.join(" ") end
true
eccb5ea0184c56f7d6e119cb9960b0bfa4363b7f
Ruby
danilobarion1986/rspec_app
/app/models/zombie.rb
UTF-8
468
2.609375
3
[ "MIT" ]
permissive
class Zombie < ApplicationRecord after_initialize :set_defaults, unless: :persisted? # The set_defaults will only work if the object is new def set_defaults self.brains ||= 0 self.iq ||= 0 # self.bool_field = true if self.bool_field.nil? end validates :name, :brains, :iq, presence: true valida...
true
74713ecb7673cab991246501ffc25715aafd3319
Ruby
lightsage88/depot2
/app/models/user.rb
UTF-8
622
2.609375
3
[]
no_license
class User < ApplicationRecord validates :name, presence: true, uniqueness: true after_destroy :ensure_an_admin_exists has_secure_password #this line above creates a form taht prompts you #to ender a password and makes you reenter it in a #separate field so they can validate that you #typed what you thoug...
true
f5c3e99cff0322ab5e7373728e40c50eebab24f9
Ruby
kronos/Task-solutions
/codeforces/0xx/6C.rb
UTF-8
594
3.140625
3
[]
no_license
n = gets.to_i a = gets.split(/\s/).map {|x| x.to_i} a1 = 0 a2 = 0 t1 = 0 t2 = 0 size = a.size if size == 1 puts "1 0" else i = 0 j = size-1 while i < j if t1 > t2 while t1 > t2 and i < j a2 += 1 t2 += a[j] j -= 1 end elsif t2 > t1 while t2 > t1 and i < j ...
true
ede7a5106211a1fcc934167cbcbdba991972ae32
Ruby
sarjumulmi/pokemon-scraper-v-000
/lib/pokemon.rb
UTF-8
787
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Pokemon attr_accessor :name, :type, :db, :id, :hp @@all = [] def initialize(id:, name:, type:, db:, hp:60) @id = id @name = name @type = type @db = db @hp = hp end def self.save(name, type, db) db.execute("INSERT INTO pokemon (name, type) VALUES (?, ?)",name, type...
true
4b7228fccf87a0f7c2a1845393d40e9e9d34f2aa
Ruby
ValLaboratory/ekisuke-kenshu-2017
/shiibashi/route_search_practice_1.rb
UTF-8
637
3.203125
3
[]
no_license
require_relative "./../configure" courses = Ekisuke::Course.search("22671:22513") # 高円寺->池袋 #経路表示 if courses.nil? || courses.empty? puts "経路が見つかりませんでした" else # 1経路目 course = courses[0] # 駅 stations = course.stations # 路線 lines = course.lines lines.each_with_index do |line,line_index| # 駅名 p...
true
491ea5a26a65bf7204f3dc3f0450d5745c7237df
Ruby
rainux/fast_gettext
/benchmark/misc/threadsave.rb
UTF-8
669
2.71875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
require 'benchmark' BASELINE = 0 def test result = Benchmark.measure {1_000_000.times{ yield }} result.to_s.strip.split(' ').first.to_f - BASELINE end BASELINE = (test{}) Thread.current[:library_name]={} other = "x" puts "Ruby #{VERSION}" puts "generic:" puts " Symbol: #{test{Thread.current[:library_name][:just_...
true
cef5b913b4db384a36089b7288d8dbff652a33d6
Ruby
nicholaskim94/coderbyte
/SimpleSymbols/SimpleSymbols.rb
UTF-8
473
3.34375
3
[]
no_license
def SimpleSymbols(str) # code goes here flag = true arr = str.split("") arr.each do |alpha| if ('A'...'z').to_a.include? alpha ind = arr.index(alpha) if (ind == 0)|| (ind == str.length - 1)|| (arr[ind - 1] != "+")|| (arr[ind + 1] != "+") flag = false ...
true
4d8925cf7b3dec5611cf0c70b981db375fae2d89
Ruby
strychemi/phone_mnemonics
/phone_mnemonics.rb
UTF-8
398
3.3125
3
[]
no_license
TELEBET = ["0", "1", "ABC", "DEF", "GHI", "JKL", "MNO", "PQRS", "TUV", "WXYZ"] @mnemonic_list = [] def phone_mnemonics(number, digit=0, mnemonic="") if digit == number.length @mnemonic_list << mnemonic else TELEBET[number[digit].to_i].split("").each do |letter| phone_mnemonics(number, digit + 1, mne...
true
2a85efeb42c99d45e54bd4d01ef17b0a783808ba
Ruby
fnc314/project_euler
/EulerProblem16.rb
UTF-8
239
3.109375
3
[]
no_license
def ep16 num = 2 ** 1000 num_digits_string = num.to_s.split("") num_digits_integers = num_digits_string.map! { |ele| ele.to_i } sum_of_digits = num_digits_integers.inject(0,:+) return sum_of_digits end puts ep16 # CORRECT
true
1956e3f25f6885c952e953f1c8c9ab74e90449ee
Ruby
stevenringo/deadlock_detector
/spec/graph_converter_spec.rb
UTF-8
887
2.6875
3
[ "MIT" ]
permissive
$:.unshift File.expand_path('../lib', __FILE__) require 'deadlock_detector/graph_converter' module DeadlockDetector describe "Supplied input format is converted to the form [[from_node, to_node],...] for analysis" do it "converts supplied example" do example = [ [1, 1, 'H'], [1, 2, 'W'], ...
true
008529693fdcc10ba490fe3c8ab1e655a7bbe87e
Ruby
dakodareid/learn_ruby
/08_timer/timer.rb
UTF-8
306
3.328125
3
[]
no_license
class Timer def initialize(seconds=0) @seconds = seconds.to_i end def seconds=(time) @seconds = time.to_i end def seconds @seconds end def time_string @secs = @seconds % 60 @mins = (@seconds / 60) % 60 @hrs = @seconds / 3600 format("%02d:%02d:%02d", @hrs, @mins, @secs) end end
true
75b7be8b5966009f297ee22bd564c0842d85ace8
Ruby
jsjutzi/ruby-challenges
/Always3.rb
UTF-8
159
3.140625
3
[]
no_license
puts "Give me a number" number = gets.to_i def always_3(number) puts 'Always ' + (((number + 5) * 2 - 4) /2 - number).to_s end always_3 (number)
true
8814f5f442f8bd189791b7a2ae25cd5997dcb2cd
Ruby
fakebenjay/ny-state-senate-2017
/assembly_scrape.rb
UTF-8
1,177
3.125
3
[]
no_license
require 'open-uri' require 'nokogiri' require 'csv' require 'pry' ## Rough scraper, had to update some elements manually html = Nokogiri::HTML(open("https://en.wikipedia.org/wiki/New_York_Assembly")) obj = {} html.css("table")[3].children.each do |member| memtext = member.text.split("\n") next if memtext == [] ...
true
04a3c195ab90927a070ff55c6b5de129e4dd141c
Ruby
jeremycram/person
/app/models/human_person.rb
UTF-8
253
2.59375
3
[]
no_license
class HumanPerson < ApplicationRecord validates_presence_of :name, :age, :hair_color, :eye_color, :gender, :alive def info "person = #{name}, #{age}, #{hair_color}, #{eye_color}, #{gender} #{alive}" end def self.by_name order(:name) end end
true
5aa36029170b68afacadd910f0c98b80051960a2
Ruby
faviovelez/ordenar
/splitu.rb
UTF-8
656
2.96875
3
[]
no_license
require 'pry' cad = '' 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse c...
true
86449a5a4d6deac13fe6837302d27faca4e48c66
Ruby
Sonnet95/Sonnet95
/app/controllers/application_controller.rb
UTF-8
1,088
2.578125
3
[]
no_license
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def hello render text: "How sweet and lovely dost thou make the shame " + "Which, like a canker in the fragra...
true
db61a414aaf3c58864c7e8fed0f3d53686b0a512
Ruby
bytheway875/nycda_dec2016
/week5_day2/warmup.rb
UTF-8
1,229
3.984375
4
[]
no_license
# # # complete the student/grade exercise we did in Javascript, but this time do it in Ruby! # # # amanda = { name: "Amanda", grade: 84 } # katie = { name: "Katie", grade: 78 } # kevin = { name: "Kevin", grade: 46 } # luke = { name: "Luke", grade: 96 } # students = [amanda, katie, kevin, luke] # # puts "What's your gra...
true
c739c0c3b35b8ed6d647b47708346b260f1c3367
Ruby
marcoscannabrava/cookbook-sinatra
/lib/cookbook.rb
UTF-8
1,142
3.359375
3
[]
no_license
require 'csv' require_relative 'recipe' class Cookbook def initialize(csv_file_path) @csv_file = csv_file_path @recipes = [] read_csv end def all @recipes end def add_recipe(new_recipe) @recipes.push(new_recipe) update_csv end def remove_recipe(recipe_index) @recipes.delete...
true
ccb1a252aaffe13bc5ee87a71bcd07b2bfe52fa5
Ruby
Nevertorlate/ece3710
/game-prototype/duck.rb
UTF-8
2,778
3.046875
3
[]
no_license
#!/usr/bin/env ruby require 'rubygems' require 'rubygame' include Rubygame class Duck include Sprites::Sprite attr_accessor :alive def initialize on_surface, color super() @color = color @alive = true @image = Surface.load "picDuck.png" @rect = @image.make_rect @velocity = [0,0 ] #gravi...
true
9d93424259d6b2bcfc887c706ba48411ec8b7824
Ruby
mbukantz/sellercrowd
/spec/bowling_spec.rb
UTF-8
2,883
3.09375
3
[]
no_license
require 'spec_helper' require './bowling.rb' describe 'Bowling' do it "should identify first frame" do game = Bowling.new([[2,7],[10,0],[4,3]]) expect(game.frame).to eq([2,7]) end it "should identify next_frame frame" do game = Bowling.new([[2,7],[10,0],[4,3]]) expect(game.next_frame).to eq([1...
true