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
f951c5c79458ef2d1710cdbd8b15a7b97821fa6c
Ruby
sails-simulator/ruby-sailsd
/lib/sailsd.rb
UTF-8
904
3.09375
3
[]
no_license
require 'json' require 'socket' class Sailsd attr_reader :latitude attr_reader :longitude attr_reader :heading attr_reader :rudder_angle attr_reader :sail_angle attr_reader :speed def initialize() @socket = nil end def connect() @socket = TCPSocket.open('localhost', 3333) end def send_...
true
ef541829a14586149bf07455502b05a4b8d9f7e0
Ruby
tamepenguin/netbak
/bs.rb
UTF-8
355
2.875
3
[]
no_license
#/usr/bin/env ruby -w require 'socket' port = "19165" hostname = '127.0.0.1' file = "/tmp/f" outfile = open(file, "w") socket = TCPServer.open(port) puts "Server started" data = "" client = socket.accept puts "The connection is now in place" data = client.read outfile.write(data) client.close socket.clos...
true
bb3b6714987f91d02b688247e13ccc8fe84a8145
Ruby
leusonmario/TravisAnalysis
/build_conflicts_analysis/CausesExtractor/IndividualExtractor/AlternativeStatement.rb
UTF-8
821
2.625
3
[]
no_license
class AlternativeStatement def initialize() end def extractionFilesInfo(buildLog) filesInformation = [] begin information = buildLog.to_enum(:scan, /\[ERROR\] Alternative [a-zA-Z0-9\.]* is a subclass of alternative [a-zA-Z0-9\.]*/).map { Regexp.last_match } count = 0 while(count < inf...
true
6b47d877ddeecb50b3106938480e3c869d96ff9e
Ruby
alejandracampero/ruby-advanced-class-methods-lab-v-000
/lib/song.rb
UTF-8
1,178
3.296875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Song attr_accessor :name, :artist_name @@all = [] def self.all @@all end def save self.class.all << self end def self.create song = Song.new song.save song end def self.new_by_name (song_name) song = self.new song.name = song_name song end def self.creat...
true
1ef092add7f5679a6244e02486e24f7ab182d93f
Ruby
hopegiometti/oo-my-pets-dumbo-web-100719
/lib/owner.rb
UTF-8
1,484
3.609375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' class Owner attr_reader :name, :species @@all = [] def initialize(name) @name = name @species = "human" @@all << self end def say_species p "I am a #{@species}." #ask why puts won't work here end def self.all @@all end def self.count @@all.size end ...
true
fa4bbf10bc4ddf05c22ff4620230eee0222cbe9c
Ruby
marcbey/thomeli-webapp
/app/managers/token_generator.rb
UTF-8
728
3.296875
3
[ "MIT" ]
permissive
module TokenGenerator extend self CHARS = ('a'..'z').to_a VOWELS = %w( a e i o u ) CONSONANT = CHARS - VOWELS BLOCKS = 5 BLOCK_LENGTH = 4 # must be divisible by 2 SEPERATOR = '-' PREFIX_REGEX = /^([A-Z0-9]{2})([0-9])([A-Z])$/i def unique_token( unicator ) begin token = generate end ...
true
8b9799672050d560bc8685e1c8500c5ed8ae714e
Ruby
LelnaG/Ruby_LL
/RubyBlanks_Challenge.rb
UTF-8
680
4.03125
4
[]
no_license
#!/usr/bin/env ruby #Ruby Blanks: fill in the blank (Mad Libs) #"I decided to ____ a ______ party for my _____ ______" # ----decide if the blank should be a verb, adjective, noun, etc #place word types into an array #i.e blanks = ['verb', 'adjective', 'adjective, 'noun'] #ask user for words #output final resulting sen...
true
fd36bcc017ca5ab3eeb7a3dea2f0a16e6d296ef6
Ruby
CSheesley/backend_prework
/day_6/exercises/dog.rb
UTF-8
799
4.5625
5
[]
no_license
# In the dog class below, add a (play)? method that, when called, will result in # the dog being hungry. Call that method below the class, and print the dog's # hunger status. class Dog attr_reader :breed, :name, :age def initialize(breed, name, age) @breed = breed @name = name @age = age @h...
true
d2a2d7de395d631f59444374c68ab3fafe55cf15
Ruby
jneen/plans
/app/models/theme.rb
UTF-8
1,260
2.765625
3
[]
no_license
module Theme def self.wrap(thing) case thing when Theme thing else create(thing) end end def self.create(name) name ||= 'default' klass = (name !~ /\W/) ? LocalTheme : ExternalTheme klass.new(name) end def self.local DIR.entries.map(&:to_s).grep(/\.css$/).map { ...
true
7b52fcf84d4e4dfb1f0074616fb9bcfcc3cf88ad
Ruby
sevos/git-pp
/bin/git-pp
UTF-8
1,467
3.09375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # encoding: utf-8 require 'yaml' CONFIG_FILE_PATH="#{ENV['HOME']}/.git-pp.yml" module Git module Pp module Activable def activate `git config user.name '#{name}'` `git config user.email '#{email}'` end end end end Person = Struct.new(:name, :email) do inc...
true
6de6487f9e3430f472ba1a5f9700ef5198300bb9
Ruby
eSilvac/To-Do-List_Sinatra
/EdicionVariables.rb
UTF-8
516
2.859375
3
[]
no_license
require 'make_todo' tareas = Tarea.all class Edit attr_accessor :posi, :nuevo, :arr, :temp, :cont def initialize(pos,ne) @arr = Tarea.all @posi = pos + 1 @cont = pos @nuevo = ne todo end def todo @arr.shift i = 1 @arr.each do |actual| if @cont == i Tarea.destroy(actual["id"]) Tare...
true
bc2e7e7d813a839ce947cfb5d427b38031d4f88d
Ruby
rawswift/ruby-collections
/class/basic/person.rb
UTF-8
971
4.34375
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby class Person # constructor def initialize(name = '', email = '', address = '') @name = name @email = email @address = address end # # setter methods # def set_name(name = '') @name = name end def set_email(email = '') @email = email end def set_addre...
true
a32697dc7f4c2c950da99baaba92e357cc55d3fe
Ruby
yuzhiyuan413/fish
/app/models/pass/permission.rb
UTF-8
1,867
2.671875
3
[ "Apache-2.0" ]
permissive
class Pass::Permission < Pass::Base self.table_name = "permissions" serialize :operates, Array #添加 ADD_CODE = "0" #查看 SHOW_CODE = "1" #删除 DELETE_CODE = "2" #修改 EDIT_CODE = "3" OPERATE_CODES = [ADD_CODE, SHOW_CODE, DELETE_CODE, EDIT_CODE] #状态 允许 STATUS_YES = 1 #状态 禁止 STATUS_NO = 0 ...
true
362ba1474a0cfb3febf8648841aa01bc7db925c4
Ruby
jonpiffle/projectEuler
/euler4.rb
UTF-8
214
3.5625
4
[]
no_license
def is_palendrome(i) i.to_s == i.to_s.reverse end max = 0 999.downto(1).each do |i| 999.downto(1).each do |j| if is_palendrome(i*j) puts i*j max = i*j if i*j > max end end end puts max
true
8b663b8cf924cabdd5c5aad8374ee39a9061aee7
Ruby
Pas-byNumbers/deli-counter-london-web-051319
/deli_counter.rb
UTF-8
622
3.90625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. def line(queue) if queue.size == 0 puts "The line is currently empty." else message = "The line is currently:" queue.each_with_index do |name, index| message += " #{index.to_i+1}. #{name}" end puts "#{message}" end end def take_a_number(queue, name) queue.push(name...
true
a298d0ef124e99d0f1784b51728dd9d2881f6021
Ruby
lightmotive/ls-exercises-ruby-basics
/debugging/08_colorful_things.rb
UTF-8
1,129
3.78125
4
[]
no_license
# frozen_string_literal: true # The following code throws an error. Find out what is wrong and think about how you would fix it. colors = ['red', 'yellow', 'purple', 'green', 'dark blue', 'turquoise', 'silver', 'black', 'sapphire blue'] things = ['pen', 'mouse pad', 'coffee mug', 'sofa', 'surf board', 'training mat',...
true
ecb2978a4b1fd7b66ce456459110f6ea0587bd9c
Ruby
eregon/adventofcode
/2017/18b.rb
UTF-8
1,893
2.921875
3
[]
no_license
input = File.read("18.txt") class Program REG = /[a-z]/ OP = /(?:#{REG}|-?\d+)/ attr_writer :other attr_reader :queue, :sends def initialize(input, pid) @pid = pid @registers = Hash.new(0) @registers['p'] = pid @queue = Queue.new @sends = 0 parse(input) end def val(str) if ...
true
25770d7be280f8fa1fb18a970a7b24b48c111878
Ruby
example-apps/palindrome
/tatum/spec/palindrome_spec.rb
UTF-8
901
2.984375
3
[]
no_license
require 'spec_helper' describe "#palindrome?" do it "should handle empty Strings" do expect(''.palindrome?).to be_false end it "returns false with an in-valid palidrome" do expect('baseball'.palindrome?).to be_false end it "returns true with an valid palidrome" do expect('racecar'.palindrome?)...
true
a1d8595e130f4ba4710b159556f9313a8d282510
Ruby
Maria-L/Programme
/Aufgabe6/lib/hash.rb
UTF-8
1,126
2.703125
3
[]
no_license
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','Extensions') #require'test/unit' require_relative '../Extensions/ext_pr1_v4' #Proove if self is equal to aHash # #equals_ ::= (aHash) :: Hash -> Bool # #Test{ (Hash["a" =>1],Hash["a" =>1]) => true, (Hash["a" =>1,"b" =>2],Hash["a" =>1])=> false, # (Ha...
true
13b28f2af9627a1a0dd83c1a7b96903bf6f6c39e
Ruby
microsoftgraph/msgraph-sdk-ruby
/lib/models/learning_course_activity.rb
UTF-8
8,956
2.546875
3
[ "MIT" ]
permissive
require 'date' require 'microsoft_kiota_abstractions' require_relative '../microsoft_graph' require_relative './models' module MicrosoftGraph module Models class LearningCourseActivity < MicrosoftGraph::Models::Entity include MicrosoftKiotaAbstractions::Parsable ## # Da...
true
d615ef7fd16e5c54e2dc1c4e28129bcc26ab2226
Ruby
ODINAKACHUKWU/ruby-tutorials
/codes/f2cio.rb
UTF-8
320
3.375
3
[]
no_license
puts "Reading Fahrenheit temperature value from data file..." num = File.read("temp.dat") fahrenheit = num.to_i celsius = (5 * fahrenheit - 160) / 9 puts "Saving result to output file 'temp.out'..." fh = File.new("temp.out", "w") fh.puts celsius fh.close puts "Please check file 'temp.out' for the Celsius equivalence!"
true
da8b7a1844ce938ebaae12847a7242aa948f58ba
Ruby
Hyan18/OOD-encapsulation
/spec/secret_diary_spec.rb
UTF-8
2,076
3.078125
3
[]
no_license
require 'secret_diary' describe SecretDiary do describe '#add_entry' do it "should throw an error when the diary is locked" do secret_diary = SecretDiary.new expect(secret_diary.add_entry("text")).to eq("Diary is locked") end it "should add an entry whilst the diary is unlocked" do secr...
true
9921c76655c3715d89313de313706817c034e8b2
Ruby
techthumb/http_stub
/spec/lib/http_stub/models/stub_parameters_spec.rb
UTF-8
2,478
2.5625
3
[]
no_license
describe HttpStub::Models::StubParameters do let(:request_parameters) { double("RequestParameters") } let(:request) { double("HttpRequest", params: request_parameters) } let(:stubbed_parameters) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } } let(:regexpable_stubbed_paremeters) { double(Htt...
true
a5ca30becacb89f82e36d7662b2ae2a9577616bf
Ruby
breeshiaturner/Inventory
/wednesday_morning.rb
UTF-8
224
3.71875
4
[]
no_license
def greeting message = "Hello #{@user_name}, it is very #{@weather} this morning." return message end puts "What is your name?" @user_name = gets.chomp puts "How is the weather today?" @weather = gets.chomp puts greeting
true
a442cf2f3954039449fb0c0ee8c8a3a1c44df225
Ruby
afas/cr
/app/models/remote_type.rb
UTF-8
687
3.03125
3
[]
no_license
# encoding: utf-8 class RemoteType attr_accessor :name attr_accessor :cut attr_accessor :code def self.collection [ RemoteType.new(:name => 'Пешком', :cut => 0, :code => "п"), RemoteType.new(:name => 'Общественным транспортом', :cut => 1, :code => "т") ] end def initialize(hash) ...
true
025d8cac970b09fddd737f74f349a0ff36ad8725
Ruby
tryppr/web_app
/app/models/tryppr_route.rb
UTF-8
1,862
2.84375
3
[]
no_license
class TrypprRoute attr_accessor :start_location, :end_location, :places def puzzle_route schedule = facilitate_places morning_points = get_route(schedule[:morning_places], start_location, schedule[:midday_places][0].position)['routes'][0]['overview_polyline']['points'] midday_points = get_route(schedul...
true
4192da339f896c6de248838603d7ff3837fa7abe
Ruby
JeremyOttley/ruby-learn
/do-every.rb
UTF-8
102
3.171875
3
[]
no_license
def interval(seconds) loop do sleep(seconds) yield end end interval(2) { puts "Hello!" }
true
3fa82083a7f4b906a79f1b98660dbdd86fa717e0
Ruby
crayray/forms-and-basic-associations-rails-lab-austin-web-102819
/app/controllers/songs_controller.rb
UTF-8
1,852
2.578125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class SongsController < ApplicationController def index @songs = Song.all end def show @song = Song.find(params[:id]) end def new @song = Song.new # Build 3 "empty" notes that are automatically set up with the correct # parameter names to be used by accepts_nested_attributes_for # Se...
true
ba45c6091277f250ff5e2b63c2e0e24f074cadc6
Ruby
Duncan-Britt/Merge-Sort
/lib/main.rb
UTF-8
635
3.640625
4
[]
no_license
def merge(arr1, arr2) new = [] i = 0 j = 0 while i < arr1.length && j < arr2.length if arr1[i] < arr2[j] new << arr1[i] i += 1 else new << arr2[j] j += 1 end break if arr1[i].nil? || arr2[j].nil? end if i < arr1.length until i == arr1.length new << arr1[i] ...
true
da730d5b593c65d4b34a9b06adc92932127b16e1
Ruby
HackGT/catalyst2018-website
/.travis.d/pr_autodeploy.rb
UTF-8
3,293
2.53125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'git' require 'octokit' TR_PR_BRANCH = ENV['TRAVIS_PULL_REQUEST_BRANCH'] GH_TOKEN = ENV['GH_TOKEN'] ORG_NAME = ENV['ORG_NAME'] || 'HackGT' GIT_NAME = ENV['GIT_NAME'] || 'HackGBot' GIT_EMAIL = ENV['GIT_EMAIL'] || 'thehackgt@gmail.com' def commit_to_biodomes path = Dir.mktmpdir ...
true
a027ff76f236df6462d1b6ecf39380af7a6d9010
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/gigasecond/3cd88e4c921142ebb0d90b70ac94feab.rb
UTF-8
230
2.921875
3
[]
no_license
require 'date' require 'time' class Gigasecond def self.from(begin_date) #convert to datetime begin_datetime = Time.new(begin_date.year, begin_date.month, begin_date.day) return (begin_datetime + (10**9)).to_date end end
true
45dfec89b9f0a8365980bc368c2bf27722d35640
Ruby
iulia-chitan/bitmap-editor
/cell_spec.rb
UTF-8
1,481
3.1875
3
[]
no_license
require 'rspec' require_relative 'cell' require_relative 'image' describe Cell do (1..5).each do |k| it 'should raise error if param string is not correct' do expect{ Cell.new(k)}.to raise_error(RuntimeError, 'Please insert correct value for this cell') end end ('A'..'Z').each do |k| it 'sho...
true
e5e923733e113883f96349f4a5e042efb29fea79
Ruby
LaunchPadLab/decanter
/spec/decanter/parser/pass_parser_spec.rb
UTF-8
786
2.578125
3
[ "MIT" ]
permissive
require 'spec_helper' describe 'PassParser' do let(:name) { :foo } let(:parser) { Decanter::Parser::PassParser } describe '#parse' do it 'lets anything through' do expect(parser.parse(name, '(12)2-21/19.90')).to match({name =>'(12)2-21/19.90'}) end context 'with empty string' do it 'r...
true
1161fd5f2432641560f43516ccae2740e8db00b5
Ruby
minad/rack-contrib
/lib/rack/contrib/rewrite.rb
UTF-8
1,680
2.734375
3
[ "MIT" ]
permissive
require 'cgi' module Rack # Rack::Rewrite rewrites absolute paths to another base. # If you have an application for / which you want to install under /~user/app # then you can use this middleware. # You have to specify the base as option. class Rewrite def initialize(app, options={}) raise Argume...
true
228f51ce2dfc59c42d0772939813f6b36b6e0481
Ruby
whatalnk/cpsubmissions
/atcoder/ruby/arc004/arc004_1/2120036.rb
UTF-8
580
3.328125
3
[]
no_license
# Contest ID: arc004 # Problem ID: arc004_1 ( https://atcoder.jp/contests/arc004/tasks/arc004_1 ) # Title: A. 2点間距離の最大値 ( The longest distance ) # Language: Ruby (2.3.3) # Submitted: 2018-02-21 07:43:04 +0000 UTC ( https://atcoder.jp/contests/arc004/submissions/2120036 ) N = gets.chomp.to_i points = [] N.times do x...
true
980848522a836ad841a8fc0887f2e27a78e75fea
Ruby
the-guitarman/brunch_finden
/app/models/forwarding.rb
UTF-8
3,531
2.875
3
[]
no_license
class Forwarding < ActiveRecord::Base @@update_last_use_at_on_find_enabled = true # VALIDATIONS ---------------------------------------------------------------- validates_presence_of :source_url, :destination_url validates_uniqueness_of :source_url # CALLBACKS ---------------------------------------------...
true
a4f988b3ce07cac58ee39b1fb72823b805a60c14
Ruby
vtomyev/learn-ruby-the-hard-way
/ex22.rb
UTF-8
579
3.671875
4
[]
no_license
# - is called hash and is used to comment or can be used in #{} to evaluate an expression in a string + used to add = used to assign variables - subtract * multiply / divide % modulus return - returns output from a function def - define function end - ends function puts - prints out a string on a new line print - prins...
true
6ed9348aeebc108fe7dbab58acb220b88ea7e97c
Ruby
davidruizrodri/code_kata
/spec/integration/chop.rb
UTF-8
1,604
2.84375
3
[]
no_license
require 'spec_helper' describe Chop::Base do subject { Chop::Base } context 'with an empty sorted array' do it 'indicates item not found' do expect( subject.recursive_find(1, []) ).to be -1 expect( subject.iterative_find(1, []) ).to be -1 end end context 'with search target in the middle ...
true
a568384e12629773bcaa50b6a4baafd102540817
Ruby
Ramoin/exos
/exo_16.rb
UTF-8
120
3.1875
3
[]
no_license
puts "Quel age as-tu ?" print ">" age = gets.chomp.to_i age.times do |i| puts "Il y a #{i}ans, tu avais #{age-i}" end
true
59b84d5c6c230b69e1729b9edbf1feee79ce3efa
Ruby
jackrobbins1/the-bachelor-todo-chicago-web-career-040119
/lib/bachelor.rb
UTF-8
1,453
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" js_hash = JSON.parse(File.read('spec/fixtures/contestants.json')) def get_first_name_of_season_winner(data, season) data.each { |seazon, contests| if seazon == season contests.each { |contest| name = contest["name"].split(" ") return name[0] } else next en...
true
b491bf55a555f5d28efa05a4b6ba3a5836b5d4fa
Ruby
vidoseaver/black_thursday
/lib/invoice_item_repository.rb
UTF-8
983
2.90625
3
[]
no_license
require_relative "../lib/invoice_item" require "csv" require 'pry' class InvoiceItemRepository attr_reader :all def initialize(data_path, sales_engine = nil) @sales_engine = sales_engine @all = [] csv_loader(data_path) item_maker end def csv_loader(data_path) @csv = CSV.open data_path, head...
true
91c47253ce8d9bb22406c4e3325bc45868635bf0
Ruby
shwe-yuji/atcoder
/keyence2020.rb
UTF-8
453
3.46875
3
[]
no_license
# #問題1 # h = gets.to_i # w = gets.to_i # n = gets.to_i # if n % [h, w].max > 0 # puts n / [h, w].max + 1 # else # puts n / [h, w].max # end # #問題2 # n = gets.to_i # range = [] # for i in 1..n # rob = gets.split(" ").map(&:to_i) # r = [rob[0] - rob[1], rob[0] + rob[1]] # range << r # end # range.sort! # ctn ...
true
500687b9a426fc64f0d2aa6f2ec80927896cada4
Ruby
orta/ortacasts
/tests.rb
UTF-8
863
2.84375
3
[]
no_license
require File.dirname(__FILE__) + '/data' require 'cgi' require 'uri' require 'net/http' get_items() links = [] @items.each do |cast| # I want to know all the attributes are set attrs = %w( title sub link description date length) attrs.each do | attribute | puts "no #{attribute} on #{ CGI.unescapeHTML(c...
true
a2c66ba456e6e7a1bbf7352735d14b82d7700fd6
Ruby
rednblack99/bank_tech_test
/spec/transaction_spec.rb
UTF-8
788
2.890625
3
[]
no_license
require 'transaction.rb' describe Transaction do context 'can read the' do subject(:transaction) { described_class.new("01/01/2001", 1000, nil, 1000) } it 'date' do expect(transaction.date).to eq "01/01/2001" end it 'credit' do expect(transaction.credit).to eq 1000 end it 'de...
true
942152597d1f1148355fac821285a52b13b21bbb
Ruby
ngeballe/ls120-lesson2
/election/forecast.rb
UTF-8
1,185
3.765625
4
[]
no_license
class State attr_accessor :name, :clinton, :trump, :lead, :electoral_votes def initialize(row_data) @name = row_data[/[a-z\s]+/i].strip @clinton, @trump, @lead, @electoral_votes = row_data.gsub(name, "").strip.split self.electoral_votes = electoral_votes.to_i # self.clinton = (clinton.to_f) / 100 ...
true
df35f0ec9cf3c8c6e85a1e11d8c9eaffba74a280
Ruby
meisyal/sastrawi-ruby
/spec/stop_word_remover/stop_word_remover_spec.rb
UTF-8
811
2.640625
3
[ "MIT", "CC-BY-NC-SA-3.0" ]
permissive
require 'spec_helper' require 'sastrawi/dictionary/array_dictionary' require 'sastrawi/stop_word_remover/stop_word_remover' module Sastrawi module StopWordRemover describe StopWordRemover do let :words do %w[di ke] end let :array_dictionary do Sastrawi::Dictionary::ArrayDicti...
true
b0f80c3f904270023273b72cc709c43595dcc6c5
Ruby
Gifts/cracklord
/build/travis-before_deploy.rb
UTF-8
1,723
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # This script goes through the current packages on packagecloud and deletes the older ones # if there are more that 2 for a distro. Note that packagecloud differentiates between # the queue and resource server, so that should give us a total of 4 packages per distro. require 'json' require 'pp' r...
true
d736a427ac6de18148da1cdfe57be317bb6b6c8f
Ruby
maurogs/ironhack
/week6/manderley_cast/app/models/vote.rb
UTF-8
646
2.65625
3
[]
no_license
class Vote < ActiveRecord::Base belongs_to :movie belongs_to :user enum rating: {disliked: -1, liked: 1, not_voted: 0} scope :likes, ->() { liked } scope :dislikes, ->() { disliked } scope :user, ->(user) { where user: user} scope :movie, ->(movie) { where movie: movie} def liked self.rating = :...
true
56fec619a53434f43616d8616c4f6c09995cbc7d
Ruby
luisguzman02/body-mass
/app/interactors/body_mass_index.rb
UTF-8
1,151
3
3
[]
no_license
class BodyMassIndex include Interactor before :valid_params? CATEGORIES = { 0...15 => 'Very severely underweight', 15...16 => 'Severely underweight', 16...18.5 => 'Underweight', 18.5...25 => 'Normal (healthy weight)', 25...30 => 'Overweight', 30...35 => 'Obese Class I (Moderately obese)'...
true
0e721c7445c6e0e8db2e2903b9c89d88e25aa466
Ruby
ctoneal/cs_sln_graph
/lib/vsfile_reader.rb
UTF-8
1,585
2.703125
3
[ "MIT" ]
permissive
require File.expand_path(File.join(File.dirname(__FILE__), "project.rb")) require 'rexml/document' class VSFile_Reader # get a list of projects from the solution file def self.read_sln(path) lines = [] projects = [] file = File.open(path) { |f| f.read } file.each_line do |line| match_data = line.match(/^\...
true
0e2b12a0ba8175bfe903032121d2da72b15d3c5a
Ruby
Andrz16/programacion_ruby_1
/examen_final/ejercicio_01.rb
UTF-8
1,292
4.28125
4
[]
no_license
#Pregunta 1 #Escriba una clase llamada Proceso, que contenga un método que haga lo siguiente: #El método recibirá una cadena. Suponga que "#" es como un retroceso en la cadena. #Esto significa que la cadena "a#bc#d#" en realidad es "bd". Su tarea es procesar la cadena con símbolos "#" #Ejemplos: #"abc#d#d##c" ==> "ac...
true
4fc0e507a6cd3db4dae42f773ec56d5ac91272b5
Ruby
rob4lderman/ruby-euler
/PrimeSet.rb
UTF-8
3,504
3.953125
4
[]
no_license
# # # Methods for calculating, caching, and iterating thru prime numbers. # # Note: not thread safe. # # class PrimeSet @@primes = [2, 3, 5, 7, 11, 13, 17, 19] def initialize @i = 0 end def doUntil(max) p = nextPrime while (p <= max) yield(p) p = ne...
true
6d41297b34ea6b52964d982bb108710f4be56e6c
Ruby
devdame/craigslist-jr
/app/helpers/helper.rb
UTF-8
59
2.921875
3
[]
no_license
def to_money(cents) "$" << cents.to_s.insert(-3, '.') end
true
f045bc5fe9ac725512a718775eef9aa8b0bf4969
Ruby
ericovinicosta/pdti-ruby-respostas-exercicio05
/resposta08.rb
UTF-8
324
3.859375
4
[]
no_license
=begin Faça uma função que informe a quantidade de dígitos de um determinado número inteiro informado. =end def quantidade_digitos (numero) valor_numero = numero.to_s valor_numero.length end print "Entre com um numero inteiro: " numeros = gets.to_i puts "A quantidade de digitos é: #{quantidade_digitos numeros}"
true
7ba3acdede6a0d495194ee62c6e25b3f223a5a87
Ruby
nyc-cicadas-2015/zip
/source/deck.rb
UTF-8
277
2.90625
3
[]
no_license
require_relative 'card' require_relative 'parser' class Deck attr_reader :deck def initialize(deck) @deck = [] # @still_left_in_deck = deck end def shuffle flash_deck = @deck.shuffle! flash_deck.pop end def empty? @deck.empty? end end
true
8bf866159e6dfc14aa8d3c13e60784340e9cb8fa
Ruby
MayccSuarez/Ruby
/plural.rb
UTF-8
170
3.5
4
[]
no_license
def plural palabra "#{palabra}s" end plural "carro" # agregar un método a una clase de ruby class String def mi_plural "#{self}s" end end puts "carro".mi_plural
true
63174175508dc452ca61c0f20ee5e2d44bd1e895
Ruby
noidontdig/nyu-cs-prototype
/scripts/table_p.rb
UTF-8
938
2.859375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'rubygems' File.open("/Users/Ali/Desktop/table.txt", "r") do |file| linetype = 1; file.lines.each do |line| fixed_line = line.strip; if line.strip[0..2] != "<tr" and line.strip[0..3] != "</tr" if linetype == 8 linetype = 1 end case linetype when 7...
true
278f23ba7b89913c9e2df9ca96f875e04c32e37e
Ruby
ROCHAAL/Take_a_ten_minute_walk-
/spec/take_a_ten_minute_walk_spec.rb
UTF-8
1,059
3.1875
3
[]
no_license
require 'take_a_ten_minute_walk' describe 'ten_minute_walk' do it 'takes an assortment of directions with the letters n, s, e, or w and return false if there are less than 10 minutes walk.'do walk = ten_minute_walk?(['w', 's']) expect(walk).to eq(false) end it 'takes an assortment of directions wi...
true
c7159b89153a2bd0f072e8456bbd2b3a71eb1a20
Ruby
BrunaRosa/udemy-Ruby_studies
/ruby_basico/12-hashes.rb
UTF-8
440
3.5
4
[]
no_license
# frozen_string_literal: true # Hashes - informo a chave e o valor h = { 'a' => '123', 'b' => '456' } puts h['b'] # ou vc pode usar da forma de baixo h = { a: '123', b: '456' } puts h[:b] # Simbolos são strings estaticas, o object_id não muda puts 'string'.object_id # vem com valor diferente puts 'string'.object_i...
true
9992711ccf6597a305cbf4e90afee45c00e57372
Ruby
toxic2302/railsHoursAccounting
/app/helpers/workdays_helper.rb
UTF-8
353
3.109375
3
[ "MIT" ]
permissive
module WorkdaysHelper # get the working hours for an workday in hh:mm def get_working_hours workday workday.workingHours/60/60/24 end # get the total working hours per month def get_total_working_hours workdays result = 0 workdays.each do |workday| result = result + get_working_hours(workd...
true
ebc93fb1ed830a5f64ef073a09e885a4e137bff9
Ruby
BaxmypkaVlad/Baxmypka
/Exampleprivateclass.rb
UTF-8
466
3.6875
4
[]
no_license
class Animal def initialize name @name=name end def jump puts "#{@name.capitalize} jumping" end def run eat 10.times do sleep 1 print "." end puts "\n#{@name.capitalize} is running" end private ##тут приватные методы которые вызвать нельзя отдельно de...
true
b354b4a604aa9024666f489c2142e4b57f0f2b7c
Ruby
aghos7/batch_geocode
/batch_geocode.rb
UTF-8
13,092
2.625
3
[]
no_license
#!/usr/bin/env ruby require 'csv' require 'date' require 'yaml' require 'geocoder' # require 'byebug' require 'optparse' require 'active_support/all' require_relative 'wiw' SEPARATOR = "," # helper functions def header(hash) hash.keys.join SEPARATOR end def to_csv(hash) hash.values.map do |value| escape valu...
true
5241e4dd88d833ade366db8e128c52e2631efdcf
Ruby
amhursh/black_thursday
/test/item_test.rb
UTF-8
4,094
2.71875
3
[]
no_license
require_relative 'test_helper' require_relative '../lib/item' require_relative '../lib/sales_engine' class ItemTest < Minitest::Test def test_item_exists item = Item.new({:id => 263399187, :name => "Spalted Maple Heart Box", :description => "spalted maple wood USA, handmade", :unit_price => 4800, :m...
true
062bdd89c9982fb38894fff831041ebe416646fd
Ruby
FHG-IMW/epo-ops
/test/epo_ops/util_test.rb
UTF-8
1,062
2.65625
3
[ "MIT" ]
permissive
require 'test_helper' module EpoOps class UtilTest < Minitest::Test # dig def test_traverse_the_path_and_return_a_single_result data = {foo: {bar: {baz: 'foobarbaz'}}} assert_equal 'foobarbaz', EpoOps::Util.dig(data,:foo,:bar,:baz) end def test_return_nil_if_path_does_not_exist da...
true
f2d84384fec61a11b39823509e5e8ddca23bdde2
Ruby
Madao-3/LeetCode_Madao
/500. Keyboard Row .rb
UTF-8
144
3.046875
3
[]
no_license
# @param {String[]} words # @return {String[]} def find_words(words) words.select { |w| w =~ /^([qwertyuiop]*|[asdfghjkl]*|[zxcvbnm]*)$/i } end
true
e2db8e7e45d2eb458c65363afef6e5510d2c10c3
Ruby
games-directory/steam-api
/lib/steam-api/steam/user.rb
UTF-8
3,673
2.65625
3
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- module Steam # A Ruby DSL for communicating with the Steam::User Web API. # @see https://developer.valvesoftware.com/wiki/Steam_Web_API # @since 1.0.0 module User # Get User's Friend List # @param [String] steamid # @param [String] relationship Relationship filter. # ...
true
b4749773eae725097e9b1e60057f4c3c7e10ca31
Ruby
taw/project-euler
/euler_57.rb
UTF-8
175
2.765625
3
[]
no_license
#!/usr/bin/env ruby1.9 require 'mathn' a = 2 c = 0 999.times{|i| b = 1+1/a a = 2+1/a if b.numerator.to_s.size > b.denominator.to_s.size c += 1 p b end } p c
true
35b0b59a41effb233278e30051199fc8dd4a928b
Ruby
wowonrails/csv-file-manager
/lib/csv_file_manager.rb
UTF-8
694
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "csv" require "csv_file_manager/file_manager" require "csv_file_manager/file_redactor" require "csv_file_manager/instance_properties" require "csv_file_manager/base_methods" # Dir[File.dirname(__FILE__).concat('/**/*.rb')].each { |path| require path } module CsvFileManager def...
true
0afe2bb5d5a5f10a6bb879a71acd9ec300e69580
Ruby
CJStadler/state_machine_checker
/spec/machines/simple_machine.rb
UTF-8
476
3.03125
3
[ "MIT" ]
permissive
require "state_machines" require "./lib/state_machine_checker/finite_state_machine.rb" require "./lib/state_machine_checker/transition.rb" class SimpleMachine # Our internal representation of the state machine. def self.finite_state_machine StateMachineChecker::FiniteStateMachine.new( :one, [StateM...
true
8817d7c538bced6f7a0c11c93ce1da3a234c98bb
Ruby
hiimchinh/rb101
/easy_4/convert_a_string_to_a_signed_number.rb
UTF-8
663
3.96875
4
[]
no_license
DIGITS = { '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9 } def string_to_integer(string) digits = string.chars.map { |char| DIGITS[char] } total = 0 index = 1 string.chars.reverse.each do |char| number = DIGITS[char] total += numb...
true
87e9fc67957d90f465a958bfa90059830ed700e9
Ruby
security-prince/websitesVulnerableToSSTI
/ruby/ERB/src/web.rb
UTF-8
763
2.796875
3
[ "Apache-2.0" ]
permissive
require "sinatra" require 'erb' set :port,5081 set :bind, '0.0.0.0' def getHTML(name) correct_form = <<-slim <html> head title Example <body> <p><%= name %></p> </body> </html> slim text = '<!DOCTYPE html><html><body> <form action="/" method="po...
true
3803d97869665bbf59d4af1179b33860fd2a1129
Ruby
kbkbqiang/reverse_adoc
/lib/reverse_adoc/converters/h.rb
UTF-8
1,001
2.515625
3
[ "BSD-2-Clause" ]
permissive
module ReverseAdoc module Converters class H < Base def convert(node, state = {}) id = node['id'] anchor = id ? "[[#{id}]]" : "" internal_anchor = treat_children_anchors(node, state) || "" anchor.empty? and anchor = internal_anchor anchor.empty? or anchor += "\n" ...
true
42ba40e25392a45e2f6e545fcbeb15823668bdef
Ruby
derailed/wewoo
/spec/wewoo/edge_spec.rb
UTF-8
946
2.5625
3
[ "MIT" ]
permissive
require 'spec_helper' module Wewoo describe Vertex do before :all do @g = Graph.new(:test_graph) build_test_graph( @g ) end context 'equality' do it 'validates two egdes are the same' do expect( @v1.outE(:love) == @v1.outE(:love) ).to eq true end it 'validates two ...
true
ea34363beb98729c34a2f928bd7aec1685273af1
Ruby
wilkerlucio/dragonfly
/spec/dragonfly/extended_temp_object_spec.rb
UTF-8
3,037
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.dirname(__FILE__) + '/../spec_helper' describe Dragonfly::ExtendedTempObject do it "should raise an error if not configured with an app" do temp_object = Dragonfly::ExtendedTempObject.new('asdf') lambda{ temp_object.process(:dummy) }.should raise_error(Dragonfly::ExtendedTempObject:...
true
6c5628c655d4b99a0ecd9f026709a3bf59fc6f38
Ruby
nyc-island-foxes-2016/apartments-live-code
/rentable.rb
UTF-8
235
2.8125
3
[]
no_license
module Rentable def rent (self.number_of_bedrooms * 250) + (self.number_of_bathrooms * 100) + (self.square_feet * 75) end def book_occupant self.rented = true end def evict_occupant self.rented = false end end
true
0b6083a003a90f49f8df7d6af534e40d603d88d5
Ruby
Razultull/cpsc415
/CrossFit/db/seeds.rb
UTF-8
1,444
2.5625
3
[]
no_license
#--- # Excerpted from "Agile Web Development with Rails", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # ...
true
21dae5f8a23a4d6d8f2a97dd7c1a1e837076ed27
Ruby
CoopTang/battleship
/test/board_test.rb
UTF-8
4,442
3.484375
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/ship' require './lib/cell' require './lib/board' class BoardTest < MiniTest::Test def setup @cell_A1 = Cell.new("A1") @cell_A2 = Cell.new("A2") @cell_A3 = Cell.new("A3") @cell_A4 = Cell.new("A4") @cell_B1 = Cell.new("B1") @c...
true
40c6c7fab10962dcd2263b1df32294bfa7ee5cdb
Ruby
dupjpr/ruby
/module.rb
UTF-8
543
3.546875
4
[]
no_license
module TextAnalyzer def num_words @body ? @body.split.size : 0 end def num_chars @body ? @body.chars.size : 0 end end class Article attr_reader :body include TextAnalyzer def initialize(body) @body = body end end class Commen...
true
20a10e6589395aa5f7e3c9bb1c8296707dabac02
Ruby
rleber/bun
/lib/bun/bots/main/same_task.rb
UTF-8
2,421
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # -*- encoding: us-ascii -*- desc "same [OPTIONS] TRAITS... FILES...", "Group files which match on a certain criterion" option 'asis', :aliases=>'-a', :type=>'boolean', :desc=>"Do not attempt to decode files" option 'case', :aliases=>'-c', :type=>'boolean', :desc=>"Case insensitive" option 'f...
true
b96bd1c7c7e75c88416c6b913eba22441085262a
Ruby
trizen/sidef
/scripts/RosettaCode/factors_of_an_integers.sf
UTF-8
256
3.125
3
[ "Artistic-2.0" ]
permissive
#!/usr/bin/ruby # ## http://rosettacode.org/wiki/Factors_of_an_integer # func factors(n) { gather { { |d| take(d, n//d) if d.divides(n) } << 1..n.isqrt }.sort.uniq }   for n [53, 64, 32766] { say "factors(#{n}): #{factors(n)}" }
true
5938cd2226761de0e93e9b871a9dd4d536575bce
Ruby
wenchonglai/leetcode-practice
/202103/20210312-986-interval-list-intersections.rb
UTF-8
328
3.140625
3
[]
no_license
def interval_intersection(first_list, second_list) arr = [] until first_list.empty? || second_list.empty? s = [first_list[0][0], second_list[0][0]].max e = [first_list[0][1], second_list[0][1]].min (e == first_list[0][1] ? first_list : second_list).shift arr << [s, e] if s <= e end ...
true
1854c2d08cc63af8e6914cc2534a534ee2d55551
Ruby
manonthemat/RubyRace
/race_spec.rb
UTF-8
1,513
3.53125
4
[]
no_license
require './race.rb' describe 'puzzle 1' do it 'should return the second to last word of a decoded base64 string' do expect(first_puzzle('dGhhbmsgeW91IGZvciBhbGwgdGhlIGdyZWVuIGJlYW5pbmc=')).to eq('green') expect(first_puzzle('V2VubiBtYW4ga2VpbmUgQWhudW5nIGhhdCwgZWluZmFjaCBtYWwgZGllIEZyZXNzZSBoYWx0ZW4uLi4='))....
true
210f988a6d1c6d09f3ffb1483002bb6b4c0cb34a
Ruby
AngusGMorrison/data-structures
/ruby/linked_lists/doubly-linked-list/doubly_linked_list.rb
UTF-8
2,434
3.6875
4
[]
no_license
require_relative './node' require_relative './doubly_linked_list_errors' class DoublyLinkedList include DoublyLinkedListErrors attr_reader :head, :tail, :length def initialize @head = nil @tail = nil @length = 0 end def insert(data) # O(1) node = Node.new(data) if @head no...
true
0ab0cd1fc267f448c87348656092113e99ce3079
Ruby
dexterfgo/bcap_bake_my_day
/lib/bake_my_day.rb
UTF-8
912
3.375
3
[ "MIT" ]
permissive
require_relative "bake_my_day/version" require_relative "bake_my_day/item" require_relative "bake_my_day/order" require_relative "bake_my_day/menu" require_relative "bake_my_day/tracer" require_relative "bake_my_day/input" module BakeMyDay Tracer.create(!ARGV.empty?) Tracer.info "Bake My Day v" + BakeMyDay::VERSIO...
true
8c7888fa31b3c333a6e29c6272e2bbdba028a8ec
Ruby
zwaarty/project_euler
/ruby/problem_065.rb
UTF-8
389
3.34375
3
[]
no_license
def e_fraction nth seq = [2] n = 2 k = 1 loop do break if n > nth seq << 1 n += 1 break if n > nth seq << 2 * k n += 1 k += 1 break if n > nth seq << 1 n += 1 end den = seq.reverse t = den.shift.to_r until den.empty? t = den.shift.to_r + 1 / t end t en...
true
027fc64e9bc01db9852381e77185b9a76b2a56c3
Ruby
parterburn/dabble.me
/app/helpers/application_helper.rb
UTF-8
1,288
2.609375
3
[ "MIT" ]
permissive
module ApplicationHelper def title(page_title) content_for(:title) { page_title.to_s } end def yield_or_default(section, default = '') content_for?(section) ? content_for(section) : default end def tag_relative_date(tag_date, entry_date) return "Today" if tag_date == entry_date a = [] a...
true
daf2bbc754cb4bcfecfd93708194a4686e1e4670
Ruby
markshawtoronto/Cracking_the_Coding_Interview
/ruby/app/services/miscellaneous/palindrome.rb
UTF-8
337
3.90625
4
[]
no_license
# Given an array of strings words, return the first palindromic string in the array. If there is no such string, return an empty string "". module Miscellaneous module Palindrome def self.first_palindrome(words) words.each do |w| if w == w.reverse return w end end "" ...
true
e88b401a110d05b3fed133ba69bf291ac1f42270
Ruby
karaebrahim/jfisch
/app/helpers/survivor_entries_helper.rb
UTF-8
20,241
2.796875
3
[]
no_license
module SurvivorEntriesHelper # Displays the currently selected entries for the specified game_type, as well as allows the user # to update the number of selected entries, if the season has not yet begun. def entries_selector(game_type, type_to_entry_map, span_size, before_season) entries_html = "<div class='...
true
7137aaa44fbff00d1799e34d9fafc4ecbf5c28c5
Ruby
benj2240/euler
/Ruby/euler034_tests.rb
UTF-8
199
2.515625
3
[]
no_license
require_relative "euler034.rb" require "test/unit" class Euler034Tests < Test::Unit::TestCase def test_actual expected = 40730 result = euler034 assert_equal expected, result end end
true
fa93475df6eff4e29681d251de1f5a09df1a0dac
Ruby
roryokane/cs283-final-project
/lib/converting.rb
UTF-8
2,132
3.09375
3
[ "MIT" ]
permissive
def convert_bc_to_c(better_c) dumb_implementation(better_c) end def test_implementation(better_c) better_c.chomp.reverse end def dumb_implementation(better_c) lines = better_c.split("\n", -1) # negative second parameter indicates to keep trailing blank lines # add parens around conditionals original_lines = l...
true
213f4be1e16ba5ec8846b87095416f203fd4fe66
Ruby
OndrejKucera/university-assignments
/dpo/dpo1/lib/world.rb
UTF-8
1,757
2.796875
3
[]
no_license
require_relative 'build_world' class World attr_accessor :variables_environment, :hash_rooms def initialize(model) @model = model @hash_rooms = {} # ({'jeskyne' => Room.new('Jeskyně'), 'vychod_jeskyne' => Room.new()}) @variables_environment = {} # ({'presvedcil_jsem_jiz_kneze_aby_mi_otev...
true
fd886de49691b6e079379ddd2d9b5d665aa39a59
Ruby
12ew/alphabetize-in-esperanto-dumbo-web-042318
/lib/alphabetize.rb
UTF-8
354
3.578125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def alphabetize(arr) alphabet = "abcĉdefgĝhĥijĵklmnoprsŝtuŭvz".chars # makes arr of characters # binding.pry arr.sort_by do |sentence| #iterate over arr of sentences sentence.chars.map do |character| alphabet.index(character) # iterate over # each sentence and index ever letter # bi...
true
2f0015aa8e1461ef10687468088f0a2b2f03158c
Ruby
elvamuyi/black_jack
/src/Game.rb
UTF-8
6,549
3.828125
4
[]
no_license
# /src/Game.rb # This file defines the class for a blackjack game. # Usage example: # my_game = Game.new # mygame.get_bet # mygame.round require File.dirname(__FILE__) + "/" + "Dealer.rb" require File.dirname(__FILE__) + "/" + "Player.rb" class Game # Initializing a game. def initialize ...
true
bd4512564bd6cb1f508a964393bbf19960353573
Ruby
joeainsworth/programming_exercises
/Tealeaf Academy - Ruby Exercises Workbook/Advanced/exercise_1.rb
UTF-8
191
3.484375
3
[]
no_license
# What do you expect to happen when the greeting variable is referenced in the # last line of the code below? # A. greeting will return nil if false greeting = "hello world" end greeting
true
0ccad3567fe71d519405696510728ef4379230da
Ruby
educhin/square_array-online-web-sp-000
/square_array.rb
UTF-8
85
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) arr = [] array.each{|num| arr.push(num * num)} arr end
true
b627d4e2fafd343633aa3a1480dd78051a94b785
Ruby
doantuancanh/ruby-exercises
/basic/pt_bac1.rb
UTF-8
252
3.59375
4
[]
no_license
def nhap(ten) puts "Nhap #{ten}" a = gets.chomp.to_i a end def pt_bac1(a, b) if a == 0 puts "Phuong trinh vo so nghiem" else x = -b.to_f / a puts "Phuong trinh co nghiem la: #{x}" end end a = nhap('a') b = nhap('b') pt_bac1(a, b)
true
23bfb466bb8ef11cfdb5026231800ec5cbdccb65
Ruby
helena-bond/sequelize-1
/lib/sequelize/migrator/naming.rb
UTF-8
2,850
2.75
3
[ "MIT" ]
permissive
require 'sequel/model/inflections' module Sequelize class Migrator class Naming include Sequel::Inflections ACTION_REGEXP = /^(create|add|drop|remove|rename|change)_(.*)/.freeze TABLE_DIV_REGEXP = /_(to|from|in)_/.freeze COLUMN_DIV_REGEXP = /_and_/.freeze VIEW_REGEXP = /...
true
6ec7e605a9e91fe5bfe52c90719ad20b5898ca15
Ruby
hammackj/dissector
/lib/dissector/hex_window.rb
UTF-8
9,673
3.109375
3
[]
no_license
# require 'colour_chooser' # require 'field' # require 'hex' # require 'structure' # require 'ncurses' class HexWindow attr_reader :window def initialize(y, x, data, display_only) @hex = Hex.new(data) @y = y @x = x @data = data @display_only = d...
true
b7ebd332f1b612c01ab77e8227eb7ee60ee24705
Ruby
coinbase/geoengineer
/lib/geoengineer/utils/has_lifecycle.rb
UTF-8
1,710
2.609375
3
[ "Apache-2.0" ]
permissive
######################################################################## # HasLifecycle provides methods to enable lifecycle hooks ######################################################################## module HasLifecycle def self.included(base) base.extend(ClassMethods) end # ClassMethods module ClassMe...
true
0526b7693879ca03c2a0467d137a6f2e5b177c2f
Ruby
Anis4300/mini_jeu_POO_anis
/lib/player.rb
UTF-8
1,846
3.71875
4
[]
no_license
class Player attr_accessor :name, :life_points #read & write def initialize(name) @name = name @life_points = 10 end def show_state puts "#{@name} a #{life_points} points de vie." #Etat des PV des joueurs end def gets_damage (damages) @life_points = @life_points - damages #dommages subis if @li...
true