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
25fbf1a6b4fc84c53983006dc27c89b6ed276943
Ruby
gabe1314/Cloudformation-templates
/cfn_nag/lib/model/s3_bucket_policy.rb
UTF-8
507
2.609375
3
[ "MIT" ]
permissive
class S3BucketPolicy attr_accessor :logical_resource_id attr_reader :statements def initialize @statements = [] end def add_statement(statement_hash) statements << statement_hash end def self.condition_includes?(statement, condition_hash) if statement['Condition'].nil? false else...
true
6ab52266c2be4f49adfc29d0ede877e281d7e44d
Ruby
lvamaral/RubyAlgorithms
/Binary Heaps/lib/heap.rb
UTF-8
3,924
3.578125
4
[]
no_license
require 'byebug' class BinaryMinHeap def initialize(&prc) @store = [] @prc = prc || Proc.new { |el1, el2| el1 <=> el2 } end def count @store.count end def extract raise "no element to extract" if count == 0 val = @store[0] if count > 1 @store[0] = @store.pop ...
true
b59d3b781c13541f7dc6c460f228f3f329a88cde
Ruby
montaan/muryu
/lib/future/utils.rb
UTF-8
6,765
2.5625
3
[ "MIT" ]
permissive
begin require 'rubygems' rescue LoadError end require 'cgi' require 'uri' require 'pathname' require 'fileutils' require 'ostruct' require 'json' require 'logger' module Kernel def __log__(message, subsystem = "", level = Logger::INFO) if block_given? begin t0 = Time.new ret = yield mes...
true
df35fd6aaaa1af81996b3a5eac05ae4ef01b54f8
Ruby
huynhrichy/miwc
/04/my_web_app.rb
UTF-8
817
2.828125
3
[]
no_license
require 'sinatra' require 'erb' require_relative 'twitter_wrapper' # replace YOUR_PORT with your personal port set :port, 5179 # allow external access (e.g. you can access from http://students.codein10weeks.com:YOUR_PORT) set :bind, '0.0.0.0' set :server, 'webrick' get '/' do my_tweeter = TwitterWrapper.new("Z...
true
bcdcabe047a78ee4422f24beba1efcd44356e702
Ruby
kaaninan/Robotext-1
/Yazilim/Ruby/arduino.rb
UTF-8
6,863
2.8125
3
[]
no_license
require 'rubygems' require 'arduino_firmata' require 'serialport' require 'pp' $LOAD_PATH << '.' require 'log' require 'sensor' require 'pin' require 'gonder' class Arduino_Self #LOG $konum = 'Arduino_Self' @bagli_uno = false @bagli_mega = false # MEGA'YA GONDERILEN attr_accessor :deger_buzzer, :deg...
true
fe6e03ab3f7de9ad00a37d5d61b3a8bd7348bc10
Ruby
cbandy/libuuidrb
/spec/uuid_spec.rb
UTF-8
3,074
2.6875
3
[ "MIT" ]
permissive
require 'lib_uuid' module LibUUID describe UUID do def bytes(hex) [hex.gsub('-','')].pack('H*') end let(:base64url) { /\A[-\w]{22}\z/ } let(:canonical) { /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i } let(:uuid_v1) { '6a9622b8-a422-11e3-be40-425861b86ab6' } let(...
true
d4fc0b8c4c14af9c52ba153796e18f457a8d4a9b
Ruby
skp11194/ADAGE
/script/calc_tenacity_breath_cycle.rb
UTF-8
7,491
2.578125
3
[ "BSD-3-Clause" ]
permissive
require 'csv' def mean(array) array.inject(0) { |sum, x| sum += x } / array.size.to_f end def mean_and_standard_deviation(array) m = mean(array) variance = array.inject(0) { |variance, x| variance += (x - m) ** 2 } return [m, Math.sqrt(variance/(array.size-1))] end #ids = AdaData.with_game('Tenacity-Meditat...
true
47cf4d52a48c45e8656a81411519ad7cdf886181
Ruby
docljn/advent2019
/lib/grid.rb
UTF-8
960
3.53125
4
[ "MIT" ]
permissive
# frozen_string_literal: true class Grid attr_reader :wire1, :wire2 def initialize(wire1, wire2) @wire1 = wire1 @wire2 = wire2 end def intersections crossing_points = wire1.points & wire2.points crossing_points.delete([0,0]) crossing_points end def manhattan_distance return if i...
true
cc35840651868b38493fd45d4db14a6e32284c30
Ruby
dcrawsh/reverse-each-word-online-web-pt-081219
/reverse_each_word.rb
UTF-8
164
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
sentence="i like to eat lots of cake" def reverse_each_word(sentence) sentence.split.collect {|word| word.reverse}.join(" ") end puts reverse_each_word(sentence)
true
db1cf2ebe626766e66643ac51c87421202cd9e62
Ruby
dcutting/strut
/lib/strut/scenario_builder.rb
UTF-8
4,969
2.828125
3
[ "MIT" ]
permissive
module Strut class ScenarioBuilder def initialize(document_builder, command_factory) @document_builder = document_builder @command_factory = command_factory end def extract_scenarios_for_interaction(scenario_number, interaction, fixture, node) instance = "instance-#{scenario_number}" ...
true
8dedad55af29ddc250ad874789fd8186c367793f
Ruby
hannesg/humanized
/spec/wrapper_spec.rb
UTF-8
2,537
2.890625
3
[]
no_license
# -*- encoding : utf-8 -*- # This program is free software: you can redistribute it and/or modify # it under the terms of the Affero GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is dis...
true
7be3f8cbb28dbd260cc10997954ba40cbcfc4bfd
Ruby
TwP/bitwise
/lib/bitwise/fields/pad_field.rb
UTF-8
1,428
2.828125
3
[ "MIT" ]
permissive
# $Id$ require 'bitwise/packet' module BitWise class PadField < Field # call-seq: # PadField.new( ) # def initialize( *args ) super @description, @name = @name.to_s, nil @setter, @getter = :pad=, :pad @opts[:unique] = false end # call-seq: # describe( :offset ...
true
5391b9cecb73367931dd37562c59564f4ea99b07
Ruby
wendyburger/Introduction-to-Programming
/loop/loop_homework.rb
UTF-8
138
3.25
3
[]
no_license
ans = " " while ans != 'STOP' puts "How are you today" x = gets.chomp puts "Do you want to say it again" ans = gets.chomp end
true
224d93be814a9c00db22c2b5bbfe86453b782dac
Ruby
geni-gimi/GIMI
/gimiInit/gimiREST.rb
UTF-8
2,680
2.625
3
[]
no_license
require 'rest_client' require 'json' require 'base64' require 'uuidtools' class RESTs def initialize(restURL, restPort,user_name, proj_name, exp_name, irods_path, itkt_valid, slice_name, manifest) @restURL = restURL @restPort = restPort @proj_name = proj_name @user_name = user_name ...
true
264e4615d883c4356fad404330927b3527839550
Ruby
blarxfj/prime-ruby-cb-gh-000
/prime.rb
UTF-8
177
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Add code here! def prime?(number) if number <= 2 return false else (2..number-1).to_a.each { |e| return false if number%e==0 } end return true end prime?(4)
true
5db40bb1dcfa44612cb3335f2bcac327f0058c55
Ruby
suxiaohun/xiaopang
/leetcode/1624.length_of_same_str.rb
UTF-8
435
3.46875
3
[ "MIT" ]
permissive
# @param {String} s # @return {Integer} def max_length_between_equal_characters(s) _hash = {} lens = [-1] s.size.times do |i| if _hash[s[i]] lens << (i - _hash[s[i]] - 1) next end _hash[s[i]] = i end lens.max end # 计算两个相同字符之间的字符最大长度,长度不包含两个字符本身 # 注意点:中间的字符也可以相同,起始点永远是字符第一次出现的位置
true
39cc75d2f4062dddc7e763fe7b63cb572f2247da
Ruby
Matevito/Basic-ruby-proyects
/mastermind/human.rb
UTF-8
448
3.59375
4
[]
no_license
# human.rb / human_player methods require_relative 'game_methods' class Human_player < Mastermind attr_reader :name def initialize(name) @name = name end def take_a_guess puts "#{@name}, what is your guess?" puts 'digit a combination of 4 numbers using digits from 1-6: ' guess = gets.chomp ...
true
53c02b44c23b3d26802fe87ba38ce2d3027cfeab
Ruby
hernanat/fizzbuzz-overkill
/fizzbuzz_generalized.rb
UTF-8
3,010
3.625
4
[]
no_license
require "prime" module FizzbuzzGeneralized # these methods assume the keys of the `factors` hashes are sorted. # I wanted to avoid adding additional sort overhead. # If you pass in unsorted keys, it will still work, but the words will be # out of order # # there's overhead from constructing the relevant st...
true
a9eb9d379d0d07671acbe5fe15a3ee27896b1df3
Ruby
VerizaWalter/scrapping
/lib/crypto.rb
UTF-8
778
3.0625
3
[]
no_license
require 'rubygems' require 'nokogiri' require 'open-uri' def get_page page = Nokogiri::HTML(open("https://coinmarketcap.com/all/views/all/")) return page end def scrapp_symbols page = get_page symbols = page.xpath('//*[@class="text-left col-symbol"]') symbols_array = [] symbols.each do |symbol| symbols_arr...
true
ce20fa6800f0f262a29319a25042d15798303c9b
Ruby
jr1412594/programming-univbasics-nds-nested-arrays-iteration-lab-part-2-den01-seng-ft-091420
/lib/iteration_with_loops.rb
UTF-8
393
2.96875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_min_in_nested_arrays(src) low_results = [] row_index = 0 while row_index < src.count do element_index = 0 low_temp = 150 while element_index < src[row_index].count do if low_temp > src[row_index][element_index] low_temp = src[row_index][element_index] end element_index += 1 end ...
true
0feaad8572e72d8a8b07dfc221a153fb49ec7a71
Ruby
Belgiets/lesson2
/ball.rb
UTF-8
342
3.546875
4
[]
no_license
require 'yaml' class Ball ANSWERS = YAML.load_file('answers.yml') def color(number) case number when 0..4 then 31 when 5..9 then 32 when 10..14 then 33 when 15..19 then 34 end end def shake number = rand(ANSWERS.size) puts "\e[#{color(number)}m#{ANSWERS[number]}\e[0m" ANSW...
true
6e3b80f39f58a57ab0dffcd6da7c73eb23470e36
Ruby
nmartinez23/interview_prep
/Ruby/digits_in_order.rb
UTF-8
410
3.859375
4
[]
no_license
# Given a non-negative integer, return an array of the digits in order. def digitize(numbers) arr = [] numbers.to_s.split('').each do |num| arr << num.to_i if num.to_i >= 0 end arr.sort() End def digitize(numbers) arr = [] result = numbers.to_s.split('') result.each do |num| if num.to_i >=...
true
c7867fedf85a6c0f88d54936ce02fa3fb25de60e
Ruby
rciorba/misc
/bin/cleanup.rb
UTF-8
2,018
2.921875
3
[ "Unlicense" ]
permissive
#!/usr/bin/env ruby require "rubygems" require "optparse" require "date" options = {} optparse = OptionParser.new do|opts| opts.banner = "Usage: prune-branches.rb PATH_TO_REPO [OPTIONS]" options[:age] = 14 opts.on('-a', '--age DAYS', 'Age in days of last commit on branch. Defaults to 14.' ) do|age| options...
true
878963c4edfd6b409a91e46e584d52402f5a70a4
Ruby
gitvar/misc
/Live Lessons/Part 4/Lesson-4_string_reverser.rb
UTF-8
220
3.96875
4
[]
no_license
# Lesson_4_string_reverser.Ruby def reverse(string) string.split("").reverse.join end my_string = "Hello World!" puts "The string #{my_string} in reverse order looks like this: #{reverse(my_string)}" puts my_string
true
3ae90cd6b611c0e3fa5c5bccdaeb8c66ec0306e2
Ruby
tklow94/ruby-oo-object-relationships-kickstarter-lab-sea01-seng-ft-042020
/lib/project.rb
UTF-8
311
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Project attr_reader :title def initialize (title) @title = title end def add_backer(backer) ProjectBacker.new(self, backer) end def find_backers ProjectBacker.all.select {|backer| backer.project == self} end def backers find_backers.map {|backer| backer.backer} end end
true
ae2c8170af288de846be8d488d9c1963e867efcd
Ruby
jtprince/learning_suite
/lib/learning_suite/gradebook.rb
UTF-8
6,698
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'csv' require 'date' require 'yaml' require 'set' require 'learning_suite/iclicker' require 'learning_suite/gradebook/student' require 'learning_suite/grades' module LearningSuite # NOTE: when you export scores, make sure to also check 'Points'!!!! # (this should be in addition to Percent) class Gradeb...
true
c9bc69cd6612029e1899f0b10b305b5f4dd38517
Ruby
ksolkowski/automatic-client
/lib/automatic/client/location.rb
UTF-8
747
2.859375
3
[ "MIT" ]
permissive
module Automatic module Client class Location include Comparable def initialize(attributes={}) @attributes = attributes end def <=>(other) (self.lat <=> other.lat) | (self.lon <=> other.lon) end def name @attributes.fetch('name', nil) end ...
true
57ba0ea2224391cf7a2e79a950249cbe183fcfee
Ruby
perryhau/waterflowseast
/app/abilities/collecting_relationship_ability.rb
UTF-8
1,027
2.609375
3
[ "MIT" ]
permissive
class CollectingRelationshipAbility attr_reader :current_user, :collecting_relationship def initialize(current_user, collecting_relationship) @current_user = current_user @collecting_relationship = collecting_relationship end def create? points_cost = POINTS_CONFIG['collect'].abs return Abilit...
true
ecd4ab325756860ecdcb8bb2fcc64b47d42c0c6f
Ruby
jk1dd/flashcards
/lib/round.rb
UTF-8
1,189
3.71875
4
[]
no_license
require 'pry' require_relative 'deck' class Round attr_reader :deck attr_accessor :guesses, :correct_count def initialize(deck) @deck = deck @guesses = [] @correct_count = 0 end def current_card @current_card = @deck.cards[guesses.count] end def record_guess(guess) ...
true
cac857ccc75250f038d78260c165f4d16292a5e2
Ruby
LaunchPadLab/decanter
/lib/decanter/parser/string_parser.rb
UTF-8
306
2.546875
3
[ "MIT" ]
permissive
module Decanter module Parser class StringParser < ValueParser parser do |val, options| raise Decanter::ParseError.new 'Expects a single value' if val.is_a? Array next if (val.nil? || val === '') next val if val.is_a? String val.to_s end end end end
true
5d1333954574cfe5dbda16c873c83a959d7bdc69
Ruby
chengyuanheng/xmolexam
/lib/tasks/insert_test_question.rake
UTF-8
1,342
2.515625
3
[]
no_license
# encoding: utf-8 #bundle exec rake db:drop db:create db:migrate xmnewcrm:load db:init db:seed insert:user --trace namespace :db do desc "insert test question" task :insert => :environment do insert_test_question end def insert_test_question 10000.times.each do |index| p "--------------...
true
4415d99e2a0d9520882d2271aa62742c6910ba49
Ruby
detroll/tts-ruby
/rubyreview.rb
UTF-8
586
3.53125
4
[]
no_license
#1 # puts "What is your name" # name = gets.chomp # puts "Hello #{name}. Nice to meet you." #2 # def sum_numbers(x,y,z) # sum_numbers = "x+y+z" # puts "#{sum_numbers}" # end #3 # def to_do # to_do = ["wash the car", "buy groceries", "finish homework", "pay the bills"] # puts "Don't forget to #{to_do(2)}.}" #...
true
b3ece91bcd8847de4160a31e8ebd8c94eee12ae5
Ruby
LastZactionHero/chemotaxis_ruby
/api/app/services/agent_coordinator.rb
UTF-8
1,240
3.265625
3
[]
no_license
class AgentCoordinator attr_reader :agents class InsufficientCashError < StandardError end def initialize(total_cash, agent_count) @total_cash = total_cash @agent_count = agent_count @agents = [] @dead_agents = [] end def total_value @agents.map{|agent| agent.value}.sum end def d...
true
8d9a2d73cc74966da030b8e54b863b227158ad54
Ruby
coffeeexistence/ruby-music-library-cli-v-000
/lib/MusicLibraryController.rb
UTF-8
1,816
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative '../concerns/modules.rb' require_relative 'classes.rb' class MusicLibraryController attr_accessor :path def initialize(path='./db/mp3s') @path=path music_importer=MusicImporter.new(@path) music_importer.import end def list_songs(mode=(:loud)) sorted = Song.all.sort{|a, b| a.ar...
true
a7fdd8d537f8feb17eba10e599a63f80f7e56f92
Ruby
fishplate/hour_logger
/lib/tasks/run_archiver.rake
UTF-8
447
2.5625
3
[]
no_license
# Rakefile to run archiver # checks start of every month namespace :check_hours do task :process => :environment do begin puts "#{Time.now} : check hours in #{ENV['RAILS_ENV']}." if Date.today.day == 1 ProcessHours.process(Date.today.beginning_of_month - 1.month) else puts "Not s...
true
641835c1fe30d192d32a2a05e66e1b48b24b4cf2
Ruby
ataka/rvindex
/app/models/name.rb
UTF-8
331
2.546875
3
[]
no_license
class Name < ActiveRecord::Base validates :last, presence: true, length: { maximum: 255 } validates :first, length: { maximum: 255 } validates :suffix, length: { maximum: 32 } def create Name.create(name_params) end private def name_params params.require(:name).permit(:last, :first, :suffix)...
true
34104cfe9760cd25e2f079dbda2c16d037df57ee
Ruby
Duartemartins/odin-facebook
/app/models/friendship.rb
UTF-8
1,240
2.59375
3
[]
no_license
# frozen_string_literal: true class Friendship < ApplicationRecord # - RELATIONS belongs_to :user, class_name: 'User', foreign_key: 'user_id' belongs_to :friend, class_name: 'User', foreign_key: 'friend_id' attribute :status, :string, default: 'requested' # - VALIDATIONS validates_presence_of :user_id, :f...
true
67c6cb38bf02222dad78a8072a96be1f28b23424
Ruby
connorpaulstauffer/app-academy
/prep-work/practice/matrices.rb
UTF-8
4,578
3.78125
4
[]
no_license
# Calculates and returns the inverse of the matrix def inverse(matrix) det = determinant(matrix) return nil if det == 0 || det == nil factor = (1.0 / det) if matrix.length == 2 mat = clone_matrix(matrix) mat[0][0], mat[1][1] = mat[1][1], mat[0][0] mat[0][1], mat[1][0] = -mat[0][1], -mat[1][0] el...
true
1ff5c54c2d39dd4f8a7c43d7241b4a0cc02f773e
Ruby
hannako/bank_tech_test
/lib/transactions.rb
UTF-8
711
3.40625
3
[]
no_license
class Transactions attr_reader :statement def initialize @statement = [] end def record_transaction(amount,balance) transaction = {date:'',credit:' 0 ',debit:' 0 ',balance:''} transaction['date'] = Time.now.strftime("%d/%m/%y") transaction['balance'] = balance amount > 0 ? transaction['cred...
true
26fdfd2f36c1ec38f29db117d6ef6e4bb9bf941d
Ruby
ciawalsh/Inject-Challenge
/lib/inject.rb
UTF-8
157
2.875
3
[]
no_license
class Array def my_inject(arg=nil, op = nil) starter = arg ? arg : self.shift self.each {|number| starter = yield(starter,number) } starter end end
true
e2a63a085bf9d72344966db7a9d3612d458e9d9a
Ruby
maysam/syntaxer
/lib/syntaxer/writer.rb
UTF-8
2,730
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module Syntaxer class Writer # Recreate config DSL string operation general rules and set of # languages EXCLUDE_PROPERTIES = "executor", "exec_existence", "deferred", "name" # Initializing Writer # # @param [Array] array of languages to recreate # @param [LanguageRules] def init...
true
4e9a6d5d3cff51e1b8a160478ed40e8045c49721
Ruby
mattharbo/lewagoncourses
/Courses Examples/requires/sport_car.rb
UTF-8
790
3.34375
3
[]
no_license
class SportCar def initialize(color = "white") # ie. constructor # Définition des variables d'instance # Auxquelles il faut donner des valeurs par défaut @engine_started = false @color = color end # EXPOSER UNE VARIABLE D'INSTANCE # def color # return @color # end # autre façon d'exposer une variable...
true
217d0ccdbfb3b54de0d9ff8af310997a6831e22e
Ruby
katrinagarloff/my-collect-dumbo-web-060418
/lib/my_collect.rb
UTF-8
158
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(collection) i = 0 new_collection = [] while i < collection.length new_collection.push(yield collection[i]) i+=1 end new_collection end
true
a369894470b232e8c98c313d6ec8cef37666742e
Ruby
lenriquez/Programing-Problems
/bst_repeted_number/bst_repeated_number.rb
UTF-8
524
3.71875
4
[]
no_license
class Node attr_accessor :value attr_accessor :left attr_accessor :right def initialize v=nil, l = nil, r = nil @value = v @left = l @right = r end end def bst_repeted_numbers node, value return 0 if node == nil count = value == node.value ? 1 : 0 return count + bst_repeted_numbers(node.left, value) ...
true
3d78378c5b6d3c89d1dab43f488b359631bd27c2
Ruby
uqbar-paco/metaprogramacion-age-of-empires-2014c1
/metaprogramacion_age.rb
UTF-8
6,346
2.90625
3
[]
no_license
require 'rspec' class Object attr_accessor :version def version @version = @version || 0 @version end def versionar self.version= self.version + 1 end end module Descansador def descansar self.energia += 10 end end #mixin Defensor module Defensor attr_accessor :energia, :potencial_...
true
89d6b5023d333e79a95776a24daaa8e33bea27f0
Ruby
morrifeldman/dotfiles
/rake/microarray.rake
UTF-8
12,400
2.625
3
[]
no_license
load './microarray_config.rb' # microarray_config in the current directory should define the # following constants. # Probe_category e.g. 'comprehensive' # Data_name, name of the analysis Conditions, if there are replicates, # these are the base names of the replicates. # Control_name, this is one of the condi...
true
728ec1b8b0ab6e441070f95e68742a34f5a22669
Ruby
nna774/panchira
/lib/panchira/resolvers/dlsite_resolver.rb
UTF-8
1,706
2.578125
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Panchira class DlsiteResolver < Resolver URL_REGEXP = /dlsite/.freeze private # DLSiteのタイトルの[]に含まれている値はtitleタグだとサークル名 or 出版社名だが、 # Panchiraが優先するog:titleではサークル名 or 著者名 となる。 # 取得に際しては、以下の3パターンを考慮する必要があるため、titleタグとtableの解析が必要となる: # 1) 同人系の一部, 特に音声など...
true
9ea9dac9a70523c2518a100bbedbdae01846a89a
Ruby
EvilJadeon/Thinknetica
/lesson_2/array.rb
UTF-8
69
3
3
[]
no_license
arr = [] i = 5 while i < 100 do i += 5 arr.push(i) end print arr
true
d3137c73127762c1b072b4ab3576d859b3ecf8e6
Ruby
petercunning/redd
/lib/redd/clients/userless.rb
UTF-8
872
2.65625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require_relative "base" module Redd module Clients # The client that doesn't need a user to function. # @note Of course, that means many editing methods throw an error. class Userless < Base # @!attribute [r] client_id attr_reader :client_id # @param [Hash] options The options to creat...
true
f7f47f468f4a26d9eb7ca1f6faad6700a44dab15
Ruby
jeanres/mars-rover-test
/lib/grid.rb
UTF-8
253
3.390625
3
[]
no_license
class Grid def initialize(x, y) raise ArgumentError unless Integer(x) && Integer(y) @top_right_y = Integer(y) @top_right_x = Integer(x) end def get_top_right_x @top_right_x end def get_top_right_y @top_right_y end end
true
e826a21f0889be8b872a684c18d6a2dc4b404411
Ruby
jas0nmjames/jas0nmjames.github.io
/vendor/bundle/ruby/3.2.0/gems/hashery-2.1.2/lib/hashery/key_hash.rb
UTF-8
1,501
3.703125
4
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "MIT" ]
permissive
require 'hashery/crud_hash' module Hashery # The KeyHash class is a Hash class which accepts a block for # normalizing keys. # # The KeyHash class is essentially the same as a normal Hash. # But notice the significant distinction of indifferent key # access. # # s = KeyHash.new # s[:x] = 1 # ...
true
cad9b6ff2a364690e46a778cd9ff5b6ab90e7498
Ruby
mightyverse/udhr_by_language
/udhr/document.rb
UTF-8
926
3.109375
3
[]
no_license
require 'nokogiri' require './article' module UDHR class Document attr_reader :articles, :html def initialize(filename) File.open(filename, "r:UTF-8") do |f| @xml = Nokogiri::XML(f) @articles = [] nodes = @xml.css('article') article1 = false nodes.each do |node|...
true
ffdca8ef3f49d125f4d5826efb6f7020e40e853c
Ruby
biscar/patterns
/lib/game/factory_method/enchanted_maze_game.rb
UTF-8
348
2.546875
3
[ "MIT" ]
permissive
module Game module FactoryMethod class EnchantedMazeGame < Game::FactoryMethod::MazeGame class << self def make_room(number) Game::Rooms::EnchantedRoom.new(number: number) end def make_door(r1, r2) Game::Doors::DoorNeedSpell.new(room1: r1, room2: r2) end ...
true
b239a3fdc4f6e51e04c13cb87defdb72e0381a9f
Ruby
alessandrogurgel/codility
/frog_jmp.rb
UTF-8
55
2.9375
3
[]
no_license
def solution(x, y, d) ((y - x).to_f/d.to_f).ceil end
true
587d7622cc206668e84bdbaacee85b50ece47887
Ruby
philomory/ld38
/src/units/enemy/pacer.rb
UTF-8
449
2.6875
3
[ "MIT" ]
permissive
class Enemy::Pacer < Enemy def initialize(properties) super @facing = (properties["facing"] || :north).to_sym end def make_your_move(&blk) move(@facing,&blk) end def ran_into(cell,direction) self.facing = -@facing unless cell.occupant&.player? super end def imagename ...
true
de0b8cb012b26dc9fccc719a69869af7410556f4
Ruby
kclar24/TTS-Ruby-Practice-2016
/PunchyMcPuncherton/battle_script.rb
UTF-8
1,454
3.8125
4
[]
no_license
require_relative 'sloth' puts "WELCOME TO PUNCHY MCPUNCHERTON. CREATE YOUR FIGHTERS, CHUMP." puts "FIGHTER 1, WHAT IS THEIR NAME?" f1name = gets.chomp puts "HEALTH?" f1health = gets.chomp.to_i puts "POWER?" f1power = gets.chomp.to_i puts "CAN THEY BECOME INVISIBLE? ENTER YES OR NO." f1invisinput = gets.chomp.downc...
true
2089ee12798c21a94c5c284d7ac2e73c28525562
Ruby
morita-k/goldrush
/lib/name_util.rb
UTF-8
1,980
2.671875
3
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- module NameUtil @@names = nil def NameUtil.initNames yaml_file = File.join(Rails.root,'config','names.yml') if File.exist?(yaml_file) NameUtil.setNames_offline(yaml_file) else NameUtil.setNames end end def NameUtil.setNames names = Name.find(:all, :condi...
true
08cfb0de8dadee59bafb7af893c265db406f8f84
Ruby
rickymccallum87/the-odin-project
/code-quizzes/symbols_array_methods_hashes.rb
UTF-8
408
3.28125
3
[]
no_license
snowy_owl = { type: 'bird', diet: 'carnivore', life_span: '10 years' } puts snowy_owl.inspect result = [] first_names = ["Hamburglar", "Grimace", "Ronald"] last_name = "McDonald" first_names.each do |first_name| result << first_name + ' ' + last_name end puts result.inspect personality_types = ["bad", "good", "...
true
4798de98d8688f24a365df8799e38e5e0b8d9f25
Ruby
thib123/TPJ
/Notes/Ruby/sample_code/ex0877.rb
UTF-8
264
3.421875
3
[ "MIT" ]
permissive
# Sample code from Programing Ruby, page 456 f1 = File.new("f1", "w") sleep 1 #!sh! f2 = File.new("f2", "w") f1.stat <=> f2.stat # Methods in Comparable are also available f1.stat > f2.stat f1.stat < f2.stat
true
6f5dc809dccfb70755d8bff6c04a80bc7cd7692b
Ruby
ErikAGriffin/takeaway-challenge
/lib/takeaway.rb
UTF-8
1,795
3.359375
3
[]
no_license
require 'twilio-ruby' class Takeaway attr_reader :dishlist def initialize(dishes = []) @dishlist = dishes # -- Twilio Login account_sid = "ACaec4d28c46b3cad3b94eb351ea3231d5" auth_token = "04c7f3d58a93daca72f3b40bb132f310" @texter = Twilio::REST::Client.new account_sid, auth_token end ...
true
edc0f2430449fdf77e0713dfaa743c16718201d6
Ruby
halo/satellite-server
/lib/satellite/server/controllers/managers/space.rb
UTF-8
2,936
2.75
3
[]
no_license
require 'chipmunk' require 'satellite/server/controllers/shared/message_sender' module Satellite module Server module Controllers module Managers class Space include Shared::MessageSender def initialize(options={}) @space = CP::Space.new @space.damping =...
true
559c511d878573e7e0e6b5309f6576077f95e6d3
Ruby
zacharytwhite/project-euler-solutions
/project_euler_rb/problem_092.rb
UTF-8
803
4.5
4
[]
no_license
# A number chain is created by continuously adding the square of the digits in a number # to form a new number until it has been seen before. # For example, # 44 → 32 → 13 → 10 → 1 → 1 # 85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89 # Therefore any chain that arrives at 1 or 89 will become stuck in an endless loo...
true
805f9d08755c9b0f32f683b9868168a3599c770d
Ruby
azhang9328/ruby-oo-practice-flatiron-zoo-exercise-seattle-web-120919
/run.rb
UTF-8
453
3.171875
3
[]
no_license
require_relative "lib/Animal.rb" require_relative "lib/Zoo.rb" require 'pry' #Test your code here z1 = Zoo.new("London", "London Zoo") z2 = Zoo.new("San Diego", "San Diego Zoo") a1 = Animal.new("Lion", "430lb", "Kitten", z1) a2 = Animal.new("Elephant", "2300lb", "Big Rat", z2) a3 = Animal.new("Bear", "300lb", "Popeye...
true
adc0005eeb2f09b11119146c7d8bdb3302c69234
Ruby
Arithmetics/history
/app/models/playoff_odd.rb
UTF-8
9,399
2.53125
3
[]
no_license
class PlayoffOdd < ApplicationRecord belongs_to :fantasy_team validates_inclusion_of :category, :in => ["make_playoffs", "get_bye", "win_championship"] def self.save_current_playoff_odds(completed_week, num_sims) puts "Starting playoff odds sim for week #{completed_week}" run_num = 0 current_year = F...
true
d8a0b835480c9d5836ce3b55fd7ad93c011ee37c
Ruby
Grzegorz-Olszewski/rbnd-udacitask-part2
/lib/todo.rb
UTF-8
441
2.734375
3
[]
no_license
class TodoItem include Listable attr_reader :type, :description, :due, :priority def initialize(type,description, options={}) @type = type @description = description @due = options[:due] ? Chronic.parse(options[:due]) : options[:due] @priority = options[:priority] end def details format_...
true
9762bc8a8ccbc1cff98a4a6446a04810c1830b86
Ruby
daniero/code-challenges
/aoc2019/ruby/01b.rb
UTF-8
190
2.984375
3
[]
no_license
def part1(m) [0, ( m/3-2 )].max end def part2(m) f = part1(m) f <= 2 ? f : f + part2(f) end p input = File .readlines('input/input01.txt') .map(&:to_i) .sum { |m| part2(m) }
true
c23216acbb4c845c4fc690cd3872bc7a38629043
Ruby
jarthod/codejam
/2017/qualification/3-bathroom-stalls/bathroom-stalls.rb
UTF-8
475
3.375
3
[]
no_license
#!/usr/bin/env ruby # 0.....0 # i j # 012345 def place(peeps, i, j) # puts "place(#{peeps}, #{i}, #{j})" return [0, 0] if (j-i) == 1 return [(j-i)/2, (j-i-1)/2] if peeps == 1 split = (j+i-1)/2 if (peeps-1) % 2 == 0 return place((peeps-1)/2, i, split) else return place((peeps)/2, split+1, j) ...
true
48b4353160bfbeecdcdd040943617bf0c2647774
Ruby
cardo22/Ironhack
/pre-workRuby/shoppingCart/lib/shoppingCart_item.rb
UTF-8
127
3.03125
3
[]
no_license
class Item # attr_accessor :name, :price def initialize(name, price) @name = name @price = price @discount = 0 end end
true
8e0ed462684a870fab1c2b388b981ceccb252f14
Ruby
scottmillion/launch_school_exercises
/play/play_2.rb
UTF-8
485
3.609375
4
[]
no_license
def joinor(array, delim=', ', final_delim='or') return "#{array[0]}" if array.size == 1 return "#{array[0]} #{final_delim} #{array[-1]}" if array.size == 2 array_new = [] array[0..-2].each { |element| array_new += [element, delim ] } array_new += [final_delim + ' ', array[-1]] array_new.join end p joinor...
true
2e1f6b2b72387a72551152d8f96ab473985fc720
Ruby
TheMoniulla/code_eval_ruby
/multiples_of_a_number/code.rb
UTF-8
253
3.796875
4
[]
no_license
File.open('input.txt').each_line do |line| def multiples_of_numbers(num1, num2) num2 *= 2 while num2 < num1 num2 end numbers = line.split(',') num1 = numbers[0].to_i num2 = numbers[1].to_i puts(multiples_of_numbers(num1, num2)) end
true
6407323771dea68f2e45374947cbca38b6d44672
Ruby
sittercity/bureaucrat
/spec/fields/social_security_number_field_spec.rb
UTF-8
989
2.703125
3
[ "MIT" ]
permissive
require 'spec_helper' require 'bureaucrat/fields/social_security_number_field' describe Bureaucrat::Fields::SocialSecurityNumberField do let(:field) {Bureaucrat::Fields::SocialSecurityNumberField.new} [ '123456789', '123-45-6789', ' 123-45-6789 ' ].each do |ssn| it "allows #{ssn}" do ...
true
89cec038e814da111bd410df562d355ad584e928
Ruby
pjfitzgibbons/RubyQuiz
/214-PrototypicalInheritance/lib/prototypical_inheritance.rb
UTF-8
851
2.75
3
[]
no_license
module PrototypicalInheritance module Hash::Prototype def prototype=(value) @persisted_method_missing = false self.replace(value.merge(self)) end def persisted_prototype=(value) @persisted_method_missing = true self.replace(value.merge(self)) end def method_missing(symbol...
true
da815048cfb33a9055e6d50bb1dfab812c00d0eb
Ruby
D4L/projectEuler
/src/problem-81/vdkn.rb
UTF-8
471
3.171875
3
[]
no_license
public # [0][0] ... [0][79] # ... ... # [79][0] ... [79][79] def vdkn matrix = File.open("src/problem-81/matrix").collect {|l| l.chop.split(',').map {|i| i.to_i}} matrix[0].each_index do |i| next if i == 0 matrix[0][i] += matrix[0][i-1] matrix[i][0] += matrix[i-1][0] end (1..79).each do |m...
true
b10056753d5d55f32c10e853d90c93a777959d37
Ruby
brutella/comment-generator
/lib/objc/objc_class.rb
UTF-8
976
2.953125
3
[]
no_license
require_relative "../base/class_entity" require_relative "../doxygen/doxygen" # (ObjCClassClassEntity brief description) # # (Comprehensive description) # class ObjCClass < ClassEntity # (initialize brief description) # # (Comprehensive description) # # [string] # [syntax] # ...
true
f09f2b672b0e5bcd03a5ebab57154405d1de77ba
Ruby
bleavitt92/Launch-School
/Small_Problems/medium2/trianglesides.rb
UTF-8
1,203
4.3125
4
[]
no_license
#To be a valid triangle, the sum of the lengths of the two shortest sides must be greater than the length of the longest side, and all sides must have lengths greater than 0: if either of these conditions is not satisfied, the triangle is invalid. #Write a method that takes the lengths of the 3 sides of a triangle as ...
true
2bbede7883153d4d9ab41a089511ab93f0c9e969
Ruby
BookingSync/valvat
/lib/valvat/utils.rb
UTF-8
758
3.171875
3
[ "MIT" ]
permissive
class Valvat module Utils EU_COUNTRIES = %w(AT BE BG CY CZ DE DK EE ES FI FR GB GR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK) COUNTRY_PATTERN = /\A([A-Z]{2})(.+)\Z/ NORMALIZE_PATTERN = /[[:space:][:punct:][:cntrl:]]+/ def self.split(vat) COUNTRY_PATTERN =~ vat result = [$1, $2] ...
true
2f68b03e52ade49b8c92044055446b99c44e12e9
Ruby
lerak/LearntoProgram
/angry_grandma.rb
UTF-8
713
4.1875
4
[]
no_license
#whatever you say grandma responds with "Huh?! SPEAK UP , SONNY!" #unless you shout talk capital letters and shouts back No not since 1938! #randomize the number number =[1938,1950,1968,1970] #puts number.shuffle.first puts "Grandma program call your grandma:" calling = gets.chomp if calling == 'grandma' puts 'H...
true
3fc8f6f69546e01c583dd37380a4d163cd2bc041
Ruby
Red54/crystal
/spec/type_inference/def_overload_spec.rb
UTF-8
3,817
3.03125
3
[]
no_license
require 'spec_helper' describe 'Type inference: def overload' do it "types a call with overload" do assert_type('def foo; 1; end; def foo(x); 2.5; end; foo') { int } end it "types a call with overload with yield" do assert_type('def foo; yield; 1; end; def foo; 2.5; end; foo') { double } end it "ty...
true
794c3409005f8235e5b3d7449ae80639eedad720
Ruby
dianeyang/blackjack
/card.rb
UTF-8
947
3.3125
3
[]
no_license
module Blackjack class Card attr_reader :suit attr_reader :type def initialize(type, suit) @suit = suit @type = type end def value if type === 'A' return 1 elsif type.is_a?(Integer) && type >= 2 && type <=9 return type else return 10 end end def to_string if @type == 10 ...
true
e132ce23140175c26353ec9405a340c819c8fc98
Ruby
BenRKarl/WDI_work
/w01/d04/Carlos_Pichardo/eleven.rb
UTF-8
405
3.875
4
[]
no_license
puts "What is the volume of your amplifier volume?" amp_vol = gets.chomp.to_i puts "Do you want to push it over the cliff? (yes or no)" over_cliff = gets.chomp.downcase if amp_vol < 11 && over_cliff == yes puts "Crank it to eleven" elsif amp_vol < 11 && over_cliff == no puts "That's not very rock, man." elsif amp...
true
ac800c0baa64aa540342207886249f40d9861da0
Ruby
flajann2/kamelcase
/lib/kamelcase.rb
UTF-8
509
3.296875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class String def camel return self if self !~ /_| / && self =~ /[A-Z]+.*/ split(/_| /).map{|e| e.capitalize}.join end def camel_lower self.split(/_| /).inject([]){ |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join end def snake self.gsub(/::/, '/'). gsub(/([A...
true
e7e0206a688121802e884bcceaba27bd206a9063
Ruby
Drus566/Ruby
/RubyBegin/Chapter15/gserver.rb
UTF-8
1,003
3.03125
3
[]
no_license
# require 'gserver' # class HelloServer < GServer # def serve(io) # io.puts("Say something to me:") # line = io.gets # io.puts("You said '#{line.chomp}'") # end # end # #HelloServer.new(port,ip,count connect, logging on/off(true or false)) # server = HelloServer.new(1235, '127.0.0.1', ...
true
421264cfd1073d2196d8a29db1fa21d8126b370c
Ruby
msantia09/quora-clone
/app/controllers/users.rb
UTF-8
530
2.53125
3
[ "MIT" ]
permissive
post '/signup' do puts "[LOG] Getting /signup" user = User.new(params[:user]) user.save @flash = 'Account successfully created. Please login with your username/password.' erb :"static/main" end post '/login' do puts "[LOG] Getting /login" user = User.find_by_email(params[:user][:email]) if user.authenticate(p...
true
6425bb7f50f8cfa7493e884e6aae23c02c7c66e9
Ruby
epnb/v1wrappers
/ruby/examples/users.rb
UTF-8
2,664
3.46875
3
[]
no_license
# This is an example of how to use the VerticalResponse Ruby API wrapper # for users-related actions. # # Before you run this example, you need to modify the following config file and # include your access tokens for the user you have created in VerticalResponse: # ../config/api.yml # # The example consists of perfor...
true
0b102bfc37ce23d88e2b261b751042c297dae12f
Ruby
calvached/time_logger
/lib/dashboard.rb
UTF-8
1,409
2.828125
3
[]
no_license
require 'messages' require 'menu' class Dashboard attr_reader :io def initialize(database, input_output) @database = database @io = input_output end def run @current_user = io.username_prompt(Messages::ENTER_USERNAME, database.all_users) io.out(Menu.main[@current_user.status_code]) get_s...
true
4e52590444d9636ee2d6e8588749057b92cc3523
Ruby
reiven-inc/diaer_public
/app/helpers/application_helper.rb
UTF-8
1,298
2.59375
3
[]
no_license
module ApplicationHelper def html_br(s) h(s).gsub(/(\r\n?)|(\n)/, '<br>').html_safe end def twitter_user_url(screen_name) "https://twitter.com/#{screen_name}" end def twitter_tweet_url(screen_name, id) "https://twitter.com/#{screen_name}/status/#{id}" end def text_with_link(text) URI.ex...
true
8cefeb74d3f03c9e7c0bae1b5a9b2395c467d5e0
Ruby
chron/battlesnake
/board.rb
UTF-8
780
3.03125
3
[]
no_license
class Board attr_reader :height, :width, :food, :snakes def initialize(json, owner_id) @height = json['height'] @width = json['width'] @food = json['food'].map { |food_json| Point.from_json(food_json, self) } @snakes = json['snakes'].map { |snake_json| Snake.new(snake_json, self) } @owner_id = ...
true
877894a5176b701712f7e30c3292648b3511857f
Ruby
pololee/oj-leetcode
/ruby/1_two_sum.rb
UTF-8
251
3.28125
3
[]
no_license
# @param {Integer[]} nums # @param {Integer} target # @return {Integer[]} def two_sum(nums, target) h = {} nums.each_index do |idx| return [h[target - nums[idx]] + 1, idx + 1] unless h[target - nums[idx]].nil? h[nums[idx]] = idx end end
true
c4d371feaf76a1bf21ea5873e51f90689540f20c
Ruby
dalibor/mars_rover
/spec/mars_rover/rover_spec.rb
UTF-8
2,246
2.75
3
[ "MIT" ]
permissive
require 'spec_helper' describe MarsRover::Rover do describe "#navigate" do let(:navigation) { stub(:navigation) } let(:plateau) { stub(:plateau).as_null_object } let(:rover) { Rover.new(navigation, plateau) } it "understands L command" do navigation.should_receive(:rotate_left) rover.na...
true
6fd76baad8e2a0dd140b396f49167738622e0c62
Ruby
prathamesh-sonpatki/torm
/lib/attribute_methods/write.rb
UTF-8
680
2.6875
3
[ "MIT" ]
permissive
module Torm module AttributeMethods module Write def init_writer(attr_name) self.singleton_class.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{attr_name}=(value) write_attribute('#{attr_name}', value) end RUBY end def write_attribute(name, valu...
true
48170380c396a042e4ba4c89a6844c0b2d20b128
Ruby
Drackenov/introduction-to-algorithms
/2-1-3-linear-search.rb
UTF-8
622
3.390625
3
[]
no_license
# http://en.wikipedia.org/wiki/Linear_search class LinearSearch class << self def search value, array array.each_with_index do |item, i| return i if item.equal?(value) end nil end end end if $0 == __FILE__ require "test/unit" class LinearSearchTest < Test::Unit::TestCase ...
true
f7b110ab1f773de49eb15ed5c0f0d85bcff8b708
Ruby
nguyenvinhlinh/fotobook
/lib/utilities.rb
UTF-8
405
3.203125
3
[]
no_license
module Utilities # Detach a string into an array of tags. It strips spaces, duplicate item # For example "a,xc, ,1, 2 ,a" => [a,xc,1,2] # Params: # +tags_string: a string of tag which separated by commas # Return: an array of string def stringToArray(a_string) if a_string.nil? return [] end...
true
2a057b59ae6f932bc9e3893ad5ce15a6066967fe
Ruby
moowahaha/despamilator
/spec/helpers/filter_helper.rb
UTF-8
1,524
2.65625
3
[ "MIT" ]
permissive
class Despamilator::Subject def has_score? score self.score == score end end def the_name_should_be expected_name it 'should have a name' do described_class.new.name.should == expected_name end end def the_description_should_be expected_description it 'should have a description' do described_cla...
true
66920dff81e83c7823016562982988039c0a3f95
Ruby
abeidahmed/cuddly-octo-enigma
/app/models/authentication.rb
UTF-8
359
2.828125
3
[]
no_license
class Authentication attr_reader :password, :username def initialize(params) @username = params[:username].to_s.downcase @password = params[:password] end def authenticated? user.present? end def user @user ||= User.find_by(username: username) return unless @user @user.authentica...
true
21900f122cb5aa8dba4e2953f113a75dea31769a
Ruby
captainvita/learn-coding
/ruby/LRTHW/ex44/ex44e.rb
UTF-8
444
3.234375
3
[ "MIT" ]
permissive
module Other def implicit puts "Other implicit" end def override puts "Other implicit" end def self.altered puts "Other altered" end end class Child #Include Other Module and it's methods include Other def override puts "Child override" end def altered puts "Child before ...
true
d55f0fa813f25cb093afab02485835f12ab7428f
Ruby
TreyLawrence/popspell
/test.rb
UTF-8
182
3.296875
3
[]
no_license
require 'popspell' spelling = PopSpell.new puts "Example: My favorite beer is #{spelling.correct('Aekt Schlencherla Rauchbier')}" print "Try your own: " puts "Is corrected to: #{spelling.correct(gets)}"
true
5d90e641a3c00fde2017be2effe4bcbaa4aac0d9
Ruby
mhorbul/vcap
/cloud_controller/lib/timed_section.rb
UTF-8
320
2.765625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "GPL-1.0-or-later", "CPL-1.0", "CC-BY-3.0", "Artistic-1.0", "bzip2-1.0.6", "LGPL-2.0-or-later", "MIT", "LGPL-3.0-only", "CC-BY-SA-3.0", "CC-BY-4.0", "BSD-3-Clause", "LGPL-2.1-only", "LicenseRef-scancode-proprietary-license", ...
permissive
class Object def timed_section(logger, name = nil) # If no name is given, try to give a useful description. name ||= caller.first.split(':').last start_time = Time.now ret = yield if logger logger.debug "[#{name}] took #{Time.now - start_time} seconds to execute." end ret end end
true
e952aedf012309ede94463df2a9ae7dbf163b3ba
Ruby
teddycoleman/lightning_talk
/app/controllers/charts_controller.rb
UTF-8
1,554
2.578125
3
[]
no_license
class ChartsController < ApplicationController require 'gchart' def index @line_chart = Gchart.line( :size => '600x300', :title => "SP 500 Closing Prices in October", :legend => ['Prices'], :data => [2126,2126,2133,2139,2143,2151,2141,2141,2144,2139,2126,2132,2132,2139...
true
a4b9a6353dc60c026ef8908094682ce73abab702
Ruby
hyuko21/welcome-to-the-jungle-minigame
/wttj_game/scripts/enemy.rb
UTF-8
1,679
3.25
3
[]
no_license
class Enemy attr_reader :x, :y, :life attr_writer :dir def initialize(map, x, y) @map = map @x = x @y = y @snake = Image.load_tiles("graphics/sprites/snake/snake.png", 32, 32) @dying = Image.load_tiles("graphics/sprites/dying/blood32.png", 32, 32) @color = Color.new(255, 0, 255, 255) @dir...
true
8c536a7e04a6fc32b23ba216508718c7f042512d
Ruby
matias-ocares/Ruby-Practicas
/src/01/07_contar.rb
UTF-8
96
2.890625
3
[]
no_license
def contar(sentence, word) return 0 if word.empty? sentence.scan(/#{word}/i).count end
true