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
501f4ed867c13b98fabd3ac84f6afcc353a5bbe9
Ruby
janslow/rfr-ruby
/lib/rfr/commands/unknown_command.rb
UTF-8
310
2.921875
3
[]
no_license
module RFR::Commands class UnknownCommand < Command attr_reader :type, :data def initialize type, data @type = type @data = data end def to_s data_s = @data.map(&:chr).join.gsub(/[^[:print:]]/i, '_') "UNKNOWN: #{@type}: #{@data.to_s}/#{data_s}".red end end end
true
cdbecdaa65033e546dd47e8673f3e4c60d9d3d34
Ruby
bmhatfield/vagrant
/lib/vagrant/config/vm/provisioner.rb
UTF-8
1,727
2.515625
3
[ "MIT" ]
permissive
require 'log4r' module Vagrant module Config class VMConfig < Base # Represents a single configured provisioner for a VM. class Provisioner attr_reader :shortcut attr_reader :provisioner attr_reader :config def initialize(shortcut, options=nil, &block) @logg...
true
b66faca9b6cac81edde4327b2a68a798543b7b4f
Ruby
lkragna/conektaTestRails
/app/controllers/token_controller.rb
UTF-8
1,842
2.53125
3
[]
no_license
class TokenController < ApplicationController def new user = valid_user(request.env["HTTP_USER_ID"], request.env["HTTP_SECRET_KEY"]) if !user.any? return render json: {:message => 'invalid user'}, status: :unauthorized end if !validate_credit_card_number(params['credit_card_number']) ret...
true
a547198d1a3f6d263d30c71da75a0397381d73c2
Ruby
sofiajonsson/Ruby-LeetCode
/Easy/Longest Common Prefix.rb
UTF-8
855
4.0625
4
[]
no_license
# Write a function to find the longest common prefix string amongst an array of strings. # # If there is no common prefix, return an empty string "". # # Example 1: # # Input: ["flower","flow","flight"] # Output: "fl" # Example 2: # # Input: ["dog","racecar","car"] # Output: "" # Explanation: There is no common prefix ...
true
6da0c2a7f479c1ff559b9caa456e17b13f0b6f84
Ruby
Amos76/post-it
/db/seeds.rb
UTF-8
883
2.8125
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
b66bf9de645be3013339d37709dc003feb32f5fd
Ruby
kchien/haberdasher
/spec/haberdasher/decorator_spec.rb
UTF-8
980
3.109375
3
[ "MIT" ]
permissive
require 'spec_helper' require 'haberdasher/decorator' class Book attr_accessor :title attr_accessor :author def initialize yield self if block_given? end end class BookDecorator < Haberdasher::Decorator def author_and_book "#{author}: #{title}" end end module Haberdasher describe Decorator do ...
true
5c007b497768ca59eb7b45c6c46041d482aedd78
Ruby
GitHubShabs/Animal_SanctuaryWk5Project
/models/owner.rb
UTF-8
1,614
3.328125
3
[]
no_license
require_relative('../db/sql_runner') require_relative('./animal.rb') class Owner attr_accessor :first_name, :last_name attr_reader :id, :first_name, :last_name def initialize(options) @id = options['id'] @first_name = options['first_name'] @last_name = options['last_name'] end def save() ...
true
c087d7a40b37f58af009c1e81960deba95a1c5ee
Ruby
bew/zpl-scaler.rb
/lib/zpl-scaler/transformer/base.rb
UTF-8
1,145
3.015625
3
[ "MIT" ]
permissive
require_relative '../reader' module ZplScaler module Transformer end # TODO: doc - explain how to make a transformer class Transformer::Base # TODO: doc def apply(zpl_code, strip_spaces: true) reader = ZplReader.new(zpl_code, strip_spaces: strip_spaces) transformed_zpl = StringIO.new ...
true
e82c50ce6683c31e9a6765bc9961505d50253870
Ruby
chaner/lita-keyword-arguments
/lib/lita/extensions/keyword_arguments/parser.rb
UTF-8
1,002
2.609375
3
[ "MIT" ]
permissive
require 'slop' module Lita module Extensions class KeywordArguments class Parser attr_reader :args, :spec def initialize(spec, args) @spec = spec @args = prepare_args(args) end def parse spec.each { |name, option_spec| add_option(name, option_...
true
00a7cb8a71165b492d9401c27368b5c3aef670d5
Ruby
toyama0919/embulk-filter-google_vision_api
/lib/embulk/filter/google_vision_api/vision_client.rb
UTF-8
2,006
2.59375
3
[ "MIT" ]
permissive
require "json" require "net/http" require "base64" require 'addressable/uri' module Embulk module Filter class GoogleVisionApi < FilterPlugin class VisionClient ENDPOINT = "https://vision.googleapis.com/v1/images:annotate" def initialize(features:, google_api_key:) uri = URI.parse...
true
d18f26edba5b5b9b2350eda14306b4e5dc20d6e4
Ruby
adrianpearman/Object-Oriented-Programming-Class-Methods-and-Class-Variables
/exercise4.rb
UTF-8
365
4.0625
4
[]
no_license
#for loop # x = 0 # for x in 0..10 # x += 1 # puts "#{x}" # break # end #.times # 10.times {puts "hello"} #next for f in 0..15 next if f%2 == 0 print "#{f}" end #until #while x = 10 while x < 50 x += 2 print "#{x}" end #each num = [1,2,3,4,5] num.each do |x| x *= 2 print "#{x}" end words = "h...
true
ea21b3bd0a3c4a00370010b6cdb97aa57cc67a20
Ruby
Big-Theta/EulerProblems
/logan/p220/smaller.rb
UTF-8
1,648
3.703125
4
[]
no_license
$RIGHT = 0 $UP = 1 $LEFT = 2 $DOWN = 3 class Point attr_accessor :x, :y def initialize x=0, y=0 @x, @y = x, y end end class Loc < Point attr_accessor :target def initialize(x=0, y=0) @x, @y = x, y #@center = Loc.new 0, 0 #@end = Loc.new 0, 1 @dir = $UP...
true
8bf4a3a07b1865153daf6ff2545e0f65982b9093
Ruby
psingh0912/the_odin_project
/ruby/even_fib.rb
UTF-8
219
3.078125
3
[]
no_license
total=0 fib_vars = [0,1,0] begin fib_vars[2] = fib_vars[0] + fib_vars[1] total += fib_vars[2] unless fib_vars[2]%2 != 0 puts "#{fib_vars[2]} : Total = #{total}" fib_vars.rotate! end while fib_vars[2] <= 1_000_000
true
395f15517ab91146e8a53e68e4f289c2cba78ec3
Ruby
heather-camcam/ruby-kickstart
/session2/3-challenge/3_array.rb
UTF-8
404
4.09375
4
[ "MIT" ]
permissive
# Write a method named every_other_char for strings that, # returns an array containing every other character # # example: # "abcdefg".every_other_char # => "aceg" # "".every_other_char # => "" class String def every_other_char new_array = self.split("") new_array_2 = [] new_array.each_index ...
true
0c6ac5ff4dd2a836b77f66ed55c54a2c7458fb95
Ruby
dinhhientran/ruby-exercism
/acronym/acronym.rb
UTF-8
343
3.4375
3
[]
no_license
=begin Write your code for the 'Acronym' exercise in this file. Make the tests in `acronym_test.rb` pass. To get started with TDD, see the `README.md` file in your `ruby/acronym` directory. =end class Acronym def self.abbreviate(words) words.split(/[ -]/).map{|word| /[a-zA-Z]/.match(word[0]) ? word[0].upcase :...
true
993fa7352e2d34730d5c4b96a20cd7be56f702ad
Ruby
GideonBrasil/Ruby_Programming
/class_methods.rb
UTF-8
138
3.640625
4
[]
no_license
# good_dog.rb class GoodDog def self.what_am_i "I'm a GoodDog class!" end puts what_am_i end puts GoodDog.what_am_i
true
52a7d826c74daac95e6245e79b000737dc6438a1
Ruby
Ankainnn/report_system
/app/models/salary.rb
UTF-8
424
2.546875
3
[]
no_license
class Salary < ActiveRecord::Base belongs_to :course belongs_to :schedule belongs_to :teacher validates :date, :summ, :teacher_id, :course_id, :schedule_id, :type, presence: true self.inheritance_column = nil def self.to_csv(options = {}) CSV.generate(options) do |csv| csv << column_names ...
true
e743bd9803f3ee1847aaa5baf5cc246139aa9fa9
Ruby
moayyaed/workflow_rb
/workflow_rb/spec/scenarios/outcome_fork_spec.rb
UTF-8
1,776
2.640625
3
[ "MIT" ]
permissive
require_relative '../spec_helper' require 'yaml' require 'workflow_rb/services/memory_persistence_provider' describe "Basic Workflow" do class BasicWorkflow_Stats @step1_ticker = 0 @step2_ticker = 0 class << self attr_accessor :step1_ticker attr_accessor :step2_ticker end end clas...
true
7e73693369f3872cdcf7b2790b90d310c84fceba
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/3b66c14a6ac64fa78956634a60d217cb.rb
UTF-8
254
3.46875
3
[]
no_license
class Hamming def self.compute(strand1, strand2) if strand1.length != strand2.length then raise "Error: strand length must be equal" end (0..strand1.length).reject {|i| strand1[i] == strand2[i]}.length end end
true
c270d9f934427a27cd9d2191871e55a42c36a60a
Ruby
thodges314/learn_ruby
/learn.rb
UTF-8
2,550
4.40625
4
[]
no_license
# # comments begin with an octhothorpe # print "Enter a value: " # first_num = gets.to_i # print "Enter another value: " # second_num = gets.to_i # # arithmetic operators # puts first_num.to_s + " + " + second_num.to_s + " = " + (first_num + second_num).to_s # puts first_num.to_s + " - " + second_num.to_s + " = "...
true
58aa3716d3395cc70ef9f80fd7ac41a5f356665d
Ruby
dansbands/OO-mini-project-web-103017
/app/models/RecipeCard.rb
UTF-8
1,500
3.203125
3
[]
no_license
# join between user instance and recipe instance # a user has many recipes through this join class RecipeCard @@all = [] # return the user this entry belongs to # returns recipe this entry belongs to # return date of the entry # return rating as integer user has given the entry attr_accessor :user, :reci...
true
63a05829b50553695874258726f15adee69f39cd
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/robot-name/382f7bf7bcff40c99bb95735410cccee.rb
UTF-8
971
3.015625
3
[]
no_license
class Robot attr_reader :name, :name_generator @robots = [] def initialize(name_generator = NameGenerator.new) @name_generator = name_generator reset end def reset self.class.robots.delete(@name) begin @name = name_generator.generate end while self.class.robots.include?(@name) ...
true
c919344185ef26b6b34aa578fd09346133ac2b38
Ruby
craineum/inkle_pdf
/app/models/book_segments.rb
UTF-8
362
3.171875
3
[]
no_license
class BookSegments include Enumerable def initialize super @segments = [] end def add(segments) segments.each do |segment| @segments << BookSegment.new(self, segment.to_a) end self end def each(&block) @segments.each { |item| block.call(item) } end def valid? @segme...
true
1454deb7f6bfd5f33b83f1dde6096f336cf271f3
Ruby
Jackmt9/mnemonic-maker-backend
/app/models/song.rb
UTF-8
1,625
2.84375
3
[]
no_license
class Song < ApplicationRecord belongs_to :artist def self.seed_songs(artist_id) page_number=1 page_cap = 2 while(page_number <= page_cap && !!page_number) do response = RestClient.get("https://genius.com/api/artists/#{artist_id}/songs?page=#{page_number}&sort=popularity") ...
true
ae9711e3323624a31d7b3ac636700c67b7b51a56
Ruby
choibg/likelion-2
/s0422/k.rb
UTF-8
66
3.265625
3
[]
no_license
1.upto(1000) do |x| if(x%3==0) or (x%5==0) puts x end end
true
2e3738048dd9df120118987e12f5af851a3763b5
Ruby
Nickolai8/rb101
/exercises_small_problems/documentation_again/default_arguments_in_the_middle.rb
UTF-8
537
3.671875
4
[]
no_license
# 'p' directly writes the object itself to the consol, and then follows that # with a newline character. # However, because only 3 arguments are passed to the method, and there # are 4 parameters with the middle two having defaults, the first and last # parameters will take the first and last arguments respectively, w...
true
07735b8790630982792fb0cf479fea043a0410f8
Ruby
TNHuang/poker
/spec/Player_spec.rb
UTF-8
788
2.75
3
[]
no_license
require 'player' describe Player do let(:hand) { double(:hand) } subject(:player) { Player.new("Name", hand, 100) } it 'should have a name' do expect(player.name.nil?).to be false end it 'pot should start with 0' do expect(player.pot).to eq(0) end it 'should have bank account' do expect(pla...
true
80bb0ff9af54e3948563c7a1a76a1a9baf56da71
Ruby
matti/worker
/examples/simple.rb
UTF-8
175
3.015625
3
[ "MIT" ]
permissive
require_relative "../lib/worker" adder = Worker.new do |a,b| a + b end multiplier = Worker.new do |a,b| a * b end puts adder.perform 1, 2 puts multiplier.perform 10, 2
true
c1d2d7991646fa5e3dad6109df77bcacf3ef927a
Ruby
davetroy/geohash
/lib/geohash_java.rb
UTF-8
1,089
2.921875
3
[ "LicenseRef-scancode-public-domain", "MIT" ]
permissive
require 'java' require File.expand_path('../geohash-java.jar', __FILE__) class GeoHash class <<self JavaGeoHash = Java::ChHsrGeohash::GeoHash def encode_base(lat, lon, precision) JavaGeoHash.with_character_precision(lat, lon, precision).to_base32 end def decode_base(geohash) point = Jav...
true
73d8a845a409b16e7eed1463e75b4c154c99df61
Ruby
govaniso/phidgets-ffi
/lib/phidgets-ffi/rfid.rb
UTF-8
8,270
2.78125
3
[]
no_license
module Phidgets # This class represents a CPhidgetRFID. class RFID Klass = Phidgets::FFI::CPhidgetRFID include Phidgets::Common # Collection of digital outputs # @return [RFIDOutputs] attr_reader :outputs attr_reader :attributes # The attributes of a PhidgetRFID def attributes su...
true
69039a92a47022f3c99f0db3221167b61eb1090d
Ruby
babelsberg/babelsberg-k
/2_reals/cassowary-gateway.rb
UTF-8
2,343
2.953125
3
[]
no_license
#!/usr/bin/env ruby require "bundler/setup" require "cassowary" variables = {} class SexpSolver include Cassowary attr_reader :variables def initialize(variables) @variables = variables end def parse_and_solve(str) sexp = str.strip whitespace = " \n\r\t" atom_end = whitespace + "()" c...
true
af9e644c044ffd5b0798e6656d7d1b1f508214c5
Ruby
oscos/launch_school
/rb101/small_problems/easy5/x03.rb
UTF-8
1,906
4.0625
4
[]
no_license
=begin Launch School: RB101-RB109 - Small Problems - Easy 5 ExerciseName: [After Midnight (Part 2)](https://launchschool.com/exercises/34f92353) FileName: x03.rb Answered On: 10/29/2020 Updated On: 02/26/2021 =end =begin As seen in the previous exercise, the time of day can be represented as the number of minutes bef...
true
c075b3a4dbde23306e41438475f2841dbeb900d7
Ruby
vhforbes/sub-strings
/sub_strings.rb
UTF-8
361
3.796875
4
[]
no_license
string = "Howdy partner, sit down! How's it going?" array = ["below","down","go","going","horn","how","howdy","it","i","low","own","part","partner","sit"] def substrings(string, array) hash = Hash.new(0) string = string.downcase array.each do |elm| if string.include?(elm) hash[elm] = 1 end end ...
true
620280aa35b9e8648cabb8d504e084dcfe682b6a
Ruby
Shelldon-CLI/shelldon
/lib/helpers/confirmation.rb
UTF-8
391
3.046875
3
[ "MIT" ]
permissive
module Shelldon class Confirmation def self.ask(*args) new(*args).ask end def initialize(msg = 'Confirm? (y/n)', ok = %w(y Y yes Yes YES)) @msg = msg @ok = ok end def ask puts @msg print '> ' response = $stdin.gets.chomp @ok.include?(...
true
531a2d08b9a9f381da742e86da80ff51be1ff609
Ruby
2called-chaos/mcl
/vendor/handlers/_buildin/lagtrack/lagtrack.rb
UTF-8
5,905
2.59375
3
[ "MIT" ]
permissive
# module Mcl Mcl.reloadable(:HMclLagtrack) ## Lagtrack (tracks minecraft server lag) # !lagtrack # !lagtrack help # !lagtrack log [-w <world>] [-m <max_entries=42>] # !lagtrack announce [<target>|false] # !lagtrack stat [-w <world>] [-d <days>|-h <hours=12>] class HMclLagtrack < Handler def setup ...
true
ac87eb77aeaa388f5335b6b64db5c6b9e2c19e6a
Ruby
mshafiqsb/rcs-common
/lib/rcs-common/cgi.rb
UTF-8
155
2.53125
3
[]
no_license
require 'cgi' class CGI def self.encode_query(hash) return hash.map{|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join("&") end end
true
cb733d1429b838badaf82acb51a3af19ca022de5
Ruby
mincklem/bewd_19_finalproject_mincklem
/lib/review_api.rb
UTF-8
1,291
2.546875
3
[]
no_license
module ReviewApi class CalledReviews def gr_reviews(isbn) @gr_reviews_array = [] @isbn = isbn @api_url = "http://www.fanpagelist.com/analytics/reviews.php?api_key=91bee4c36&q=#{@isbn}&search_type=book_id&result_type=goodreads&page=1" response = JSON.load(RestClient.get(@api_url)) puts response ...
true
3f2cfb20ab48d5d48efbd107af8126c0bfafc347
Ruby
baccigalupi/fauxy-rb-parser
/lib/statement.rb
UTF-8
583
3.078125
3
[]
no_license
module Fauxy class Statement attr_accessor :type attr_reader :value extend Forwardable def_delegators :@value, :size, :<<, :map, :each, :first, :last, :[] def initialize(type=nil, val=nil) self.type = type if type @value = [] value << val if val end def add(val) ...
true
20d26da6080fb8c4e809c5ecfcc82acc09dd6f2d
Ruby
shinyjiggly/terrible-game-2
/script collection/Extra_Autotiles/Data/Scripts/EIS_Requirements.rb
UTF-8
26,858
2.609375
3
[]
no_license
#============================================================================== # ** Equipment, Item & Skill Requirements (EIS) #------------------------------------------------------------------------------ # SephirothSpawn # Version 0.9 a # 2006-10-30 #-----------------------------------------------------------------...
true
e30d3d89c3ef0b76cd79815d2467c22029ece213
Ruby
ashishb/homebrew-cask
/lib/cask/cli/install.rb
UTF-8
1,580
2.75
3
[ "BSD-2-Clause" ]
permissive
class Cask::CLI::Install < Cask::CLI::Base def self.run(*args) raise CaskUnspecifiedError if args.empty? cask_names = args.reject { |a| a.chars.first == '-' } force = args.include? '--force' retval = install_casks cask_names, force # retval is ternary: true/false/nil if retval.nil? raise...
true
49c3f81f70f9ff956bd8a8e90ee61cc2d551dced
Ruby
tamc/ruby-script-writer
/lib/rubyspecwriter.rb
UTF-8
403
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'rubyscriptwriter' class RubySpecWriter < RubyScriptWriter def put_description(thing_being_described) puts "describe ", thing_being_described, " do" indent yield self outdent puts "end" puts end def put_spec(specficiation_in_words) puts "it '",specficiation_in_words.tr("'",...
true
6016c75b90148dadcaa14fecb9284c719be93c4e
Ruby
redhataccess/ascii_binder
/lib/ascii_binder/distro.rb
UTF-8
3,049
3
3
[ "MIT" ]
permissive
require 'ascii_binder/distro_branch' require 'ascii_binder/helpers' require 'ascii_binder/site' require 'trollop' include AsciiBinder::Helpers module AsciiBinder class Distro attr_reader :id, :name, :author, :site def initialize(distro_map_filepath,distro_key,distro_config) @id = distro_key ...
true
9b032dc34ede53471808201e8818a063a3461feb
Ruby
Nanosim-LIG/darwinning
/spec/organism_spec.rb
UTF-8
777
2.671875
3
[]
no_license
require_relative 'spec_helper' describe Darwinning::Organism do let(:org) { Darwinning::Organism.new } let(:triple) { Triple.new } it "name should default to blank" do expect(org.name).to eq "" end it "genes should default to empty array" do expect(org.genes).to eq [] end it "genotypes should ...
true
c77f41428dacc8482baddce48604301be601d098
Ruby
lazylazylazy/Boris-Bikes
/spec/bike_container_spec.rb
UTF-8
1,281
3.203125
3
[]
no_license
require_relative '../lib/docking_station' require_relative '../lib/bike_container' require_relative '../lib/bike' class ContainerHolder; include BikeContainer; end describe BikeContainer do let(:bike) { Bike.new } let(:holder) { ContainerHolder.new } it 'should accept a bike' do expect(holder.bike_count).to e...
true
fe13c51a84ca83d4f4b07ed10ba4ba5a4a255213
Ruby
YashUppal/appAcademy
/Ruby/Object-Oriented Programming/Class Inheritance/manager.rb
UTF-8
583
3.28125
3
[]
no_license
require_relative 'employee' class Manager < Employee attr_reader :assigned def initialize(name,title,salary,boss,assigned) super(name,title,salary,boss) @assigned = assigned end def bonus(multiplier) return self.sub_salaries * multiplier end def sub_salaries # total salaries of subordi...
true
e1108b6d90734c640fdd283ee453576bab051c01
Ruby
longnh92/MessengerBotSample
/app/bot/listen.rb
UTF-8
2,538
2.546875
3
[]
no_license
require "facebook/messenger" include Facebook::Messenger Facebook::Messenger::Subscriptions.subscribe(access_token: ENV["ACCESS_TOKEN"]) def prompt_user_to_choose_operation(message) message.reply( text: 'Hi, Please choose an operation (Add, Multiply)', quick_replies: [ { content_type: '...
true
0a64d04e6a5a7d972f1104c41f5ee74ac763a0c9
Ruby
hansenjl/week-3-pod-challenge
/author.rb
UTF-8
420
3.25
3
[]
no_license
# Create an Author class. # An author can be initialized optionally with a name. If no name is provided, the author name should be "unkown" # Every author that is created should be saved upon initialization. # An Author has many articles that they've written. # An author also has many magazines through articles. # Crea...
true
116b6077679ef23d81617083e09c410b745a01cc
Ruby
nickborbe/bootcamp
/week_1/Day_2/pp_payroll/Lib/payroll_class.rb
UTF-8
489
3.09375
3
[]
no_license
class Payroll def initialize(employees) @employees = employees end def pay_employees payroll_total = 0 array = [] @employees.each do |person| array << person end array.each do |thing| puts "#{thing.name}: #{thing.calculate_salary}" payroll_total += thing.calculate_salary end puts "total payrol...
true
64640bf9bb05037ffe745fed24f8927bf45f7f6b
Ruby
montehoover/homeventory
/app/controllers/items_controller.rb
UTF-8
2,191
2.65625
3
[ "Apache-2.0" ]
permissive
class ItemsController < ApplicationController before_action :is_authenticated? def index @items = Item.where({user_id: @current_user.id}) end def show @item = Item.find params[:id] end def new @item = Item.new end # Check to see if item already exists; if so, update it and add to the exis...
true
473fa772d0b2a880e8a6adb2fbac4a670c9c02d2
Ruby
AnanthSrinivasan/Projects
/SideProjects/RubyApplication1/RubyApplication1/TestInput.rb
UTF-8
995
3.09375
3
[]
no_license
require 'C:\Users\amanoharan\Documents\Visual Studio 2010\Projects\RubyApplication1\RubyApplication1\main_file.rb' require 'C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\ruby-dictionary-1.0.1\lib\ruby-dictionary.rb' #form the dictionary with valid words #dictionary = Dictionary.new(%w(Silver Gold Iron glob prok...
true
bbae329dda63ca691ea6b76b36075d153a4a7008
Ruby
JhonnyTheRipper/Math-projects
/105torus_2017/resources.rb
UTF-8
1,146
3.65625
4
[]
no_license
def biser_me(a0, a1, a2, a3, a4, n) d = 0 x1 = 0.0; x2 = 1.0; while d < n do xm = (x1.abs + x2.abs) / 2 a = a4 * x1**4 + a3 * x1**3 + a2 * x1**2 + a1 * x1**1 + a0 b = a4 * x2**4 + a3 * x2**3 + a2 * x2**2 + a1 * x2**1 + a0 c = a4 * xm**4 + a3 * xm**3 + a2 * xm**2 + a1 * xm**1 + a0 d = xm.to_...
true
383b9b6db92f04291b0ce76bf8a1ba8ff0c99064
Ruby
arizz96/ruby-json-transformer
/configuration.rb
UTF-8
717
2.78125
3
[]
no_license
require 'ostruct' class Configuration attr_reader :config def initialize(source:) @config = source _verify! end %w(source destination).each do |node_type| define_method("#{node_type}") do @config[node_type] end define_method("#{node_type}_type") do @config[node_type]['type']...
true
9c63103e1f94c74d15bb0c9bb0fcb9dbe156efa2
Ruby
TBenedyk/weblog_parser
/lib/log_parser.rb
UTF-8
586
3.15625
3
[]
no_license
# frozen_string_literal: true require_relative 'log_entry' class LogParser def initialize(file) @file = file @entries = [] end def self.call(file:) new(file).call end def call parse_file entries rescue StandardError => e puts "Error: #{e.message}" end attr_reader :entries, :...
true
bca61ddc75b8dc19be0770eeaed97d67b078afa0
Ruby
hynsondevelops/Chess
/spec/Pawn_spec.rb
UTF-8
1,018
3.15625
3
[]
no_license
require 'spec_helper' describe Pawn do describe "#new" do it "Creates a Pawn object" do pawn = Pawn.new(1, 2, 2) expect(pawn).to be_an_instance_of(Pawn) end it "Stores the row, column, and player" do pawn = Pawn.new(1, 2, 2) expect(pawn.row).to be(1) expect(pawn.col).to be(2) expect(pawn.p...
true
00c7466b21f37dbdcbdea38c0ecd6c343c5b4fcf
Ruby
danachen/Ruby
/LS101/easy8/p1.rb
UTF-8
1,060
4.25
4
[]
no_license
# Prob one: Sum of Sums # Write a method that takes an Array of numbers and then returns the sum of the sums of each # leading subsequence for that Array. You may assume that the Array always contains at # least one number. # loop through each number, loop 1, counter=0, take 3, loop 2, counter=1, take 3..5, have a ...
true
9b3c672a38680ac342b35a0fe594080557208406
Ruby
yots2016/Ruby-video-lessons
/Projects/bak/2/MyApp1/app7.rb
IBM866
231
2.859375
3
[]
no_license
# encoding: cp866 print "Enter X ਢ?!: " x = gets.chomp print "Enter Y: " y = gets.chomp print "Enter Z: " z = gets.chomp #puts "x = " + x.chomp + " y = " + y.chomp + " z = " + z.chomp puts "x = #{x} y = #{y} z = #{z}"
true
6a5e4591db30e1bdd4307bce1cbced909a0269a6
Ruby
ciscodesign/RackTask
/helpers.rb
UTF-8
2,623
2.921875
3
[]
no_license
def find_task(id) # puts "searching for #{id}..." result = false Rake::FileList["#{ROOT}/*"].each do |f| f.slice!("#{ROOT}/") compare = f.dup tag_purge(compare) if get_id(compare).eql? id result = f # puts "founded #{result}" break end end result end def files_number...
true
690a118e28843eb6451cace1a3e62d7652e8da1a
Ruby
amassaad/york-dash
/jobs/octranspo.rb
UTF-8
1,534
2.53125
3
[]
no_license
# require 'octranspo_fetch' # APPLICATION_ID = ENV['OC_ID'] # APPLICATION_KEY = ENV['OC_KEY'] # MAX_RESULTS = 4 # STOPS = { # "3009" => {description: "Rideau Street", buses: [1,95,97]}, # "3000" => {description: "Rideau Center (bridge)", buses: [8, 95, 97]} # } # oct = OCTranspo.new({application_id: APPLI...
true
ce68a43e3f7d1ac72f2fc0d2c56e4c9e89cf0340
Ruby
strviola/ruby_fractal
/003_cairo_fractal/carpet.rb
UTF-8
1,040
3
3
[]
no_license
require 'cairo' size = 2400.0 surface = Cairo::ImageSurface.new(:argb32, size, size) context = Cairo::Context.new(surface) # 背景 context.fill do context.set_source_rgb(0.2, 0, 0.2) # dark purple context.rectangle(0, 0, size, size) end def draw_squares(cairo_context, base_size, step) division_level = 3 ** step ...
true
91f9690b81d683ad4a411a49512f77b143d05061
Ruby
yalokin/thinknetica_basic_course
/Lesson8/station.rb
UTF-8
1,025
3.328125
3
[]
no_license
require_relative 'instance_counter' require_relative 'validate' class Station include Validate @@stations = {} def self.all @@stations end def self.find(name) raise 'Station does not exists' if @@stations[name].nil? @@stations[name] end def self.exist?(name) true if @@stations[name] ...
true
5914b8ccc3ca0236f675e852fdc2f896e92f2546
Ruby
gustly/params_parser
/lib/params_parser.rb
UTF-8
1,114
2.734375
3
[ "MIT" ]
permissive
module ParamsParser module Transforms ID = lambda { |x| x }.freeze end class Parser def initialize(config) @config = Hash[config.map do |(key, param_config)| [key, ParamConfig.new(key, param_config)] end] end def parse(params) params.class.new.tap do |parsed_params| ...
true
dc25f07922373c8300ba2f55427020feea076bb3
Ruby
aarthykp/ruby-in-the-rubble
/first_file.rb
UTF-8
232
2.875
3
[]
no_license
puts 4 + 4 puts 4 + 3 puts 5 * 6 puts 30/6 puts 30 * 4 print 3 + 1 print 5 * 2 print "\n" first_name = "Aarthy" lat_name ="palanivelu" favorite_color = "red" puts "hi,my name is " + first_name + "my fav color is " + favorite_color
true
b9ee1d60163de5f59c5384f481525ad1293baa6d
Ruby
eduardogpg/androidCopy
/ScriptRubyCopy.rb
UTF-8
221
2.984375
3
[]
no_license
require 'fileutils' class Copiar def initialize() end def copiar() desde = ARGV[0] hasta = ARGV[1] puts desde puts hasta FileUtils.cp_r(Dir[desde+"/*"],hasta) end end objeto = Copiar.new() objeto.copiar
true
22acfed0e3d6c6a61c8847670570b62926ec15d8
Ruby
sagarpanta/CricketAnalysis
/app/models/client.rb
UTF-8
1,883
2.53125
3
[]
no_license
class Client < ActiveRecord::Base attr_accessible :encrypted_password, :encrypted_password_confirmation, :remember_token, :username, :email, :temppass, :name, :country, :actype validates_uniqueness_of :username, :email, :name validates_presence_of :username, :encrypted_password , :email, :name validates :enc...
true
2c1e19e1577c360e0f3e682c754965793f146a50
Ruby
SchruteFarms23/tweet-shortener-web-071717
/tweet_shortener.rb
UTF-8
948
3.859375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. # "hello" becomes 'hi' # "to, two, too" become '2' # "for, four" become '4' # 'be' becomes 'b' # 'you' becomes 'u' # "at" becomes "@" # "and" becomes "&" def dictionary(word) dictionary = {"hello"=>"hi","to"=>"2","two"=>"2","too"=>"2","for"=>"4","four"=>"4","be"=>"b","you"=>"u","at"=>"@","and...
true
374d35cf1fb614bd96f846e1ec377b9b85af0b16
Ruby
MarioPOrlando/AA_ClassWork
/W3D5/knights_travails.rb
UTF-8
1,560
3.65625
4
[]
no_license
require_relative "poly_node.rb" class KnightPathFinder attr_reader :considered_positions def initialize @position = [0,0] @root_node = PolyTreeNode.new(@position) @considered_positions = [] build_move_tree end def build_move_tree nodes = [@root_node] until nod...
true
c5508d82e6c0461583a8fa66d09ac3ab6624b7cb
Ruby
jdaviderb/advent-of-code-2019
/day 1/part-1.rb
UTF-8
145
3.390625
3
[]
no_license
input = File.open('./input').read.split.map(&:to_i) def calculate_fuel(mass) mass / 3 - 2 end puts input.sum { |mass| calculate_fuel(mass) }
true
3766e1b365b9511b42753d7622b84c5cda093476
Ruby
MichaelKTHP/Morpion---S3J4
/lib/app/board.rb
UTF-8
2,588
3.578125
4
[]
no_license
require_relative 'player' require 'pry' require 'colorize' class Board attr_accessor :a1, :a2, :a3, :b1, :b2, :b3, :c1, :c2, :c3 attr_accessor :a1c, :a2c, :a3c, :b1c, :b2c, :b3c, :c1c, :c2c, :c3c attr_accessor :compteur def initialize(a1s=" ", a2s=" ", a3s= " ", b1s=" ", b2s= " ",b3s= " ", c1s= " ", c2s=" ",c3s= " ...
true
72954a4562bda8cae4b20b7e0c237bdc7102dbbd
Ruby
JoseJRVazquez/My-personal-ruby-formula
/playtoy.rb
UTF-8
5,280
3.71875
4
[]
no_license
#The following is a test file where I am putting methods I have been trying #and will likely be useful in developing the website MVP I am working on require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :...
true
7fc3a866a05d0745cbfea8a688b0c74518bdaa0d
Ruby
moqingxinai/pujara-emnlp17
/scripts/data-processing/nell/parseNell.rb
UTF-8
6,595
2.921875
3
[]
no_license
require 'fileutils' require 'uri' # The full set of Nell files is pretty huge. # Even holding a single column in memory can be tens of gigs. # So, we will be optimizing for low memory usage at the cost of speed. # We will let the DB handle de-duplication. SKIP_FIRST_LINE = true # Batch the inserts so we don't run ou...
true
9927e668ab268f99fc21099c7250db46f649447b
Ruby
cjhdev/dlms_trouble
/lib/dlms_trouble/dtype/d_integer.rb
UTF-8
2,236
2.609375
3
[ "MIT" ]
permissive
# Copyright (c) 2016 Cameron Harper # # 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, publish, dis...
true
0db3bbd639b8fd5b832575a5f23bab40fb5962b5
Ruby
BaptisteHamain/promo-2-challenges
/02-OOP/04-Public-Interface/lib/account.rb
UTF-8
1,554
3.671875
4
[]
no_license
require_relative "transaction" class DepositError < StandardError end class BankAccount MIN_DEPOSIT = 100 def initialize(name, iban, initial_deposit, password) raise DepositError, "Insufficient deposit" unless initial_deposit > MIN_DEPOSIT @password = password @transactions = [] @position = 0 ...
true
cda06f739efedc9dc66854c40fcd3b7f2881fbc6
Ruby
tarasabella/deli-counter-dumbo-web-121018
/deli_counter.rb
UTF-8
306
3.59375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. katz_deli = [] def take_a_number(katz_deli, name) puts "Welcome #{name}. You are number #{katz_deli} in line." end end def line(katz_deli) if katz_deli == 0 puts "The line is currently empty." end end def now_serving(katz_deli) puts "Currently serving #{name}." end
true
7d576120b0ff15103bd6775f8d8c46f2e07feaa6
Ruby
YukiTamura14/html_ruby_sinatra
/Ruby_INTRO_diver/Ruby_24.1.rb
UTF-8
239
2.6875
3
[]
no_license
index = ["以下より行う操作を選んでください","1:ブログを作成する","2:作成されたブログを見る","3:ブログアプリを終了する"] index.each do |blog| puts blog end number = gets.to_i
true
910b5136b6353c2fb831178544f71d6bb845ab83
Ruby
serdarnuryyev/week-2
/class_one.rb
UTF-8
159
2.515625
3
[]
no_license
puts" hello aman" name = " Serdar " last_name = " Nuryyev " city = " Nohur " dob = " 10.18.1990 " puts name + last_name + city + dob puts name + ' eshek ogly eshek'
true
012ca9ffb6e20de4e9532075fb0e8e529a898b8a
Ruby
kenny-va/iOS-Omniture-automation
/print_content_types.rb
UTF-8
1,659
2.828125
3
[]
no_license
# This routine prints out an individual test and includes all formatting. # require './biz_validate.rb' def print_content_types(hf) is_unique = true hf.write("<table style='width:100%'><tr class='begin_test_style'><td>LIST OF CONTENT TYPES PER TEST</td><td>FRONT</td><td>FIELD</td><td>VALUE</td></tr>") (...
true
cb99a1fc2c293d181f11b3eb7bbed0516477ebf5
Ruby
carmen0208/rubyDesignPattern
/Factory/factory_method_test.rb
UTF-8
457
2.671875
3
[]
no_license
require 'minitest/autorun' require 'pp' require_relative 'duck' require_relative 'frog' require_relative 'factory_method' class FactoryMethodPoneTest < Minitest::Test def test_duck_pond p = DuckPond.new(1) assert_equal Duck, p.instance_variable_get(:@animals)[0].class p.simulate_one_day end def te...
true
12c222334f39ba3f9ddb6acb5bc05046d5f9d3a0
Ruby
pseudopeach/movie-pick
/app/models/util.rb
UTF-8
954
2.625
3
[]
no_license
class Util require 'net/http' require 'net/https' def self.json_api_get base_URI, params=nil, cookie="" response = {raw: (Net::HTTP.get_response(base_URI,"/"+Util.hash_to_qs(params))) } #puts "cookie#{cookie.inspect}" if cookie #request = Net::HTTP::Get.new( "#{uri.request_uri}#{Util.hash_to_qs par...
true
aff2ce8d7a5ef706731abf310ec68620b28dfd34
Ruby
blaix/ruby_gpg
/lib/ruby_gpg.rb
UTF-8
2,235
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'open3' module RubyGpg extend self Config = Struct.new(:executable, :homedir) def config @config ||= Config.new("gpg", "~/.gnupg") end def gpg_command gpg_command_string end def encrypt(file, recipient, opts = {}) options = { :armor => false }.merge(opts) outp...
true
c77e34d6bb0de9c9fe3bbb8b50c58950c68380a3
Ruby
eliseKos/matasano_challenge
/set2/chal11/chal11.rb
UTF-8
1,193
3.484375
3
[]
no_license
#!/usr/bin/env ruby #technion@lolware.net require 'openssl'; Blocksize = 16; #128-bit blocksize for AES def encryption_oracle(input) if input.length % Blocksize != 0 raise "Incompatible blocksize"; end #Append and prepend a random number of bytes. The byte itself is constant input = 'k' * ra...
true
0aa6ac0f79519d003c5833640d35b6df468c24b6
Ruby
howardesuarez/heroes
/lib/hero.rb
UTF-8
661
3.015625
3
[ "MIT" ]
permissive
class Hero attr_accessor :name attr_writer :biography, :appearance, :connections @@all = [] def initialize(name, biography, appearance, connections) self.name = name self.biography = biography self.appearance = appearance self.connections = connections self.cla...
true
67eb9bb257e536a79db1fd3e21c2d27612ad6f9f
Ruby
Luxarea/lrthw
/ex12.rb
UTF-8
431
3.84375
4
[]
no_license
print "Give me a number: " number = gets.chomp.to_i bigger = number * 100 puts "A bigger number is #{bigger}." print "Give me another number: " another = gets.chomp number = another.to_i smaller = number / 100 puts "A smaller number is #{smaller}." print "Give me a number I want to try something ! And it's an order...
true
768635a09c87624e163528da24ee5b4d2ec3fa6e
Ruby
mskeen/adventofcode
/2015/day17/eggnog.rb
UTF-8
717
2.90625
3
[]
no_license
@source_buckets = [11, 30, 47, 31, 32, 36, 3, 1, 5, 3, 32, 36, 15, 11, 46, 26, 28, 1, 19, 3] @target = 150 @bits = @source_buckets.size total_count = best_bit_count_freq = 0 best_bit_count = @bits (1..(2**@bits - 1)).each do |i| sum = bit_count = 0 (0..(@bits - 1)).each do |index| if ((2 ** index) & i) > 0 ...
true
bc05e1efb6b0eb5d5121ae487a9dacfb59c95876
Ruby
knights-who-say-nil/todo_with_tests_app
/spec/models/list_spec.rb
UTF-8
2,642
2.546875
3
[]
no_license
require 'rails_helper' RSpec.describe List, type: :model do describe '#complete_all_tasks!' do it 'should mark all tasks from the list as complete' do list = List.create(name: "Grocery List") Task.create(list_id: list.id, complete: false) Task.create(list_id: list.id, complete: false) ...
true
bde7c754ce99c66b95cca4a96b418e0e542ecb47
Ruby
antunderwood/eschaton
/slices/google_maps/google/bounds.rb
UTF-8
1,031
3.0625
3
[ "MIT" ]
permissive
module Google # Represents a rectangle in geographical coordinates, including one that crosses the 180 degrees meridian. # See googles online[http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds] docs for details. class Bounds < MapObject attr_reader :south_west_point, :north_east_poin...
true
c11e6bf4e38f38f6723255c1787633c42405e50e
Ruby
miguelakira/ruby-spreadsheet
/spreadsheet.rb
UTF-8
1,353
3.609375
4
[]
no_license
require "pp" class Spreadsheet attr_accessor :cells def initialize @cells = {} end def add_cell(column, row, value) cell = Cell.new(self, column, row, value) cells[cell.location] = cell end def find_cell(location) location = location.upcase.to_sym cells[location] end def find_ce...
true
1a37f74f1f4ca4282a30c5d04bfbd820c8725ec0
Ruby
weskleymb/pdti-ruby-respostas-exercicio01
/resposta03.rb
UTF-8
264
4.125
4
[]
no_license
# Faça um Programa que peça dois números e imprima a soma. puts "Informe o número 01" numero1 = gets.chomp.to_i puts "Informe o número 02" numero2 = gets.chomp.to_i soma = numero1 + numero2 puts "O resulta do soma de #{numero1} com #{numero2} é #{soma}"
true
6b4b3d43131750d2aa8989ec570195ddc65e55ea
Ruby
Andyreyesgo/Gen45
/objetcs/Challenge2/Fallos/cagarla2.rb
UTF-8
995
3.890625
4
[]
no_license
class Persona attr_accessor :first , :last, :age, :type def initialize (first, last, age, type) @first_name = first @last_name = last @age =age @type =type end def birthday @age +=1 end end class Student < Persona def acciones talk ...
true
b2aa72f5933755ec1d14fc06385afaf02fd05e22
Ruby
Arcath/Markabb
/spec/markabb_callback_spec.rb
UTF-8
1,144
2.578125
3
[]
no_license
require 'spec_helper' describe Markabb::Callback do it "should take a proc" do cb = Markabb::Callback.new(Proc.new { }) end it "should take an argument and pass it to the proc" do sample_callback.run("this").should eq "THIS" end it "should allow callbacks to be called from...
true
b87ad386f207649f4cb1812576ab0f6d16810821
Ruby
alex-woods89/ruby_vet_project
/ruby_project/models/pet.rb
UTF-8
2,119
3.234375
3
[]
no_license
require_relative('../db/sql_runner') class Pet attr_accessor :id, :name, :dob, :type_of_animal, :treatment_notes, :vet_id, :customer_id, :consultation_id def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @dob = options['dob'] @type_of_animal = options['type_of_animal']...
true
5c6065bf69af38fa2c49af53f0fb8ad6d8cb4cb2
Ruby
ryanwanger/boarding-simulator
/aisle.rb
UTF-8
1,954
3.3125
3
[]
no_license
class Aisle attr_accessor :rows def initialize(airplane, window = nil) @rows = Array.new airplane.rows @airplane = airplane @window = window end def tick row_number = @rows.count while row_number > 0 if has_passenger?(row_number) && reached_seat?(row_number) seat_passenger ...
true
79d024e1c8bcddf29439030052f09c182ea4cbf2
Ruby
dwhite96/data-structures
/stack.rb
UTF-8
2,910
3.96875
4
[ "MIT" ]
permissive
require_relative "linked_list" # Implement a Stack class using a linked list class Stack class UnderflowError < StandardError; end def initialize @list = LinkedList.new end # Places +item+ on the top of the stack # O(1) time def push(item) @list.unshift(item) end # Removes the item on the t...
true
f811bd4ce0259613179e2b4fa1721ae1cd4d1c41
Ruby
augustingombault/backend-configs
/getaround_utils/spec/getaround_utils/utils/deep_key_value_spec.rb
UTF-8
3,502
2.625
3
[]
no_license
require "spec_helper" describe GetaroundUtils::Utils::DeepKeyValue do let(:subject) { described_class } describe '.serialize' do context 'with numbers' do it 'serializes a number correctly' do expect(subject.serialize(42)).to eq('42') end it 'serializes a nested number correctly' do...
true
9e7f8c3c54f101753e3d1bf54d5e99e04d3653ac
Ruby
andredublin/iterated-prisoners-dilemma
/ipd.rb
UTF-8
1,673
3.734375
4
[ "MIT" ]
permissive
require 'hamster/list' require 'hamster/hash' module Prisoner def prisoner(name, strategy) Hamster.hash(name: name, strategy: strategy, moves: Hamster.list, total: 0) end end module Strategy def strategy(strategy) -> mover, other { strategy.(mover[:moves], other[:moves]) } end def always_cooperate(...
true
d274e3d3890d6299433a4de54f9c503177d4a654
Ruby
aleebrady/learn_co
/activerecord-validations-lab-v-000/app/models/post.rb
UTF-8
457
2.625
3
[ "MIT" ]
permissive
class Post < ActiveRecord::Base validates :title, presence: true validates :content, length: { minimum: 100 } validates :summary, length: { maximum: 100 } validates :category, inclusion: { in: %w(Fiction Non-Fiction) } validate :clickbait? def clickbait? valid_clickbait = [/Won't Believe/, /Secret/, /T...
true
288f868c879fe875cfd4fe87547bcf3fb00f84d8
Ruby
C0mbed/ttt-with-ai-project-onl01-seng-pt-050420
/lib/players/human.rb
UTF-8
208
2.859375
3
[]
no_license
module Players class Human < Player def move(board) system('clear') board.display puts('') puts("Player #{@token} please choose a position") gets.strip end end end
true
e59483bb7edce219a5ae4af79c1e00677f89fd57
Ruby
HLuning/Launch-School-Core-Curriculum
/RB101_Programming_Foundations/small_problems/tip_calculator.rb
UTF-8
291
4.09375
4
[]
no_license
puts "What is the amount of the bill? " bill = gets.chomp.to_f puts "What is the tip percentage? ( f.e. enter '5' for 5% ) " percentage = (gets.chomp.to_f) / 100 tip = (bill * percentage).round(2) total = (bill + tip).round(2) puts "The tip is €#{tip}." puts "The total is €#{total}."
true
8b085b2ebadae9f947a27f0e2840e143e3ea3ad1
Ruby
nick-b/shinmun
/lib/shinmun.rb
UTF-8
10,203
3.0625
3
[]
no_license
require 'fileutils' require 'erb' require 'yaml' require 'uuid' require 'bluecloth' # A small and beautiful blog engine. module Shinmun # This class represents an article or page. # A post has a header and body text. # Example: # --- # category: Ruby # guid: 7ad04f10-5dd6-012b-b53c-001a92975b...
true
4f9ad9783b3d78eab3511f6fce61cab5eaf3e1cd
Ruby
ludwiggj/ruby-pickaxe
/ch17-character-encodings/06_sjis_encoded.rb
UTF-8
292
2.859375
3
[]
no_license
# encoding: sjis require_relative '06_iso-8859-1' require_relative '06_utf' def show_encoding(str) puts "'#{str.bytes.to_a}' (#{str.size} chars, #{str.bytesize} bytes) " + "has encoding #{str.encoding.name}" end show_encoding(STRING_ISO) show_encoding(STRING_U) show_encoding("cat")
true
1680d99892ca3af02ea862bd8bffb48ef59cca46
Ruby
bastienreb/tests-ruby
/lib/04_simon_says.rb
UTF-8
484
3.875
4
[]
no_license
def echo(word) return (word) end def shout(word) return word.upcase end def repeat(word, b=2) return [word] * b * " " end def start_of_word(a, b) return a[0,b] end def first_word(lines) return lines.split.first end def titleize(a) a.capitalize! words_no_cap = ["and", "or", "the", "to", "the", "a", "b...
true