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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0fc4e4627adb3a3e9a85f9c5677696b1d86ad77f | Ruby | McCourtRC/code-foo | /part4/frontEnd/ign-rails/app/controllers/ign_controller.rb | UTF-8 | 2,325 | 2.765625 | 3 | [] | no_license | class IgnController < ApplicationController
layout "ign"
def articles
request = IGNRequest.new
@articles = request.articles($startIndex.to_s, $RES_PER_PAGE)
end
def videos
request = IGNRequest.new
@videos = request.videos($startIndex.to_i, $RES_PER_PAGE)
end
end
#HTTP class
class IGNReque... | true |
808bd8fd3de05e711e9dea868ee043d5080221e6 | Ruby | pkulak/mealfire | /model/user_proxy.rb | UTF-8 | 1,352 | 2.609375 | 3 | [] | no_license | class UserProxy
attr_accessor :session, :ip
def initialize(session, ip)
self.session = session
self.ip = ip
end
def ==(rhs)
(rhs.is_a?(UserProxy) || rhs.is_a?(User)) && self.id == rhs.id
end
def !=(rhs)
!(self == rhs)
end
def virgin?
session[:user_id] == nil
end
de... | true |
ef194bd8488ba5c451b4ab88757c53532fbae273 | Ruby | zipofar/grokaem | /4-1.rb | UTF-8 | 163 | 3.578125 | 4 | [] | no_license | def sum(numbers)
return 0 if numbers.empty?
head, *tail = numbers
head + sum(tail)
end
puts sum([1]) == 1
puts sum([1, 2]) == 3
puts sum([1,2,3,4]) == 10
| true |
24c575dde96349f05f3263bb9e5baa98aa9f477a | Ruby | BraniacMcGee/backend_mod_1_prework | /section4/exercises/ex20.rb | UTF-8 | 707 | 3.921875 | 4 | [] | no_license | class MyCar
def initialize(year, color, model)
@year = year
@color = color
@model = model
@current_speed = 0
end
def speed_up(number)
@current_speed += number
puts "You accelerate #{number} mph."
end
def slow_down(number)
@current_speed -= number
puts "You slow down #{number}... | true |
649e038390e2cc4f7c2f9d889bb5038ce532b11a | Ruby | bluguja/deli-counter-onl01-seng-pt-032320 | /deli_counter.rb | UTF-8 | 1,003 | 4.09375 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | # Write your code here.
katz_deli = ["Logan", "Avi", "Spencer","Grace"]
def line(array)
if array.length >= 1
new_arr = []
counter = 1 # init counter
array.each do |name|
new_arr.push("#{counter}. #{name}")
counter =counter + 1
end
puts "The line is currently: #{new_arr... | true |
db25873f86520c38e739f973158d1dcb44f798aa | Ruby | itggot-sebastian-urbath/standard-biblioteket | /dev/min_of_four.rb | UTF-8 | 287 | 3.046875 | 3 | [] | no_license | def min_of_four(num1, num2, num3, num4)
a = num1
b = num2
c = num3
d = num4
smallest = c
if b < c
smallest = b
end
if smallest > d
smallest = d
end
if smallest > a
smallest = a
end
p smallest
return smallest
end | true |
19128b65e8b296184f0c208fd16a2d20c03dd2d8 | Ruby | vesenny/tceh-ruby | /lesson_2/homework2.rb | UTF-8 | 446 | 3.5625 | 4 | [] | no_license | # Дана строка слов, разделённых пробелами. Вывести длиннейшее слово
string = "Дана строка слов, разделённых пробелами. Вывести длиннейшее слово"
array_of_words = string.split(" ")
array_of_sizes = []
array_of_words.each do |word|
puts "word #{word} with size #{word.size}"
array_of_sizes << word.size
end
puts arra... | true |
e3589e043172e1b6c32fe904b70fcc502ddcab3a | Ruby | irevived1/sinatra-mvc-lab-wdf-000 | /models/piglatinizer.rb | UTF-8 | 352 | 3.59375 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class PigLatinizer
def piglatinize(string)
if string.length == 1 || string[0].downcase.match(/[aeiou]/)
return string + "way"
else
index = string.index(/[aeiou]/)
tmp = string[index..-1] + string[0...index] + "ay"
return tmp
end
end
def to_pig_latin(string)
string.split(" ").collect { |x| pigla... | true |
6a951b431f5480295e4c9046b6be2b76df43fae1 | Ruby | Anikram/wardrobe | /spec/clothing_item_spec.rb | UTF-8 | 1,101 | 3.296875 | 3 | [] | no_license | require 'rspec'
require_relative '../lib/clothing_item'
describe 'Clothing Item Object' do
before :each do
@item = ClothingItem.new(['Шапка', 'Головной убор', '(-15, 0)'])
end
describe 'initialization' do
describe '#new' do
it 'should return an Object of ClothingItem Class' do
expect(@item... | true |
261ba9adc851c3167e0d9061468fba0f4631ee82 | Ruby | shoutm/reijiro | /app/models/clip.rb | UTF-8 | 2,652 | 2.75 | 3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | class Clip < ActiveRecord::Base
belongs_to :word
validates :word_id, presence: true, uniqueness: true
validates :status, presence: true, inclusion: { in: (0..8).to_a }
after_initialize :set_default_values
INTERVAL = { # TODO: マスタ化する
0 => 0.second,
1 => 1.day,
2 => 2.days,
3 => 4.days,
4... | true |
5ac39d293f15a20f9e8b3831cf2ba9a02661ddbb | Ruby | collectiveidea/audited | /lib/audited/auditor.rb | UTF-8 | 18,108 | 2.5625 | 3 | [
"MIT"
] | permissive | # frozen_string_literal: true
module Audited
# Specify this act if you want changes to your model to be saved in an
# audit table. This assumes there is an audits table ready.
#
# class User < ActiveRecord::Base
# audited
# end
#
# To store an audit comment set model.audit_comment to your comm... | true |
b00dde096f68c0e2a08a73edae96f5a2f8b530ea | Ruby | gammons/bobbit | /spec/lib/request_spec.rb | UTF-8 | 527 | 2.5625 | 3 | [] | no_license | require 'ostruct'
require_relative '../../lib/request'
describe Request do
context "creation" do
it "should handle a hash" do
Request.new({a:5}).a.should==5
end
it "should handle an OpenStruct" do
Request.new(OpenStruct.new(a:5)).a.should==5
end
it "should handle objects ducking #a... | true |
3f1d9cf581710079dd407bd5190dc7977adbb0d5 | Ruby | venkat/SupportHero | /app/models/order_entry.rb | UTF-8 | 627 | 2.953125 | 3 | [] | no_license | # Class to store and manage the starting order. The ordered list of usernames
# used as a template for generating the schedule.
class OrderEntry < ActiveRecord::Base
belongs_to :user
def self.starting_order
return order(order: :asc)
end
# Refreshes the Starting order by replacing existing orde... | true |
58293273749ac80a6127b251a0a507bd0ab5928c | Ruby | henryaj/rubybookings | /lib/row.rb | UTF-8 | 388 | 3.4375 | 3 | [] | no_license | class Row
attr_accessor :id
attr_accessor :seats
NUMBER_SEATS_PER_ROW = 50
def initialize
@id = nil
@seats = []
seatnumber = 0
NUMBER_SEATS_PER_ROW.times do
seat = Seat.new
seat.id = seatnumber
@seats << seat
seatnumber += 1
end
end
def booked?
seats.all? ... | true |
8f931bbba6a65825ff0c656fdefbdd1c364b4d8e | Ruby | motoyama1020/ruby | /bingo_ball.rb | UTF-8 | 90 | 3.203125 | 3 | [] | no_license | def bingo_ball
ball_number = (1..75).to_a
puts ball_number.sample(75)
end
bingo_ball
| true |
bc061b78dd1923476ef3e74b334221605112013b | Ruby | mmcnickle-float/aoc2020 | /day3/journey.rb | UTF-8 | 396 | 3.234375 | 3 | [] | no_license | # frozen_string_literal: true
require 'matrix'
class Journey
def initialize(map)
@map = map
end
def count_trees(slope)
position = Vector[0, 0]
num_trees = 0
loop do
position += slope
if map.tree?(position[0], position[1])
num_trees += 1
end
rescue ArgumentError
... | true |
a2587cce04a0efdcc3aa6989a6742b4168b485b7 | Ruby | arathunku/uni-ai-labs | /lab1/stats.rb | UTF-8 | 534 | 3.21875 | 3 | [
"MIT"
] | permissive | class Stats
attr_reader :fitness_count, :execution_time
def initialize
@fitness_count = 0;
@generation_count = 0;
@execution_time = 0;
end
def self.start
stats = new()
stats.start
stats
end
def fitness
@fitness_count += 1
end
def start
@start = Time.now
end
def g... | true |
1ba0c316628e2d8dcbbc187aaa5caa1263d5ae5a | Ruby | thp-grenobles8/s03.2.mini_jeu_POO.flo | /app_3.rb | UTF-8 | 693 | 2.96875 | 3 | [] | no_license | # frozen_string_literal: true
require 'bundler'
Bundler.require
require_relative 'lib/game'
require_relative 'lib/player'
# welcome message
puts "------------------------------------------------
|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |
|Le but du jeu est d'être le dernier survivant !|
----------------------... | true |
ed5f04313a5a5f6db7da072caf64fd533c3a1532 | Ruby | whitperson/ruby | /quizzes/quiz4.rb | UTF-8 | 363 | 3.59375 | 4 | [] | no_license | require 'pry'
numbers = []
class Numbers
def to_s
puts "#{numbers}"
end
end
puts "enter a (n)umber or (q)uit?"
response = gets.chomp
while response != 'q'
puts "Enter a number: "
response = gets.chomp.to_i
numbers << response
puts "enter a (n)umber or (q)uit?"
response = gets.chomp
end
puts "#... | true |
0d00aad8c4fed4ccfb20b8aba7adca19f00ce611 | Ruby | WebtehHR/pivot_table | /lib/pivot_table/cell_collection.rb | UTF-8 | 400 | 2.65625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | module PivotTable
module CellCollection
ACCESSORS = [:header, :data, :value_name]
ACCESSORS.each do |a|
self.send(:attr_accessor, a)
end
def initialize(options = {})
ACCESSORS.each do |a|
self.send("#{a}=", options[a]) if options.has_key?(a)
end
end
def total
... | true |
cec085e68603abc7dfff7a383123067a5884777d | Ruby | vidjon/rbnd-toycity-part4 | /lib/analyzable.rb | UTF-8 | 2,312 | 3.234375 | 3 | [] | no_license |
module Analyzable
def print_report(products)
hash = {"Average Price" => 0, "Brand" => {}, "Name" => {}}
products.each_with_index do |product, index|
hash["Average Price"] = (index == products.length - 1) ? ((hash["Average Price"] + product.price) / products.length) : (hash["Average Price"] + p... | true |
4fb82d9b9f89f90e969398d31fd8c784f615a776 | Ruby | sahidur-prosku/gs1 | /lib/gs1/extensions/date_month_based.rb | UTF-8 | 2,113 | 3.265625 | 3 | [
"MIT"
] | permissive | require 'date'
module GS1
module Extensions
# Extension for a GS1 date. Ensures correct formating and validation.
#
# OBS! Month-based expiry
#
# Expiry dates for a batch of medicinal product are generally set by month, rather than day. If a batch
# expires in March 2021, for example, it expi... | true |
2e055d7452b65c29391146ec25e91fd9e432361a | Ruby | zachbosteel/maze_experiments | /binary_tree_demo.rb | UTF-8 | 148 | 2.5625 | 3 | [] | no_license | require_relative 'grid'
require_relative 'binary_tree'
grid = Grid.new(19, 19)
BinaryTree.on(grid)
puts grid
img = grid.to_png
img.save "maze.png" | true |
df8016f4b9f9450545ab4ec549a6b0e770aaada1 | Ruby | kelsin/byfirebepurged | /config/initializers/exceptions.rb | UTF-8 | 730 | 3.015625 | 3 | [
"MIT"
] | permissive | # = Exceptions
#
# This file contains all of the custom exceptions for this app
module Exceptions
# == Main Error
#
# This is the standard error for all ByFireBePurged errors
#
# If you raise it like the following example:
#
# raise Exceptions::ByFireBePurgedError, 'Must provide a redirect value'
... | true |
54ddcab90250a687f5035f8f96b01cc3cc824b2d | Ruby | Maghamrohith/ruby-programs | /rest_client.rb | UTF-8 | 3,216 | 3.125 | 3 | [] | no_license | require 'httparty'
require 'json'
$url = "http://localhost:3000/api/v0/"
def index
response = HTTParty.get($url + "clients")
clients = JSON.parse(response.body)
puts "*" * 50
puts "Listing clients"
puts "*" * 50
clients.each_with_index do |client, index|
puts "#{index + 1}. #{client["client"]["name"... | true |
01c284f45a76e95d7306a368c1eebae4bd7c92bb | Ruby | davidwilliam/fhe-crt-ga | /app/residue.rb | UTF-8 | 2,238 | 2.96875 | 3 | [] | no_license | module X
class Residue
############################## CLASS MEMBERS ##############################
attr_accessor :primes, :residues
############################## CONSTRUCTOR ##############################
# c = numerator
# d = denominator
def initialize(primes,c=0,d=1)
@primes = prime... | true |
69fb36cc003c46f820927ea87620862093fa1836 | Ruby | 8ENs/101-ContactListApp | /contact_database.rb | UTF-8 | 644 | 3.046875 | 3 | [] | no_license | ## TODO: Implement CSV reading/writing
require 'csv'
class ContactDatabase # Accessor
def initialize(file_name)
@file_name = file_name
end
def read_contacts
CSV.read(@file_name)
end
def write_contact(name, email, phone)
id = CSV.read(@file_name).length + 1
CSV.open(@file_name, "a") do |con... | true |
8f8d8d2e5db553523b6ef214f8255c33bb0cd81f | Ruby | mainangethe/learn-to-code-w-ruby-bp | /section_12/symbols_as_hash_keys.rb | UTF-8 | 686 | 4.21875 | 4 | [] | no_license | # symbols
# light weight strings
# format is ":" colon then the word
:name # symbol
p "name"
p "name".class
p :name.class
p "name" == :name # should be false
p :name.methods.length # only 79 methods
p "name".methods.length # 170 methods on the string
# person = { :name => "Ng'ethe",
# :age => 27,
# ... | true |
68213b7158ed3310ce9ea108c7c4df14bb5a6290 | Ruby | y-usuzumi/survive-the-course | /coursera/programming-languages/part-c/Week_1/subclass_override_private.rb | UTF-8 | 217 | 3.15625 | 3 | [
"BSD-3-Clause"
] | permissive | class Base
private
def foo
"Hello"
end
public
def to_s
foo
end
end
class Foo < Base
# NOTE: Why does it not prevent me from overriding the private base method?
def foo
"FOO!!!"
end
end
| true |
bab5472b51d1a26d9617a2479a4d5b187d42eaaf | Ruby | carloswherbet/guru_ce_bot_telegram | /lib/bot.rb | UTF-8 | 2,629 | 2.78125 | 3 | [] | no_license | require 'telegram/bot'
require_relative 'db_migrate.rb'
require_relative 'message.rb'
require_relative 'company.rb'
require_relative 'proxy_command.rb'
require_relative 'security_alert.rb'
require 'dotenv/load'
require 'pry'
class Bot
def initialize
token = ENV['TOKEN']
$admin_users = ENV['ADMIN_USERS'].spli... | true |
3f4fbfe3bd8dcd271044c55ea49be26d40c8cc49 | Ruby | rorygrieve/lrthw | /ex12-1.rb | UTF-8 | 157 | 3.8125 | 4 | [] | no_license | print "How much money do you have? "
answer = gets.chomp.to_f
change = answer / 10
puts "Because I'm in a genorous mood you can have 10% ($#{change}) back." | true |
ba48e78cbee4749962d7802e6b252cdf8337542a | Ruby | abhishekpillai/ttt-10-current-player-q-000 | /lib/current_player.rb | UTF-8 | 139 | 3.25 | 3 | [] | no_license | def turn_count(board)
board.select { |b| !b.strip.empty? }.count
end
def current_player(board)
turn_count(board).odd? ? "O" : "X"
end
| true |
a3028f6caefbd4f5c0c22f6abb7f369534922d85 | Ruby | yutof/hcs | /src/RequestGenerator.rb | UTF-8 | 444 | 3 | 3 | [] | no_license | #!/usr/bin/ruy
load 'Request.rb'
class RequestGenerator
def initialize()
@requests = GenerateRequests()
end
def GenerateRequests()
arr = Array.new
for i in 1..(CARD_REQUEST_DICT.keys.count)
v = CARD_REQUEST_DICT["#{i}"]
for j in 0..(v.count-1)
for k in 1..v[j]
arr.pu... | true |
6926cbd1e59c690365feefa1c04a88029265a189 | Ruby | andreamazza89/data_munging | /spec/unit/day_parser_spec.rb | UTF-8 | 1,622 | 3.421875 | 3 | [] | no_license | describe DayParser, '#extract_days' do
context 'When the input string does not include any days' do
it 'returns an empty array' do
parser = described_class.new("no days here!")
expect(parser.extract_days).to eq []
end
end
context 'When the input string does include days' do
it ... | true |
b3138894771e01601d6cd73d0c052c7c789dc09b | Ruby | abmahmoodi/aparat_bot | /lib/telegram_bot.rb | UTF-8 | 1,394 | 3 | 3 | [] | no_license | require 'typhoeus'
require 'multi_json'
require './lib/aparat'
require './lib/string'
require './lib/api_commander'
require './lib/message'
class TelegramBot
attr_accessor :offset, :token
END_POINT = 'https://api.telegram.org'
def initialize(token)
@offset = 0
@token = token
end
def api_res... | true |
4a3d32af61289f85859d705ae3dd81d849014daf | Ruby | DavidGrey/greeting-cli-q-000 | /lib/greeting.rb | UTF-8 | 197 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env ruby
require_relative "../lib/greeting.rb"
def greeting(name)
puts "Hello #{ name }. It's nice to meet you."
end
#puts greeting("Sally") == "Hello Sally. It's nice to meet you." | true |
ececfb11e8f3789c68bc6b57eb9de3a6f2e155f4 | Ruby | andreassimon/dsls-for-customer-integration | /semantic_model/state.rb | UTF-8 | 782 | 2.90625 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
# vim:set ft=ruby
class State
@@all_instances = Array.new
def self.[](state_name)
@@all_instances.find(proc { State.new state_name }) do |state|
state_name == state.name
end
end
def initialize(name)
@name = name
@transitions = Array.new
@@all_instances << self
e... | true |
b233be1b348ac3827a75a566846256d3d9b51385 | Ruby | GrinnellTextbookLendingLibrary/GTLLDatabase | /app/controllers/books_controller.rb | UTF-8 | 2,529 | 2.78125 | 3 | [] | no_license | require 'csv'
class BooksController < ApplicationController
before_filter :authenticate_user, :except => [:index, :search]
before_filter :authenticate_manager, :except => [:index, :search]
def show
@book = Book.find(params[:id])
end
def new
@book = Book.new
@title = "Add Book"
end
def inde... | true |
5ac0c391d9bdff842960a3084fd02c890564ab86 | Ruby | MehdiBenHamida/rufregle | /lib/translators/free_google/extractor.rb | UTF-8 | 482 | 3.140625 | 3 | [
"MIT"
] | permissive | ##
# Extract translation from raw data.
module Extractor
ENCODE = 'UTF-8'
##
# Extract translation
# @param rawdata [String] Raw text without formating
# @return [String] Translated text
#
# Example of how raw data look like:
# [[["Ola","Hello",,,10]],,"en"]
#
def self.extract(rawdata)
retu... | true |
ffe8136831bd7412b82ce849a06e10ae7be19191 | Ruby | ryu39/ruby30_test | /pattern_matching_tictactoe/test/board_test.rb | UTF-8 | 1,582 | 3.390625 | 3 | [] | no_license | require 'minitest/autorun'
require_relative '../lib/board'
class TestBoard < Minitest::Test
def setup
@board = Board.new
end
def test_horizontals
assert_equal @board.winner(board('XXX', ' ', ' ')), [:horizontal, 'X']
assert_equal @board.winner(board(' ', 'OOO', ' ')), [:horizontal, 'O']
... | true |
d42e90eb147c696a3078cea0f7a07bb1bba61cb3 | Ruby | APWilson97/RB_120 | /rb_120_object_oriented_programming/oo_basics_inheritance/exercise_5.rb | UTF-8 | 286 | 3.296875 | 3 | [] | no_license | module Towable
def tow
puts "I can tow a trailer!"
end
end
class Truck
include Towable
end
class Car
end
truck1 = Truck.new
truck1.tow
# Modules are useful for organizing similar methods that may be relevant to multiple classes
# We can include modules in specific classes | true |
1a1faec1f84ab82da95d3c61346b8be07935deda | Ruby | snehabn/phase-0-tracks | /ruby/nested_data_structures.rb | UTF-8 | 1,442 | 3.140625 | 3 | [] | no_license | #constructing a restaurant hash
# kitchen
# counter
# seating_area
# bar
# pantry
restaurant = {
kitchen: {
chefs: {
chef_de_cuisine: "Sally Smith",
sous_chef: "Bob Jones",
chef_de_partie: {
saute_chef: "James Sause",
roast_chef: "Kelly Rooster",
vegetable_chef: "Billy Broccoli",
},
ute... | true |
53e6ef81f4261805217c486135561577ab28fcea | Ruby | iamghous/RubyAlphabetFinder | /assignment.rb | UTF-8 | 1,612 | 4.34375 | 4 | [] | no_license |
#Noman GHOUS 15085553
# class MyString starting from here
class MyString
# this will let user read and write str
attr_accessor :str
# this will let user only read hash and not allow writing it
attr_reader :letters
# constructor with default value and we can put custom value with given parameter
def initia... | true |
3742f366ce7141bb649ea34c14b922565544b3c9 | Ruby | petersow/town-simulator | /lib/town/person.rb | UTF-8 | 1,472 | 3.015625 | 3 | [] | no_license | module Town
class Person < Thing
attr_accessor :first_name, :family_name, :bedtime_hour
attr_accessor :wake_up_hour, :job, :home, :inventory
attr_reader :date_of_birth
def initialize(options = {})
super(options)
@first_name = options[:first_name] ||= ""
@family_name = options[:fa... | true |
f72a5fd727dd3861dc627c3cab0615fdea3d8fb4 | Ruby | alextryonpdx/epicodus | /Ruby/scrabble_score/spec/scrabble_score_spec.rb | UTF-8 | 653 | 3.140625 | 3 | [] | no_license | require('rspec')
require('scrabble_score')
require('pry')
describe('String#scrabble_score') do
it("returns a scrabble score for a letter 'a'") do
expect("a".scrabble_score()).to(eq(1))
end
it("returns a scrabble score for a letter 'z'") do
expect("z".scrabble_score()).to(eq(10))
end
it("returns a scrabbl... | true |
93d74e6dc6aa14b7894fe8c9ed72299cdda5834a | Ruby | augustt198/java_bytecode | /lib/java_bytecode/constant_pool.rb | UTF-8 | 5,289 | 2.75 | 3 | [
"MIT"
] | permissive | module JavaBytecode
module ConstantPool
module Tag
CONSTANT_Class = 7
CONSTANT_Fieldref = 9
CONSTANT_Methodref = 10
CONSTANT_InterfaceMethodref = 11
CONSTANT_String = 8
CONSTANT_Integer = 3
CONSTANT_Float ... | true |
113760f7f03429b9782c8efb3863529073e552a4 | Ruby | mattissf/Makk | /app/logic/makk/controller.rb | UTF-8 | 864 | 3.3125 | 3 | [] | no_license | require 'rubygame'
require 'app/draw/makk'
require 'app/draw/makk/item'
require 'app/logic/grid'
class Makk
class Controller
attr_reader :grid
attr_reader :item
attr_reader :makk
def initialize(surface)
@grid = Grid.new(surface)
@makk = Makk.new(@grid)
@item = Mak... | true |
c13420bcc1317c477df999cb56a2ce730e88bf06 | Ruby | amitkssolanki/jsonapi_html_parser | /app/models/page.rb | UTF-8 | 721 | 2.625 | 3 | [] | no_license | require 'nokogiri'
require 'open-uri'
class Page < ApplicationRecord
validates :url, presence: true
has_many :header_tags
has_many :links
before_create do
# Parse page url and build necessary associations before saving the record
doc = Nokogiri::HTML(open(url))
title = doc.title
doc.... | true |
e0af576e470e75279a4497e5eee12fdb245e41c1 | Ruby | Em01/Boris-bikes-take-two | /spec/bike_container_spec.rb | UTF-8 | 2,210 | 2.875 | 3 | [] | no_license | require 'bike_container'
shared_examples BikeContainer do
let(:container) { described_class.new }
let (:bike) { double :bike, broken?: false }
let (:filled_container) { described_class.new([bike]) }
it 'has no bikes' do
expect(container).not_to have_bikes
end
it 'can be created with bikes' do
... | true |
a6fc572c0930f004baf42e64d23436a23f9ae909 | Ruby | matao0214/Demo | /1018.rb | UTF-8 | 100 | 2.78125 | 3 | [] | no_license | a,b=gets.split.map(&:to_i)
ans=[a]
9.times do |i|
a=a+b
ans[i+1] = a
end
puts ans.join(' ')
| true |
2bbeaea5464f29a9167068a924f758371d156e86 | Ruby | ruby-rdf/rdf-trix | /lib/rdf/trix/reader.rb | UTF-8 | 8,005 | 2.625 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | require 'rdf/xsd'
module RDF::TriX
##
# TriX parser.
#
# This class supports [REXML][], [LibXML][] and [Nokogiri][] for XML
# processing, and will automatically select the most performant
# implementation (Nokogiri or LibXML) that is available. If need be, you
# can explicitly override the used implement... | true |
75dccf2a16a1382ebdcb2881d47abdf86276fb48 | Ruby | TheREK3R/users | /libraries/helpers.rb | UTF-8 | 3,562 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | module Users
# Helpers for Users
module Helpers
# Checks fs type.
#
# @return [String]
def fs_type(mount)
# Doesn't support macosx
stat = shell_out("stat -f -L -c %T #{mount} 2>&1")
stat.stdout.chomp
rescue
'none'
end
# Determines if provided mount point is remot... | true |
0c3eadbd779b0273d0cad5de32146f8bfebd9235 | Ruby | UnlichtStudios/rpgtables | /lib/rpgtables/menu.rb | UTF-8 | 10,481 | 2.8125 | 3 | [
"MIT"
] | permissive | # menu.rb
#
# Copyright 2017 (c) Scott Isenberg
#
# 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 limitation the rights
# to use, copy, modify, merge, p... | true |
16faa1df7e650d55679cfe6bc0441cc848604267 | Ruby | supasuma/exercism | /raindrops/raindrops.rb | UTF-8 | 628 | 3.046875 | 3 | [] | no_license | module BookKeeping
VERSION = 3
end
class Raindrops
def self.convert(_number)
if _number % 3 == 0 && _number % 5 == 0 && _number % 7 == 0
'PlingPlangPlong'
elsif _number % 3 == 0 && _number % 5 == 0
'PlingPlang'
elsif _number % 3 == 0 && _number % 7 == 0
... | true |
37c3c1257ed7911dc5b9d74e85c29e1a0737d280 | Ruby | naoki-tsunekawa/LeetCode | /20.ValidParentheses/main.rb | UTF-8 | 517 | 4.1875 | 4 | [] | no_license | # @param {String} s
# @return {Boolean}
def is_valid(s)
brackets = []
s.each_char do |c|
case c
when "(", "{", "["
brackets.push(c)
when ")"
return false if brackets.pop() != '('
when "}"
return false if brackets.pop() != '{'
when "]"
return false if brackets.pop() != '['
end
... | true |
a6bf1db81e2f10b61bb63414d6585bf6e2543e50 | Ruby | shyrydan/speedTest | /ruby/primes.rb | UTF-8 | 202 | 3.296875 | 3 | [] | no_license | def isPrime(number)
for i in 2..number - 1
if number % i == 0 then
return false
end
end
return true
end
for i in 2..200000
if isPrime(i) then
print "X"
else
print "O"
end
end
| true |
d02c70e5f324ab9ed7eae840cb8d0d4c549220a0 | Ruby | ShanePinderDev/book_intro_to_programming | /the_basics/ex2.rb | UTF-8 | 205 | 3.03125 | 3 | [] | no_license | thousands = 5618 / 1000
hundreds = 5618 % 1000 / 100
tens = 5618 % 100 / 10
ones = 5618 % 10 / 1
puts "thousands: #{thousands}"
puts "hundreds: #{hundreds}"
puts "tens: #{tens}"
puts "ones: #{ones}" | true |
b70e38bf860e016467c3d82ea8023a0f8ddd6d32 | Ruby | jaymondigo/napybara | /spec/napybara/dsl_spec.rb | UTF-8 | 3,046 | 2.640625 | 3 | [
"MIT"
] | permissive | require 'spec_helper'
describe Napybara::DSL do
let(:capybara_page) do
Capybara.string <<-HTML
<form class='some-form'>
<button class='some-button'>
<img />
</button>
<button class='another-button'>
<img />
</button>
</form>
HTML
end
descr... | true |
ae97cc5bc598354b4a7dcac75ffe259a31b2f3b5 | Ruby | saulocn/curso-ruby | /campo_minado/campo_minado.rb | UTF-8 | 6,244 | 3.375 | 3 | [] | no_license | require_relative 'ponto'
class Minesweeper
attr_reader :largura, :altura, :numero_minas, :campo
def initialize(largura, altura, numero_minas)
@largura = largura-1
@altura = altura-1
@numero_minas = numero_minas
@campo = cria_campo
end
def cria_campo
@campo = [a... | true |
520cbfaf3dff7f85d9a2adc8e50013080d9cbad6 | Ruby | Joshun/battleships | /battleships.rb | UTF-8 | 2,709 | 4.125 | 4 | [] | no_license | # Battleships
#
# Joshua O'Leary
# Assignment 2
# 12/2014
# University of Sheffield
require "colorize"
require_relative "tile"
require_relative "ship"
require_relative "board"
GRID_SIZE = 10 #Width and height of grid
# Function to check if the given coordinates are within the allowable range
def check_valid_positio... | true |
e80774118f466f49f2f5a9fa6d9df170e878bd71 | Ruby | investtools/ftpmvc | /spec/lib/ftpmvc/format/csv_spec.rb | UTF-8 | 1,569 | 2.625 | 3 | [
"MIT"
] | permissive | require './spec/spec_helper'
require 'ftpmvc/format/csv'
require 'ftpmvc/file'
describe FTPMVC::Format::CSV do
let(:csv_file_class) do
Class.new(FTPMVC::File) do
include FTPMVC::Format::CSV
def rows
[['a', 'b', 'c'], ['d', 'e', 'f']]
end
end
end
let(:csv_file) { csv_file_class.... | true |
d938fdcf319976c66f5a413911e3a7ad8206d480 | Ruby | Evelyn651/udemy_ruby_courses | /conditionals/if_statements.rb | UTF-8 | 555 | 4.28125 | 4 | [] | no_license | a = 5
b = 4
# if a <= b
# puts "#{a} is less than or equal to #{b}"
# elsif a != b
# puts "#{a} is not equal to #{b}"
# if a >= b
# puts "#{a} is greater than or equal to #{b}"
# end
# end
# if a > b and b > 0
# puts "Both conditions are true"
# end
# if a < b or b > 0
# puts "At least one of the con... | true |
d6221496ea7ddaf13686a5ace9495ec54c76eb44 | Ruby | Facupitta/dds-tps-personales | /ruby/spec/transforms/multi_inject_spec.rb | UTF-8 | 3,099 | 2.625 | 3 | [] | no_license | describe "Transforms" do
before(:each) do
class Saludador
def saludar(nombre1, nombre2, nombre3)
"Hola #{nombre1}, #{nombre2}, #{nombre3}"
end
end
end
after(:each) do
Object.send(:remove_const, :Saludador)
end
context "injecting params twice" do
it "should respond to ... | true |
995ce7757de1ec83167c83d2fb2d662d55013905 | Ruby | nkeszler/travel-locations | /spec/location_spec.rb | UTF-8 | 563 | 2.59375 | 3 | [] | no_license | require 'location'
describe 'Location' do
let(:location) {LocalLocation.new('China')}
it "should initialize with a name" do
expect(location.name).not_to eq(nil)
end
it "should have an array for photos" do
expect(location.photos).to be_a(Array)
end
it "should have a description" do
expect(location.re... | true |
53306587943174d8a92121757e9dd0d23bc5576b | Ruby | wordkarin/FarMar | /lib/farmar_product.rb | UTF-8 | 2,654 | 3.609375 | 4 | [] | no_license | require 'csv'
module FarMar
class Product
attr_reader :product_id, :product_name, :vendor_id
def initialize(product_id, product_name, vendor_id)
# ID - (Fixnum) uniquely identifies the product
@product_id = product_id
# Name - (String) the name of the product (not guaranteed unique)
@... | true |
019b008d4c5e0749102ef14fc70285a60e59cfa5 | Ruby | Hiro-o-ai/object_brain | /クラスについて/manager.rb | UTF-8 | 82 | 2.59375 | 3 | [] | no_license | require_relative './human'
human = Human.new("小林", 178)
human.eat
human.sleep | true |
11436677204e7c4a2fab512d24d5793e68b7d69b | Ruby | BerilBBJ/scraperwiki-scraper-vault | /Users/T/tomsutton1984/shspotdetails.rb | UTF-8 | 5,958 | 2.6875 | 3 | [] | no_license | require 'nokogiri'
require 'open-uri'
ScraperWiki::attach("shspot")
urls = ScraperWiki::select("IMO, URL from shspot.swdata where length(IMO) <75 and length(IMO) >0 order by IMO")
for ship in urls
url = ship["URL"]
page = Nokogiri::HTML(open(url))
if page.at_css('td:nth-child(3) table:nth-child(2) t... | true |
e96ba1b9031dec9f850433d86cee2e511b5922bb | Ruby | elia/opal | /test/core/hash/element_set_spec.rb | UTF-8 | 178 | 2.625 | 3 | [
"MIT"
] | permissive | describe "Hash#[]=" do
it "associates the key with the value and return the value" do
h = {:a => 1}
(h[:b] = 2).should == 2
h.should == {:b => 2, :a => 1}
end
end | true |
9a29be9b3137fbbe7246d32e80017af7ebe64db8 | Ruby | Marrowsed/teste0 | /complexo.rb | UTF-8 | 863 | 3.953125 | 4 | [] | no_license | class Complexo
def initialize(a, bi)
@a = a;
@bi = bi;
end;
def soma(c, di)
@sreal = @a + c;
@simag = @bi + di;
@stotal = @sreal + @simag;
puts "Resultado da soma: #{@stotal}";
end;
def multiplica(c, di)
@mreal = (@a * c) - (@bi ... | true |
8edc87fee02c853a3c43f5fce8cb5aece9c9f9e0 | Ruby | collabnix/dockerlabs | /vendor/bundle/ruby/2.6.0/gems/rubocop-0.93.1/lib/rubocop/cop/lint/safe_navigation_with_empty.rb | UTF-8 | 1,313 | 2.59375 | 3 | [
"Apache-2.0",
"CC-BY-NC-4.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # frozen_string_literal: true
module RuboCop
module Cop
module Lint
# This cop checks to make sure safe navigation isn't used with `empty?` in
# a conditional.
#
# While the safe navigation operator is generally a good idea, when
# checking `foo&.empty?` in a conditional, `foo` bein... | true |
40a5ab99c6a8d4a68254f30e07a76d52de833981 | Ruby | sidho/chess | /king.rb | UTF-8 | 164 | 2.578125 | 3 | [] | no_license | class King < SteppingPiece
def initialize(position, color, board)
super
@symbol = "\u265A"
end
def moves
super DIAGONALS + ORTHOGONALS
end
end
| true |
0379c8b8dfb84e3ca8536fde0a71c751f7e873d2 | Ruby | silverballs/BEWDiful_Students | /06_Sharing_Behavior/code_alongs/coa_instr_inheritance.rb | UTF-8 | 1,228 | 4 | 4 | [] | no_license |
#Sharing Behavior and Variables
#TIME: 20 min
#INSTRUCTIONAL DESIGN NOTES:
# => During the rails portion of the course students will not have to write a class that inherits from another.
# => However they do need to understand the topic so that active record makes sense.
# In addition students who wish to take ... | true |
0fb6065bea2eba8a540eef86015b0002ea6e2d8f | Ruby | dylanerichards/shapeways-challenge | /production-orders(3)/production_order.rb | UTF-8 | 385 | 2.9375 | 3 | [] | no_license | class ProductionOrder
attr_accessor :id, :parent_id
def initialize(options = {})
@id = options.fetch(:id, nil)
@parent_id = options.fetch(:parent_id, nil)
end
def self.childless_orders(orders)
parent_order_ids = orders.map(&:parent_id).compact
parent_orders = orders.select { |order| parent_ord... | true |
070049ab7735600aa13f719f054b5553671d8ef8 | Ruby | darciew/inspector-code | /app/models/results.rb | UTF-8 | 456 | 2.625 | 3 | [] | no_license | # frozen_string_literal: true
require 'httparty'
class Results
attr_reader :languages
def initialize(github_api = Github.new(username))
@github_api = github_api
@languages = []
end
def repository_languages
@github_api.repositories.each do |repository|
@languages << repository['language']
... | true |
fc5aadcd080a96701749ff925268fcd6059969e5 | Ruby | jaxdesmarais/object_oriented_ruby | /store/food.rb | UTF-8 | 250 | 2.578125 | 3 | [] | no_license | require "./store_item.rb"
require "./storable.rb"
module Target
class Food < StoreItem
attr_reader :shelf_life
include Storable
def initialize(input_options)
super
@shelf_life = input_options[:shelf_life]
end
end
end | true |
1e895b400dfef46a2211316c5fde3a991406ef36 | Ruby | Sokre95/nenr | /hw1/zad3_test.rb | UTF-8 | 814 | 2.859375 | 3 | [] | no_license | require_relative './domain'
require_relative './operations'
require_relative './debug'
d = Domain.int_range(0, 11)
set = MutableFuzzySet.new(d)
.set(DomainElement.of([0]), 1.0)
.set(DomainElement.of([1]), 0.8)
.set(DomainElement.of([2]), 0.6)
.set(DomainElement.of([3]), 0.4)
.set(DomainElement.of([4]), 0.2... | true |
3ede94127bf4a9e9350ffcf446b2782bd3e88b7a | Ruby | toinou3010/git-thp-floraJ | /Cours_du_13-4-21/exo_04.rb | UTF-8 | 99 | 3.34375 | 3 | [] | no_license | puts "Quel est ton année de naissance ?"
year = gets.to_i
puts "Tu auras 100 ans en #{100 + year}" | true |
6d96ad49403e6ab449ff6706cebd33bb7dcb0fea | Ruby | dfockler/HackingSim | /src/software/linux_software.rb | UTF-8 | 2,184 | 3.03125 | 3 | [] | no_license | require 'optparse'
module LinuxSoftware
def help(message1, message2)
puts "Cats " + message1 + " " + message2
end
def ifconfig()
print_ip()
end
def print_ip()
puts "Internal IP: %s" % @inter_ip
puts "External IP: %s" % @extern_ip
puts "MAC: %s" % @mac
end
def ping(*args)
op... | true |
bc47dee3baf71446c2e002e8617f19d02fa7428f | Ruby | adubrock/LightTalk2 | /LT2.rb | UTF-8 | 213 | 3.359375 | 3 | [] | no_license | # Lightning talk program on how blocks don't permanently change variables
def no_up(string = 'lowercase?')
yield string
puts "#{string}"
end
no_up do |string|
string = string.upcase
puts "#{string}"
end
| true |
54c8a090c80f7affdafb8f35f5fc4ea0353e5d02 | Ruby | AARodgers/ruby-objects-has-many-through-readme-online-web-sp-000 | /lib/meal.rb | UTF-8 | 413 | 3.015625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | class Meal
attr_accessor :waiter, :customer, :total, :tip
@@all = []
def initialize(waiter, customer, total, tip)
@waiter = waiter
@customer = customer
@total = total
@tip = tip
@@all << self
end
def self.all
@@all
end
end
# a = M... | true |
155eaceffd8b7fbe3c43da3de3ccfd43f33dbd58 | Ruby | spierre95/ar-exercises | /exercises/exercise_7.rb | UTF-8 | 413 | 2.703125 | 3 | [] | no_license | require_relative '../setup'
require_relative './exercise_1'
require_relative './exercise_2'
require_relative './exercise_3'
require_relative './exercise_4'
require_relative './exercise_5'
require_relative './exercise_6'
puts "Exercise 7"
puts "----------"
input = gets.chomp
@user = Store.create(name:input)
@errors... | true |
d8b74cddc91b8e1da4396de51b2a880e48d817fa | Ruby | MrAlexLau/sheepshead | /lib/models/game.rb | UTF-8 | 2,955 | 3.078125 | 3 | [] | no_license | class Game
attr_reader :results
def initialize(options, table, dealer_seat)
@options = options
@dealer = Dealer.new(dealer_seat, @options.number_of_players)
@table = table
@tricks_played = 0
end
def play
@dealer.deal(@table)
@picker = @dealer.blind_selection(@table)
# start with t... | true |
dc5407b46153ce43f0e17f427429645ad5625c9d | Ruby | dedayog/Learning-Ruby | /Rubyrush.ru/step036.rb | UTF-8 | 453 | 3.5 | 4 | [] | no_license | def mary (size: 50, min_limit: 0, max_limit: 100, **)
Array.new(size) {rand(min_limit..max_limit)}
end
def cutting_ary (n_first, source_ary)
unless source_ary.is_a?(Array) || source_ary.size > 0 || n_first > 0
return ['Wrong arguments']
end
n_first = source_ary.size if n_first > source_ary.size
# main
... | true |
54f8aa17431d6a658361091a3d91eb5eb2df7410 | Ruby | higepon/misc | /climbing-stairs.rb | UTF-8 | 211 | 3.203125 | 3 | [] | no_license | # @param {Integer} n
# @return {Integer}
def climb_stairs(n)
if n == 1
return 1
end
dp = Array.new(n)
dp[0] = 1
dp[1] = 1
for i in 2..n
dp[i] = dp[i - 1] + dp[i - 2]
end
return dp[n]
end
| true |
692ca33fba26b24cff4f35c7365c6c7c63d91972 | Ruby | allisonkinnamore/hw-ruby-intro | /lib/ruby_intro.rb | UTF-8 | 700 | 3.921875 | 4 | [] | no_license | # When done, submit this entire file to the autograder.
# Part 1
def sum arr
result = 0
arr.each {|x| result += x}
result
end
def max_2_sum arr
sum(arr.max(2))
end
def sum_to_n? arr, n
arr.combination(2) { |c| return true if c.sum == n}
false
end
# Part 2
def hello(name)
"Hello, " + name
end
def st... | true |
7084d195ba6b541754cb560ea5fa73aaf5c307a6 | Ruby | nicknovitski/solarsystem | /book.rb | UTF-8 | 844 | 3.234375 | 3 | [] | no_license | class Chapter
attr_reader :name, :sections
def initialize(title, sections=nil, &block)
@name = title
if block_given?
@sections = []
instance_eval &block
else
@sections = sections
end
end
def section(title)
@sections << title
end
end
class Book
@descendants = []
def s... | true |
0d8f61a3f27c0d1f9ab5e4e41684329c84be59be | Ruby | aviabird/listify-backend | /app/services/twitter_api/tweet_service.rb | UTF-8 | 2,253 | 2.65625 | 3 | [] | no_license | module TwitterApi
class TweetService < TwitterApi::Base
def add_to_fav(tweet)
begin
user_list_id = tweet[:user_list_id]
res = @client.favorite!([tweet.to_unsafe_h["id_str"]])
tweets = add_user_list_id_to_tweets(user_list_id, res)
# Return fav tweet
return { status: tr... | true |
4663908b93887af1689be3d03133c6673efbf9cd | Ruby | malachaifrazier/billingly | /spec/models/invoice_spec.rb | UTF-8 | 8,627 | 2.53125 | 3 | [
"MIT"
] | permissive | require 'spec_helper'
describe Billingly::Invoice do
let(:invoice){ create(:fourth_month).invoices.last }
it 'is deemed paid when there is paid_on date' do
invoice.should_not be_paid
invoice.update_attribute(:paid_on, Time.now)
invoice.should be_paid
end
describe 'when charging an invoice' do
... | true |
4f47e1043953426008da5d684cf63623c68210dc | Ruby | UmarFBajwa/phase-0-tracks | /ruby/shout.rb | UTF-8 | 922 | 4.28125 | 4 | [] | no_license | # #RELEASE 1
# #Create a module Shout and add methods declared on the self keyword
# module Shout
# def self.yell_angrily(words)
# words + "!!!" + " :("
# end
# def self.yelling_happily(words)
# words + "!!!!!! :)"
# end
# end
# #DRIVER CODE
# Shout.yell_angrily("WTF")
# Shout.yelling_happily("DBC")
#R... | true |
41b3bef2b555bc0ba5e5cf2283f4d37cf2b13681 | Ruby | meirosilio/ruby_programming | /hangman/lib/options.rb | UTF-8 | 2,418 | 3.5625 | 4 | [] | no_license | require 'json'
class GameOptions
attr_accessor :sample_word, :word_discover_array, :number_of_shots, :number_of_tries, :latters
def initialize(sample_word, word_discover_array, number_of_shots, number_of_tries, latters)
@word_discover_array=word_discover_array
@number_of_shots=number_of_shots
... | true |
db5852a75d9f41d4b327d4d0ea7e9585e6bda158 | Ruby | mlongerich/bbor-exercises | /download_wikipedia_page.rb | UTF-8 | 826 | 3.109375 | 3 | [] | no_license | require 'open-uri'
remote_base_url = "https://en.wikipedia.org/wiki"
start_year = 2003
end_year = 2005
compiled_filename = start_year.to_s + "-" + end_year.to_s + ".html"
puts "Creating: " + compiled_filename
compiled_file = open(compiled_filename, "w")
(start_year..end_year).each do |year|
remote_full_url = remo... | true |
d740c0495b34c8be1f624c49a81a4778b2f60882 | Ruby | KeeganCorrigan/black_thursday | /test/invoice_repository_test.rb | UTF-8 | 4,310 | 2.578125 | 3 | [] | no_license | # frozen_string_literal: true
require_relative 'test_helper.rb'
require './lib/sales_engine'
require './lib/invoice_repository'
class InvoiceRepositoryTest < Minitest::Test
def setup
@attributes =
{
customer_id: 7,
merchant_id: 8,
status: :pending,
created_at: Time.now,
... | true |
fc21114110d6923ac732d061c0b319dbc4170f5c | Ruby | kyletolle/sudocore | /timer.rb | UTF-8 | 1,208 | 3.796875 | 4 | [
"BSD-2-Clause"
] | permissive | # Tracks the time it took to solve the puzzle.
# Set to_log to true to log out solved duration.
# Set verbose to true to log out the start and solve times.
class Timer
# Want to log time in "HH:MM:SS AM/PM" format
TIME_FORMAT = "%I:%M:%S%p"
# Create the timer.
# Set to_log to true to log out solved duration... | true |
3610a1ad750a60ea82a09d70bcf4b691e28c4b00 | Ruby | Benrod04/Respuestas-de-Aprende-a-Programar | /Es/07 Control de flujo/7.2_la_abuela_sorda.rb | UTF-8 | 1,354 | 4.1875 | 4 | [
"CC0-1.0"
] | permissive |
# encoding: UTF-8
# Escribe el programa de la abuela sorda.
# Para cualquier cosa que le digas a la abuela (esto es, cualquier cosa que
# escribas), ella debe responder con ¿¡QUÉ!? ¡HABLA MÁS FUERTE HIJITO!, a menos
# que se lo digas gritando (escribiendo todo en mayúsculas). Si gritas, ella
# podrá escucharte (o al ... | true |
1b020d16809cd846f473f7c1d66dcf792faf80ef | Ruby | ElenaOl/math_chalange | /app/controllers/games_controller.rb | UTF-8 | 2,309 | 2.65625 | 3 | [] | no_license | class GamesController < ApplicationController
before_action :current_user, :is_authenticated
def new
@child = Child.find(params[:child_id])
@game = Game.new
end
def make_problem
level = @game[:level]
operation = @game[:operation]
if(level == 1)
nu... | true |
3bd3c286709eaa9e785c19afecc41c95287d6b7f | Ruby | suzbaldwin/oo-basics-v-000 | /lib/shoe.rb | UTF-8 | 1,568 | 4.15625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | # Make your shoe class here!
# class Shoe
#
# def initialize(brand)
# @brand = brand
# end
#
# def brand
# brand = @brand
# end
#
# def color=(color)
# @color = color
# end
#
# def color
# @color
# end
#
# def size=(size)
# @size = size
# end
#
# def size
# @size
# end
#
# def material=(material)
# @material ... | true |
b1c79a7cdbaf2125f99264ce42652d48d2e9cef0 | Ruby | rodcul/student-directory | /show_source.rb | UTF-8 | 164 | 3.078125 | 3 | [] | no_license | # Create a file that reads and prints its own source code
file = File.open(__FILE__ , "r")
file.readlines.each {|line| puts line.chomp}
file.close
# end of script | true |
8a62ff5f70dcd69dc3a117bf08363222a5ea7eef | Ruby | Haider-BA/libflatarray | /examples/lbm/generator | UTF-8 | 693 | 2.578125 | 3 | [
"BSL-1.0"
] | permissive | #!/usr/bin/ruby
intervals = [
[32, 64, 128, 192, 256, 512, 544, 1056],
[32, 64, 128, 192, 256, 512, 544, 1056],
[32, 64, 128, 192, 256, 512, 544, 1056]
]
counter = -1
intervals[0].size.times do |x1|
counter += 1
File.open("flatarray_implementation_#{counter}.cu", "w") do |f|
f.puts <<EOF
#include <i... | true |
c50dfce38f49635144664c14387b96ac88a7014a | Ruby | GantMan/rock_paper_scissors | /lib/rock_paper_scissors/game_manager.rb | UTF-8 | 1,788 | 3.84375 | 4 | [
"MIT"
] | permissive | module RockPaperScissors
class Game
@@move_lookup = {'r' => 'rock', 'p' => 'paper', 's' => 'scissors'}
def initialize mode="AI"
puts "\n*********************************************"
puts "** Welcome to Rock, Paper, Scissors! **"
puts "*********************************************"
... | true |
0ffded6e1380f6b36729a1582b4a56ff2fb4dc67 | Ruby | exloc/app | /lib/tasks/github.rake | UTF-8 | 1,585 | 2.765625 | 3 | [] | no_license | require "open-uri"
namespace :github do
desc "get public data for a user"
task :user do
# name = ENV["NAME"]
task, username = *ARGV # ARGV => ["github:user", "username"]
raise "Try: `rake github:user radavis`" unless username
uri = URI("https://api.github.com/users/#{username}")
options = { a... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.