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
ae445510394be8ebf007d5979d18f630d998e50e
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz54_sols/solutions/Interfecus/indexer.rb
UTF-8
2,179
4.09375
4
[ "MIT" ]
permissive
class Catalogue def initialize(start_docs=[[]]) #Expects an array of [space-delimited keyword list, object to catalogue] arrays for each initial object @keywords = Array.new #Array of used keywords. Position is important. @cat_objects = Array.new #Array of [keyword bitfield, stored object] arrays start_docs.eac...
true
193faf532d90e9e502a7fba027411059d5882d6c
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz120_sols/solutions/Jesse Merriman/state.rb
UTF-8
5,932
3.796875
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby # state.rb # Ruby Quiz 120: Magic Fingers require 'constants' require 'outcome' require 'set' # Represents one state of the game, which includes how many fingers are on each # player's hands, and whose turn it is. States can also have parents, and a # best_outcome can be assigned to them, though t...
true
d647db3ed621256a1bf0b263b43546e577b02364
Ruby
miofmelanezzer22/tyler-git
/bin/git-branches-commit-is-in
UTF-8
521
2.53125
3
[]
no_license
#!/usr/bin/env ruby # I was able to do git log <sha> for a commit that a saw a notification for # but it wasn't listed in the log for master and I wanted to know which # branch it WAS in (if not master).... # (turned out it was in origin/test, for which I had no tracking local branch, # so gitk wouldn't even let me j...
true
dc32db475f719d779fb5a7d267c69612d033a4c7
Ruby
jamesrnelson/enigma
/test/offset_calculator_test.rb
UTF-8
878
2.796875
3
[]
no_license
require 'simplecov' require 'minitest/autorun' require 'minitest/pride' require './lib/offset_calculator' require './lib/keygen' require 'Date' SimpleCov.start class OffsetCalculatorTest < Minitest::Test def setup date = Date.new(2018, 2, 5) @offset = OffsetCalculator.new(date, 1, 1) end def test_offse...
true
955eeab341495a72d0cd13673ad30e582410e049
Ruby
FKnottenbelt/LS_130
/lesson_2_testing/09_more_topics/easy1/01_enumerable_class.rb
UTF-8
912
3.953125
4
[]
no_license
=begin Assume we have a Tree class that implements a binary tree. class Tree ... end A binary tree is just one of many forms of collections, such as Arrays, Hashes, Stacks, Sets, and more. All of these collection classes include the Enumerable module, which means they have access to an each method, as well as many ...
true
afa29151ba6cfc8b7f69748c0c78fc26a47bccd5
Ruby
Trevorsuter/hipster_food
/test/event_test.rb
UTF-8
1,870
3.1875
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require 'mocha/minitest' require 'pry' require './lib/item' require './lib/food_truck' require './lib/event' class EventTest < MiniTest::Test def setup @event = Event.new("South Pearl Street Farmers Market") @food_truck = FoodTruck.new("Rocky Mountain Pies...
true
aed9e8cefe736997e9dd9e4fb20b26697050c235
Ruby
Yamikamisama/PatsRottenTomatoes
/app/models/user.rb
UTF-8
1,318
2.5625
3
[]
no_license
class User < ActiveRecord::Base has_many :movies has_many :filters #CHECK FOR NEW MOVIES EVERY REFRESH def movies_stale? Time.new - self.movies.last.updated_at >= 900 end def fetch_movies! uri = URI.parse("http://api.rottentomatoes.com/api/public/v1.0/lists/movies/upcoming.json?apikey=vymecugmgctsr...
true
9353c2bed677bdb9b3b8d4c9a3182c75bb6e5c81
Ruby
tomstuart/inference-rules
/spec/parser_spec.rb
UTF-8
1,689
2.78125
3
[]
no_license
require 'support/builder_helpers' require 'support/parser_helpers' RSpec.describe do include BuilderHelpers include ParserHelpers def yes keyword('true') end def no keyword('false') end def conditional(condition, consequent, alternative) sequence( keyword('if'), condition, ke...
true
6716cc8ad2e27d6eb4c3d10cc5413d187b83b80a
Ruby
SciRuby/daru-io
/lib/daru/io/link.rb
UTF-8
4,604
2.71875
3
[ "MIT" ]
permissive
module Daru class DataFrame class << self # Links `Daru::DataFrame` Import / Export methods to corresponding # `Daru::IO` Importer / Exporter classes. Here is the list of linkages: # # #### Importers # # | `Daru::DataFrame` method | `Daru::IO::Importers` class ...
true
c1fb9e2c5656b264b62e70034908869e42f23661
Ruby
SamBrigham/ruby-oo-object-relationships-my-pets-yale-web-yss-052520
/lib/dog.rb
UTF-8
331
3.03125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' require_relative "owner.rb" require_relative "cat.rb" #see cat notes class Dog attr_accessor :owner, :mood attr_reader :name @@all = [] def initialize(name, owner) @name = name @owner = owner @mood = "nervous" #initiating dog w nervous mood @@all << self end def self.all @@all...
true
ac6f9c6f4b50462163a3ac2cf6af55e80abe5537
Ruby
tomoya55/thumbs_up
/lib/acts_as_voter.rb
UTF-8
4,057
2.859375
3
[ "MIT" ]
permissive
module ThumbsUp #:nodoc: module ActsAsVoter #:nodoc: def self.included(base) base.extend ClassMethods end module ClassMethods def acts_as_voter # If a voting entity is deleted, keep the votes. # has_many :votes, :as => :voter, :dependent => :nullify # Destroy votes w...
true
77a008aa48c03fdccb6f2c48273870dbc960ee0a
Ruby
CAHOCA/Carlos206
/Anfitrion.rb
UTF-8
1,198
3.828125
4
[]
no_license
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. class Anfitrion attr_accessor :nombre def initialize(nombre="Mundo!") @nombre=nombre end ################### def decir_hola if...
true
4d7a5e3437b580e4cc7c83bd83475cc83ab1e399
Ruby
itggot-christoffer-polndorfer-oresten/standard-biblioteket
/lib/max_of_three.rb
UTF-8
377
4.21875
4
[]
no_license
# Public: Takes three integers and returns the biggest one # # num1 - the first integer # num2 - the second integer # num3- the third integer # # Examples # # max_of_three(2, 100, 1000) # => 1000 # # Returns the biggest integer def max_of_three(num1, num2, num3) return num1 if num1 > num2 && num1 > num3 return...
true
2becdd6bd4d2249e009e359573e3e97358320238
Ruby
ianburrell/tivo-fetch
/split_shows
UTF-8
975
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby def split_file(start_time, duration, input, output) if File.exists?(output) then puts "skipping #{output}" return end cmd = %Q{ffmpeg -loglevel fatal -ss #{start_time} -t #{duration} -i "#{input}" -vcodec copy -acodec copy "#{output}"} puts cmd system(cmd) or raise "#{cmd} failed: #{$...
true
7c6b35b2d8129387144071415805cc2db91b9114
Ruby
cerishaw/exchange
/app/helpers/exchange_rate.rb
UTF-8
555
2.90625
3
[]
no_license
module ExchangeRate def self.at(date, base_currency_code, counter_currency_code) base_rate = find_conversion_rate_on_date(date, base_currency_code) counter_rate = find_conversion_rate_on_date(date, counter_currency_code) counter_rate / base_rate end private def self.find_conversion_rate_on_date(...
true
ddfca1b0690706f1848ead35204a7df3fe93c6b0
Ruby
mduffield/giphy
/lib/giphy/response.rb
UTF-8
500
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Giphy class Response def self.build(response) new(response).data end def initialize(response) @response = response end def data raise Giphy::Errors::Unexpected unless response.body response.body['data'] || raise(Giphy::Errors::API.new(error)) end private ...
true
04649a340e5a63b8b308408ee86eac1e786d68fa
Ruby
cbituin/ttt-8-turn-v-000
/lib/turn.rb
UTF-8
2,090
4.5625
5
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Before defining #turn, you should define the following methods: # #display_board # Should accept a board as an argument and print out the current state of the board for the user. def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} ...
true
7aee9846c34c1707ce2cab7521d0b900208953e5
Ruby
corlinus/simple_model_view
/spec/simple_model_view/resource_table_builder_spec.rb
UTF-8
10,070
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true RSpec.describe SimpleModelView::ResourceTableBuilder, type: :helper do describe '#format' do let(:test_model) { TestModel.new('Name') } subject { described_class.new(helper, test_model) } let(:formatter) { double :formatter_instance, call: nil } before { allow(SimpleM...
true
ebf21ef6cbf293b8c0db086b64598e058132524f
Ruby
rayning0/rubyquiz
/lib/title_case.rb
UTF-8
232
3.453125
3
[]
no_license
# http://www.codewars.com/kata/5202ef17a402dd033c000009 class TitleCase def title_case(title, minor_words = '') title.capitalize.split().map{|a| minor_words.downcase.split().include?(a) ? a : a.capitalize}.join(' ') end end
true
4102663d8f679f54b4477ef96aa0a572138b5126
Ruby
collabnix/dockerlabs
/vendor/bundle/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/interpolate_test.rb
UTF-8
3,920
2.6875
3
[ "Apache-2.0", "MIT" ]
permissive
require 'test_helper' # thanks to Masao's String extensions, some tests taken from Masao's tests # http://github.com/mutoh/gettext/blob/edbbe1fa8238fa12c7f26f2418403015f0270e47/test/test_string.rb class I18nInterpolateTest < I18n::TestCase test "String interpolates a hash argument w/ named placeholders" do asse...
true
b34c6137ffa31139ee843b94c221a3f7db582cb3
Ruby
dawidof/server_stat
/lib/server_statistics.rb
UTF-8
1,753
2.515625
3
[]
no_license
class ServerStatistics def self.get cpu_rvm_count = `ps -ef | grep rben |wc -l` cpu_count = `ps -ef | wc -l` uptime = `uptime` captures = (`uptime`.match /up (?:(?:(\d+) day?.,)?\s*(\d+):(\d+)|(\d+) min)/) # puts captures.inspect if captures.nil? captures = (`uptime`.match /up (?:(?:(\d+) day?.,...
true
38b75cd3174591392a753f016cc81bb69da45f09
Ruby
mcmillhj/PL0Compiler
/SyntaxTree/ParameterListNode.rb
UTF-8
504
2.921875
3
[]
no_license
class ParameterListNode < Node attr_reader :param_list def initialize param_list super() @param_list = param_list end # todo def accept visitor # visit all the parameters @param_list.each do |param| param.accept visitor end visitor.visit_formal_param_list self end ...
true
dadbf61dabc41aac03fbb3a48de7ff001452df60
Ruby
dabeeya/phase_0_unit_2
/week_4/5_pad_array/my_solution.rb
UTF-8
1,890
4.15625
4
[]
no_license
# U2.W4: Pad an Array # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # I worked on this challenge [by myself, with: ]. # 1. Pseudocode # What is the input? # What is the output? (i.e. What shoul...
true
ffb2ff86a32da3089ce2bb83cd809027444dd3c3
Ruby
tkt989/atcoder
/abc147_c.rb
UTF-8
868
2.828125
3
[ "MIT" ]
permissive
N = gets.chomp.to_i A = [] N.times do n = gets.chomp.to_i a = {} n.times do x, y = gets.chomp.split(" ").map(&:to_i) a[x-1] = y end A << a end def check(a, liars) table = {} a.each do |list| list.each do |k, v| if table[k] != nil && table[k] != v then return nil end ...
true
5ecde7a7ccb63a833346f217d6f39f47c902336b
Ruby
aaecheverria96/oo-cash-register-onl01-seng-pt-072720
/lib/cash_register.rb
UTF-8
655
3.09375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class CashRegister attr_accessor :new, :discount, :total, :items def initialize(discount = 0) @total = 0 @discount = discount @items = [] #items_list << @items end def add_item(title,price,quantity = 1) quantity.times do items << title end @last_total = @total @total += price * ...
true
e8f576d8e740032349fe0511de85fefa3beac268
Ruby
kjkosmatka/makebelieve
/lib/makebelieve/network.rb
UTF-8
2,858
2.96875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Network require 'ostruct' CONTEXTS = [:variables, :probabilities, :attributes] attr_reader :vars, :pots, :meta, :graph def initialize(options={}, &block) @meta = OpenStruct.new @graph = Graph.new @vars = options[:variables].nil? ? [] : optioens[:variables] @pots = options[:potentials...
true
ac3568d15b626de999d098ef77d399b802212989
Ruby
camilamaia/algorithms-stanford
/course1/week1/sort/merge_sort.rb
UTF-8
900
3.9375
4
[]
no_license
def merge_sort array n = array.size # Array of size 1 or less is always sorted return array if n <= 1 # Apply "Divide & Conquer" strategy # 1. Divide mid = n / 2 part_a = merge_sort array.slice(0, mid) part_b = merge_sort array.slice(mid, n - mid) # 2. Conquer sorted = [] i = 0 j = 0 whil...
true
3cbbb89920df2d2c632830e136ed2dcdf4917e52
Ruby
xord/reflexion
/reflex/test/test_window.rb
UTF-8
3,091
2.8125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- require_relative 'helper' class TestWindow < Test::Unit::TestCase def win(*a, **k, &b) Reflex::Window.new(*a, **k, &b) end def point(*a) Reflex::Point.new(*a) end def bounds(*a) Reflex::Bounds.new(*a) end def test_show_hide_hidden() w = win assert_equal true, w.hid...
true
c13e19072ff7593fd5d7603c48b715c4844390b9
Ruby
m4thayus/emoticon-translator-dc-web-051319
/lib/translator.rb
UTF-8
1,000
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'yaml' require 'pry' def load_library(path) library = YAML.load_file(path) emoticons = {"get_meaning" => {}, "get_emoticon" => {}} library.each do |meaning, icons| emoticons["get_meaning"][icons[1]] = meaning emoticons["get_emoticon"][icons[0]] = icons[1] end emoticons ...
true
e3f186959a8a1050b8b6b638e92a9bb1ba9429e0
Ruby
jameshughes7/bank_tech_test
/spec/account_spec.rb
UTF-8
1,377
2.921875
3
[]
no_license
require 'account' describe Account do subject(:account) { described_class.new(0) } describe '#initialize' do it 'should create a new instance of Account class' do account = Account.new expect(account).to be_instance_of(Account) end it 'should initialize with a default zero balance' do ...
true
a72ab9408c76a34494cabfbc272e29cea456e57d
Ruby
mje113/newark
/test/test_router.rb
UTF-8
2,986
2.59375
3
[ "MIT" ]
permissive
require 'helper' class TestingApp include Newark before do headers['X-Newark-Version'] = Newark::VERSION end before do if params[:token] && params[:token] == '123456' redirect_to 'http://example.com' && return end end after do headers['X-Newark-Done'] = 'true' end get '/', pa...
true
cbce173cddd929d3733447e515458873443aa952
Ruby
nmaisonneuve/gsv_downloader
/lib/gsv_downloader/image_downloader_parallel.rb
UTF-8
1,224
3.109375
3
[ "MIT" ]
permissive
require "typhoeus" require "image_downloader.rb" # Google Street View Image Downloader # multi_thread version (get the tiles in a multithread way) class ImageDownloaderParallel < ImageDownloader def initialize(tmp_path = "./tmp") set_tmp_dir(tmp_path) end def parallel_download(data) # process hydra = Typhoe...
true
8ee06b77dc733aacdfbe0a8a788309f109ae7678
Ruby
sirsir/PMS-FCT-cms
/- svn/PMS/app/models/caption.rb
UTF-8
1,020
2.796875
3
[]
no_license
class Caption < ActiveRecord::Base belongs_to :label belongs_to :language validates_uniqueness_of :label_id, :scope => [:language_id] validates_presence_of :label_id validates_presence_of :name alias_attribute :description, :name class << self # Caption.missing_msg(caption_id, info = nil) -> str...
true
90286ae9285fdf933bfc60f76951b828d9dae93a
Ruby
Karunamon/farscrape
/main.rb
UTF-8
3,451
2.8125
3
[]
no_license
require 'mechanize' #Heavy lifting require 'net/http' #Other shenanigans require 'logger' #require 'pry' #debugger require 'rbconfig' #Need to tell what our host OS is ###CONFIGURATION $certfile = 'cacert.pem' #Base64 encode these so anybody over your shoulder can't see your login details $wf_username = Base64.decode6...
true
fc6554dc8a4e2ac10c9b4d35edbb34c96e078f9a
Ruby
h-nagamine09/review
/paiza1.rb
UTF-8
411
3.765625
4
[]
no_license
# Here your code ! # And演算子 number1 = 1 number2 = 2 number3 = rand(1..100) puts number3 if number3 >= 30 && number2 <= 60 puts "あたり" else puts "ハズレ" end # 演習問題 # 順位に合わせてメッセージを表示する number = rand(1..10) puts "あなたの順位は#{number}位です" ## ここにifを追加する if number >= 2 && number <= 5 puts 'あと少し!' end
true
378aa7b609f26eff689c946fbbbfe99df34061fa
Ruby
Ank13/socrates_prep
/count_bw.rb
UTF-8
352
3.953125
4
[]
no_license
def count_between(array, lower_bound, upper_bound) array.count{|x| x >= lower_bound && x <= upper_bound} end puts count_between([1,2,3], 0, 100) # => 3 puts count_between([-10, 1, 2], 0, 100) # => 2 puts count_between([10, 20, 30], 10, 30) # => 3 puts count_between([], -100, 100) # => 0 puts count_betw...
true
126f8208fb104f555469c651fb89b7d06e446d45
Ruby
mdmccoy/wyncode
/voter_sim/status_msgs.rb
UTF-8
251
2.65625
3
[]
no_license
module Status_msgs def invalid_input puts "\nEnter a valid input." end def person_added(type) puts "\n#{type} added to world." end def invalid_person puts "\nInvalid person type." end def done puts "\nDone!" end end
true
1e6cb2a54ef4333a89cdef9a300a4d8149d6b84d
Ruby
turnon/mychart.js.rb
/test/x_test.rb
UTF-8
421
2.953125
3
[ "MIT" ]
permissive
require 'minitest/autorun' require 'my_chart/x' class TestX < MiniTest::Unit::TestCase def test_x_to_xy xy = @x.group_by {|num| num % 3} exp = {0 => [3,6,9,12,15,18], 1 => [1,4,7,10,13,16,19], 2 => [2,5,8,11,14,17,20]} assert_equal exp, xy.value end def test_select gt19 = @x.select {|n| n > 19}...
true
7ca5156d6598257c25230fa2ccbdc20ec762c9df
Ruby
gpks/algorythms
/binary/solution.rb
UTF-8
337
3.453125
3
[]
no_license
class Algo def solution(n) binary = "%b" % n solution = 0 current = 0 binary.each_char.with_index do |bin, i| if bin == '0' current += 1 else solution = current if current > solution break if current > binary[i+1..-1].size current = 0 end end s...
true
e0830b1daaad410a2a208948c8d33e6a092c7800
Ruby
rastullahs-lockenpracht/modules
/regressiontest/scripts/effecttest.rb
UTF-8
2,075
2.71875
3
[]
no_license
require 'testcase.rb' load "effects/astraleregeneration.rb" load "effects/ausdauernd.rb" load "effects/paralues.rb" load "effects/resistentgegenkrankheiten.rb" load "effects/schnelleheilung.rb" load "effects/wunde.rb" class ParaluesAction < Action def initialize super("paralues", "Spontan versteinern...
true
4c65b2cd901b97f3ee92ac4c5164f2623b4e390b
Ruby
MadBomber/experiments
/openai/swagger.rb
UTF-8
1,575
3.265625
3
[]
no_license
#!/usr/bin/env ruby require 'boxcars' # Boxcars is a gem that enables you to create new systems with AI composability. Inspired by python langchain. require 'amazing_print' # Pretty print Ruby objects with proper indentation and colors require 'tty-progressbar' # A flexible and extensible progress bar for ter...
true
c82039c7ca615c5a5d045473ba5606e1a42b4f4c
Ruby
Jccrespi/jakebot
/jakebot.rb
UTF-8
4,740
2.578125
3
[]
no_license
require 'cinch' require 'twitter' require 'yaml' require './waaai.rb' bot_dir = File.expand_path "~/.jakebot" welcome_messages = {} responses = {} phrases = {} channels = ["#bottest"] VERSION = '0.2.6' # Create the storage directory if it doesn't exist Dir.mkdir(bot_dir) unless File.exists?(bot_dir) if !(File.exists...
true
797c56629aeb6de1536852df19298c93421eaa4c
Ruby
JaimeCrz/Ruby_Exercises
/methods.rb
UTF-8
627
4.53125
5
[]
no_license
# Write a program that prints a greeting loop do puts ' Hello! can you please write your name?' answer = gets.chomp puts "Hello there, General #{answer} " break end # A- It's 2 # B- Will print "x = 2" # C- Will print joe as string (p () is another version of print/puts) # D- Will give the va...
true
601f99534a9c57231ee81dfdf29700e87cfd1ce5
Ruby
oguzpol/ruby-tutorial
/pop_method.rb
UTF-8
215
3.21875
3
[]
no_license
arr = [1,2,3,4,5,6,7,8,9,10,11,15] p arr.length p arr.pop # deleted last item 15 p arr.length arr.pop # deleted last item 11 p arr p last_item = arr.pop p arr two_items = arr.pop(2) # last two item p arr p two_items
true
a4a86c4b14d5008e6490d791ac108ea5ba2d8df0
Ruby
ver2point0/ruby-way
/1.3-oop-in-ruby/methods-and-attributes/methods-attributes.rb
UTF-8
1,388
3.890625
4
[]
no_license
# methods can take attributes puts Time.mktime(2014, "Aug", 24, 16, 0) # method calls may typically be chained or stacked puts 3.succ.to_s print /(x.z).*?(x.z).*?/.match("x1z_1a3_x2z_1b3_").to_a[1..3] puts "\n#{3+2.succ}" # do-end block my_array.each do |x| x.some_action end # brace-delimite block File.open(filena...
true
82246b281047b43b04b9e503c9fa6bbaf7be96c9
Ruby
rrgayhart/RubytheHardWay
/ex45/lib/parse.rb
UTF-8
347
3.203125
3
[]
no_license
module Parse def prompt printf "> " end def input_with_index(input) result = [] input.split.each_with_index{|word, index| result << [word, index]} result end def input_to_array(input) input.split end def unrecognized_command puts "I don't recognize that command. Try again." ...
true
fad42595aa9dd37e6bdb90baff8883816aa7ea2c
Ruby
jasoncomes/CyberSecurity.org
/plugins/filters/ifelse.rb
UTF-8
428
2.890625
3
[]
no_license
# IfElse # If image exists print primary argument otherwise print secondary argument. # {{ image | iflese:" has-image", "" }} module IfElse def iflese(content, if_content = "", else_content = "") content = content.to_s if if_content.empty? and else_content.empty? return end return (!content...
true
91c5e035c79d2f1e1ecd9c8eb066655c0454cab6
Ruby
alexlag/railschallenge-city-watch
/app/models/responder.rb
UTF-8
1,340
2.578125
3
[]
no_license
class Responder < ActiveRecord::Base # To avoid STI from :type column self.inheritance_column = nil validates :type, presence: true validates :name, presence: true, uniqueness: true validates :capacity, presence: true, inclusion: { in: (1..5) } belongs_to :emergency delegate :code, to: :emergency, allow...
true
3e246674a9aee85ff48780c62c9336b44f2dd348
Ruby
thebravoman/software_engineering_2014
/class016/Vanya_Santeva_5_B/task3.rb
UTF-8
1,198
2.59375
3
[]
no_license
require_relative 'task.rb' class Task3 < Task def init_contexts context1_1 = { :task_number=>"1", :length=>"5", :in_what_order => "ASC", :format=>"csv", :format_example=> "file1.rb,9 file2.rb,11 ..... fileN.rb,N", :expected=> "never.rb,11 fo...
true
77a7b2832ed55b2e58f891ad341e4e282061a865
Ruby
gigi-wolff/challenges
/luhn.rb
UTF-8
661
3.78125
4
[]
no_license
require "pry" class Luhn def initialize(number=0) @number = [] number.to_s.each_char { |c| @number << c.to_i } end def addends arr = @number.reverse! arr.map!.with_index do |x, i| if i.even? x else (2 * x > 10 ? 2 * x - 9 : 2 * x) end end.reverse! end d...
true
598c2c4003148fec12dea152124d0587d95f37cc
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/src/380.rb
UTF-8
150
2.984375
3
[]
no_license
def compute(s1, s2) l = [s1.length, s2.length].min s1[0..l-1].each_char.zip(s2[0..l-1].each_char).select { |a,b| a != b }.size end
true
1edbb09cafa6e2e33dd0d047c8abedb972c25c66
Ruby
derekgr/leds
/leds.rb
UTF-8
1,585
2.96875
3
[]
no_license
class LedStrip attr_reader :length, :device # gamma correction + 7-bit color conversion # https://gist.github.com/3309494 @@gamma = 256.times.map { |i| 0x80 | ((i.to_f/255.0)**2.5 * 127.0 + 0.5).to_i } def initialize(device="/dev/spidev0.0",length=32) @device = device @length = length @dev...
true
4f53bf94b2f5854cef77e7bae44d23b118fdea1a
Ruby
ElaErl/Fundations
/exerc/easy8/10.rb
UTF-8
259
3.3125
3
[]
no_license
def center_of(string) string.length.odd? ? string[(string.length)/2] : string[string.length/2 - 1, 2] end center_of('I love ruby') == 'e' center_of('Launch School') == ' ' center_of('Launch') == 'un' center_of('Launchschool') == 'hs' center_of('x') == 'x'
true
0b9095ed8dc9194a87223cba2cb452a248b9348f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/leap/2cb73c60aea64a799f3bf2479d12dab1.rb
UTF-8
420
3.703125
4
[]
no_license
class Year class << self def leap?(year) @year = year check_leap_year? end def check_leap_year? divisible_by?(4) && !divisible_by?(100) || leap_century? end def divisible_by?(num) boolean_result( @year % num ) end def leap_century? divisible_by?(100) ...
true
b8dadf86ff4ae4a138d7f04570545bcc1f4deab5
Ruby
robbytobby/timit
/app/models/calendar.rb
UTF-8
2,544
2.921875
3
[]
no_license
class Calendar attr_accessor :bookings attr_accessor :days attr_accessor :machines attr_accessor :machine_offset private :machines=, :days=, :bookings=, :machine_offset= def initialize(starts = nil, ends = nil, machine_ids = [], machine_offset = 0) starts ||= Date.today ends ||= (starts.to_date + 4...
true
29a46eab7cb8e688375c64db08ba3cacaba185b4
Ruby
mattfaircloth/public-porta-potty
/app/models/bathroom.rb
UTF-8
1,055
2.734375
3
[]
no_license
class Bathroom < ApplicationRecord has_many :bathroom_locations has_many :locations, through: :bathroom_locations has_many :comments has_many :users, through: :comments accepts_nested_attributes_for :locations def cleanest_bathroom hash = {} Bathroom.all.map do |bathroom| hash[bathroo...
true
b24b138dbc7071ea2e4af1db87e36967bc1c1844
Ruby
PritpalSS/Ruby-Projects
/Inheritance/operatorOverloading.rb
UTF-8
2,370
4.53125
5
[]
no_license
# Operator Overloading class Animal attr_accessor:name,:trait def initialize(name, trait) @name = name @trait = trait end #Operator overloading def + (other_object) return Animal.new("#{self.name}#{other_object.name}", "#{self.trait}#{other_object.trait}") # we can access object a by using sel...
true
0cf54d8deeacee8358f67e83f9fd63783622f823
Ruby
TenteMarrero/rbnd-survivr-part1
/lib/colorizr.rb
UTF-8
572
3.359375
3
[]
no_license
class String @colors = { red: "31", green: "32", yellow: "33", blue: "34", pink: "35", light_blue: "94", white: "97", light_grey: "37", black: "30" } def self.colors @colors.map {|color| color[0]} end def self.sample_colors @colors.each do |color| puts...
true
c3dac5002a08bb4960583e0d4db4dc436810549c
Ruby
gilesdotcodes/battleships_Team_SAZAS
/spec/enemy_spec.rb
UTF-8
825
3.015625
3
[]
no_license
require 'enemy' describe Enemy do let(:enemy){Enemy.new} let(:player){Player.new("Steve")} it 'should store a score' do expect(enemy.score).to eq(0) end it 'should set up a new grid when created for us to place ships on' do expect(enemy.actual_grid.grid[3][5]).to eq('~') end it 'should set up a new gri...
true
060cbcbf0039ad91d0255546788c52acc26617e6
Ruby
Dujota/Ruby-comprehensive-examples-for-students
/GUItools/GTK+/checkButton.rb
UTF-8
758
2.921875
3
[]
no_license
''' Zetcode Ruby GTK tutorial This program roggles the title of the window with the Gtk::CheckButton widget. ''' require 'gtk3' class RubyApp < Gtk::Window def initialize super init_ui end def init_ui fixed = Gtk::Fixed.new add fixed cb = Gtk::CheckButton.new "Show title" cb.set_active true ...
true
33020ad4a307c4ae1b57e7f3e1e40ff9f5c5f000
Ruby
theseanything/smart-answers
/lib/smart_answer/calculators/benefit_cap_calculator_configuration.rb
UTF-8
2,226
2.6875
3
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
module SmartAnswer::Calculators module BenefitCapCalculatorConfiguration def self.data @data ||= begin filepath = Rails.root.join("config/smart_answers/benefit_cap_data.yml") YAML.load_file(filepath).with_indifferent_access end end module_function def benefits data.fe...
true
839af77ea89b851afc5aad09823e4f8d3ddcd6d8
Ruby
hchiam/learning-rubyOnRails
/ruby/moreExamples.rb
UTF-8
807
4.15625
4
[]
no_license
#!/usr/bin/ruby # see https://www.tutorialspoint.com/ruby/ruby_quick_guide.htm print "Hello world!\n" # double quote char -> replaces \n with newline character print 'Hello world!\n' # single quote char -> DOES NOT replace \n with newline print "\n" puts '"puts" prints a new line without needing to type "\n"' hsh = ...
true
de5ba30a50b7b9ca8ef3dd23c83319de8caf5e84
Ruby
yuramax/howitzer_stat
/lib/data_cacher.rb
UTF-8
1,369
2.703125
3
[ "MIT" ]
permissive
class DataCacher HASH_EXAMPLE = [ { feature: { name: '...', description: '...', path_to_file: '...', line: 1 }, scenarios: [ { scenario: {name: '...', line: 10}, steps: [ ...
true
a60ed39bc6263d12f1ed375410d1a84b94f2051d
Ruby
michael-emmi/bam-bam-boogieman
/spec/parsing_spec.rb
UTF-8
1,219
2.609375
3
[ "MIT" ]
permissive
# typed: false require 'bpl/parser.tab' describe Bpl do # TODO add more parsing tests it "can parse basic language features" do adt = BoogieLanguage.new.parse <<~STRING var $glob: int; procedure {:some_attr} some_proc(x: int) requires true; ensures true; modifies $glob; {...
true
49b4ddd41d38b82beaa09d3a78f5bca486c1e30b
Ruby
rkoko/ruby-intro-to-arrays-lab-prework
/lib/intro_to_arrays.rb
UTF-8
515
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def instantiate_new_array array = Array.new return array end def array_with_two_elements ["item1", "item2"] end def first_element(array) return array[0] #also array.first end def third_element(array) return array[2] end def last_element(array) return array[-1] #also array.last end d...
true
f9938c33c872457b45e91d1d3af49a6c5f0f568d
Ruby
tomoasleep/vhdl_parser
/lib/vhdl_parser/extractor.rb
UTF-8
1,444
3.078125
3
[]
no_license
module VHDL_Parser # Helper class with methods that extract a portion of interest from # a given String. class Extractor def self.extract_name(string) names = string.split(":").map! { |e| e.strip} names[0].split(/\s*,\s*/) end def self.extract_direction(string) res = string.match(...
true
7dc308dedc77d2624bdb8cf91bdd50c1ac451c68
Ruby
SlamDunc34/day2homework
/ruby_functions_practice.rb
UTF-8
939
3.59375
4
[]
no_license
def return_10 return 10 end def add(num1, num2) return num1 + num2 end def subtract(num1, num2) return num1 - num2 end def multiply(num1, num2) return num1 * num2 end def divide(num1, num2) return num1 / num2 end def length_of_string(test_string) return test_string.length end def join_string(string_1...
true
1f29ab6dae9619d7d473e95b2eaaf7ba61da2ef2
Ruby
eel87/sep-assignments
/01-data-structures/06-trees/binary_tree/binary_search_tree.rb
UTF-8
2,412
3.515625
4
[]
no_license
require_relative 'node' class BinarySearchTree def initialize(root) @root = root end def insert(root, node) if root.rating < node.rating && !root.right root.right = node elsif root.rating < node.rating && root.right insert(root.right, node) elsif root.rating > node.rating && !root.l...
true
d1d4f08cc99848c58e1324b5a603480f34c4c16b
Ruby
tomdotorg/advent2017
/2016/day2.rb
UTF-8
907
3.71875
4
[]
no_license
SIDE = 3 # how big is the matrix on one side # up: - width unless <= width def up(side, num) return num <= side ? num : num - side end # down: + width unless > width ** 2 - width def down(side, num) return num > (side ** 2)-side ? num : num + side end # left -1 unless % width == 1 def left(side, num) return ...
true
26c4dc5a0d5bfa53ec1390b2672af96b1fd1415a
Ruby
TIY-ATL-ROR-2015-Jan/lectures
/01-05/fancy_fizzbuzz.rb
UTF-8
257
3.78125
4
[]
no_license
def fizz_buzz (n) (1..n).each do |i| x = '' x += 'Fizz' if i % 3 == 0 x += 'Buzz' if i % 5 == 0 puts(x.empty? ? i : x) end end puts "got arguments: #{ARGV}" puts "calling fizzbuzz with #{ARGV[0]}" limit = ARGV[0].to_i fizz_buzz(limit)
true
dda1a7bf37b648d68a5605f2f5ed41068b400874
Ruby
felixonmars/cixl
/perf/bench8.rb
UTF-8
188
2.5625
3
[ "MIT" ]
permissive
n = 100000 c = Fiber.new {(0..n).each {|i| Fiber.yield(i)}} t1 = Time.now (0..n).each {|i| raise 'fail' unless c.resume == i} t2 = Time.now delta = (t2 - t1) * 1000 puts "#{delta.to_i}"
true
b151ed4e74e3015a2a0f8c6e0e6def2ec93768d6
Ruby
no1fushi/procon
/2015/look_ch.rb
UTF-8
8,250
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- =begin 仕様- 2014の ・敵にブロックfを置く #char ・ブロックを避ける(方向ランダム) #block ・アイテムを取りに行く(ランダム) # item ・アイテム,キャラ斜め判断,(横優先,ランダム) #item,char slanting ・go初期ランダム ・ループを避ける=ランダム ・ターンカウント ・敵保存 #char save ・敵次ターンよける #char flee ・変数出力 #debug 形debug_var(name,var) ・look #look ・looksave ・look敵奥対策 #lookchar =end require 'CHas...
true
e5ed60290ba4b50de56082783245cb03c6523954
Ruby
MariaAstakhova/minimax_test
/minimax_test/lib/minimax.rb
UTF-8
1,407
3.546875
4
[]
no_license
class Minimax attr_accessor :player WINNING_SETS = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6] ].freeze @player = false def initialize(board) @board = board end def exec...
true
67ba27c65abab31eeb45efb6cb746d6e9af1bc48
Ruby
eserna27/soccer_app
/app/application/weeks/week.rb
UTF-8
1,616
2.734375
3
[]
no_license
require 'active_model' module Weeks class Week include ActiveModel::Model attr_reader :season, :week_number, :season_name, :season_id, :id, :matches def initialize(params) @id = params[:id] @season = params[:season] @week_number = params[:week_number] @season_name = params[:seas...
true
b7c390688f00b9eab6549b2a5355e66ba795d932
Ruby
Dutchmile/ruby-instance-variables-lab-onl01-seng-pt-061520
/lib/dog.rb
UTF-8
157
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Dog def name=(dog_name) @this_dogs_name = dog_name end def name @this_dogs_name end end lassie = Dog.new lassie.name= "Lassie" lassie.name
true
2703a2db1c98dca8427d194efad226bb39e7c506
Ruby
uemura-15/memoApp
/memo.rb
UTF-8
1,162
3.21875
3
[]
no_license
require "csv" #選択肢を出力 while true puts "1(新規メモ作成),2(メモの編集),3(終了)" memo_type = gets.chomp #文字列を取得し、改行をしない if memo_type == "1" puts "拡張子を除いたファイル名を入力" memo_name = gets.chomp puts "メモ入力の完了後、Ctrl+dを押下してください" m...
true
21de0d3ef79da3b25f0d016574ef5dc88b9c742a
Ruby
sds/haml-lint
/lib/haml_lint/tree/script_node.rb
UTF-8
730
2.671875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'haml_lint/parsed_ruby' module HamlLint::Tree # Represents a node which produces output based on Ruby code. class ScriptNode < Node # The Ruby script contents parsed into a syntax tree. # # @return [ParsedRuby] syntax tree in the form returned by Parser gem de...
true
f16f540c55e3b56cbb25839b74fcca144548092d
Ruby
Rohaninfibeam/quintype
/BookCab/app/models/assigment.rb
UTF-8
1,355
2.671875
3
[]
no_license
class Assigment < ApplicationRecord belongs_to :user belongs_to :cab def set_source_location(latitude, longitude) latitude = latitude.to_f longitude = longitude.to_f self.source_lat = latitude self.source_long = longitude self.save! end def set_dest_location(latitude,longitude) latitude = latitude.to...
true
26a9360461eb9d45c1713b5ae5effad593cf4465
Ruby
mdiasfernandes/ruby
/secao_9/setters_and_getters.rb
UTF-8
1,230
4.09375
4
[]
no_license
#Setters and Getters ##############################GETTERS class ApiConnector #Anithing inside here belongs to 'ApiConnector' class #Attribute Accessors, in terms of JAVA for example, means create a getter and setter method #The definitions below stands for the attributes (variables) for this class att...
true
359252f42402a4dc6f02ac15e54c231ec1200dc5
Ruby
kachan1208/doubleLinkedList
/doubleLinkedList.rb
UTF-8
1,185
3.453125
3
[]
no_license
load "node.rb" class List @firstElement = nil @lastElement = nil attr_accessor :lenght def initialize @lenght = 0 end def push(val) if @lastElement.nil? buff = Node.new(val) @firstElement = buff @lastElement = buff else buff = Node.new(val) buff.id = @lastEleme...
true
241cde51f3f9fc0b181bfba383d1c0e2ad9cd3dc
Ruby
epicodusSummer2014/train_system
/spec/train_spec.rb
UTF-8
1,721
2.875
3
[]
no_license
require 'spec_helper' describe 'Station' do describe 'initialize' do it 'initializes a new station' do new_station = Station.new({:name => "151st & Gleason"}) expect(new_station).to be_a Station end end describe 'save' do it 'saves a station' do new_station = Station.new({:name => ...
true
23a52bfd472d363692c0c2ba6b2d9d2edc460640
Ruby
zhanna1825/GithubHomework
/Lucy.rb
UTF-8
213
3.90625
4
[]
no_license
puts "Welcome..." sleep 2 puts "Let's play a game, what is your name?" users_name = gets.chomp puts "One second, calculating..." sleep 3 puts "Great, #{users_name.chars.shuffle.join} is your new name - Goodbye!"
true
c328c44a6f2814ff2796ac82848a3b691d45d7fc
Ruby
yamshim/StockPortal
/lib/clawler/models/foreign_exchange.rb
UTF-8
4,198
2.703125
3
[]
no_license
# coding: utf-8 module Clawler module Models class ForeignExchange < Clawler::Base extend AllUtils # include Clawler::Sources # Initializeは一番最初にスクリプトとして実行する csv化するか、分割化するかなどはまた後で # sleepを入れる # エラーバンドリング # 強化 # 重複データの保存を避ける # break, next def self.patrol ...
true
1efdf32c145bd3fe7c64d3496f3bf41bb353be59
Ruby
unused/sna-workspace
/data-management/import.rb
UTF-8
708
2.78125
3
[ "MIT" ]
permissive
require './application' def create_tweet_from(json_line) unless json_line[0] == '{' json_line = json_line.split('{').last create_tweet_from json_line if json_line[0] == '{' # second chance return end tweet = JSON.parse json_line print (Tweet.new(tweet.to_h).save ? '.' : 'x') rescue Mongo::Error::...
true
3e9fa312c2cc49f216a42cf8e58c67f63b7457e5
Ruby
ippei94da/vasputils
/bin/vaspdir
UTF-8
7,392
2.78125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#! /usr/bin/env ruby # coding: utf-8 # Manipulate VaspDir from command line. require "vasputils" require 'thor' INSPECT_DEFAULT_ITEMS = [ :klass_name, :state, :toten, :dir, ] INSPECT_ALL_ITEMS = [ :kpoints, :encut, :i_step, :e_step, :time, ] + INSPECT_DEFAULT_ITEMS # for printf option. minus value indicate left s...
true
f61e704a6d38a7009598f3bde964bbdd6d311638
Ruby
lulekalabs/luleka-v1
/app/controllers/vouchers_controller_base.rb
UTF-8
1,935
2.5625
3
[]
no_license
# provides controller helpers for voucher related methods in users, partners and voucher controller module VouchersControllerBase def self.included(base) base.extend(ClassMethods) end module ClassMethods end protected # hash key for voucher session id def voucher_session_param :voucher...
true
ba1aa7380de662cd0365d8969546e4a74ef1f8ab
Ruby
suchprogramming/budget_app
/lib/categories.rb
UTF-8
1,077
2.890625
3
[]
no_license
class Category attr_reader(:id, :category_name) define_method(:initialize) do |attributes| @id = attributes.fetch(:id) @category_name = attributes.fetch(:category_name) end define_method(:==) do |another_category| self.id() == another_category.id() && self.category_name() == another_category.catego...
true
f26c01c71493f9875ef11a02ff1cb24c51ea9cc8
Ruby
stephan-nordnes-eriksen/ruby_ship
/bin/shipyard/darwin_ruby/lib/ruby/2.3.0/rdoc/token_stream.rb
UTF-8
2,563
3.359375
3
[ "MIT" ]
permissive
# frozen_string_literal: false ## # A TokenStream is a list of tokens, gathered during the parse of some entity # (say a method). Entities populate these streams by being registered with the # lexer. Any class can collect tokens by including TokenStream. From the # outside, you use such an object by calling the start_c...
true
a43574432e036b4bd32965b607e7a9ff7ec77ff3
Ruby
boblail/recipes
/app/helpers/ingredient_helper.rb
UTF-8
211
2.65625
3
[]
no_license
module IngredientHelper def formatted_amount(ingredient) amount = ingredient.amount amount = amount.join("-") if amount.respond_to? :join "#{amount} #{ingredient.unit.to_s.pluralize}" end end
true
a53806b3e930219304a23f1831eede9ea918ca18
Ruby
luisparravicini/photoftheday
/download.rb
UTF-8
640
2.5625
3
[]
no_license
require 'tempfile' require 'fileutils' include FileUtils urls_path = 'photos_urls.txt' downloads_dir = ARGV.shift || 'wallpapers' mkdir_p(downloads_dir) unless File.exists?(downloads_dir) File.open(urls_path) do |io| io.each_line do |url| url.strip!.chomp! dest_path = File.join(downloads_dir, File.basena...
true
1ccf99b8550e807a5ee710ff443957dfe4879368
Ruby
ericovinicosta/pdti-ruby-respostas-exercicio04
/resposta01.rb
UTF-8
180
3.859375
4
[]
no_license
# Faça um Programa que leia um vetor de 5 números inteiros e mostre-os. numeros = [] for i in 0...5 print "Entre com o numero #{i}: " numeros << gets.to_i end puts numeros
true
ac9acbb0c3603f0e19b6de37a9ce61fe684c8ad4
Ruby
emreiser/ga-w1-thursday-quiz
/quiz.rb
UTF-8
197
3.40625
3
[]
no_license
def multiples(multiple, max_num) multipliers = (1..(max_num.to_i-1)).to_a result = [] multipliers.map do |num| result << (multiple.to_i * num) end return result end puts multiples(3, 6)
true
3408747952f9935faaf0491715221dd06189250d
Ruby
shinh/test
/enum_inspect.rb
UTF-8
308
3.328125
3
[]
no_license
def make_pure_enumrator(e) def e.inspect "#<Enumerator::#{to_a.inspect}>" end e end class Array alias orig_each each def each make_pure_enumrator(orig_each) end end class Range alias orig_each each def each make_pure_enumrator(orig_each) end end p [1,2,3].each p (0..3).each
true
26f879435bf11eb79da9bf550f9f39b4280aebe3
Ruby
paulokuda/dankathon
/app/models/user.rb
UTF-8
661
2.609375
3
[]
no_license
class User < ActiveRecord::Base has_secure_password # relationships has_many :items # validations validates :username, presence: true, uniqueness: { case_sensitive: false} validates_presence_of :password, on: :create validates_presence_of :password_confirmation, on: :create validates_confirmation_o...
true
93d45321a147bc37d1ae677619f16e2265a5178a
Ruby
afeiship/ruby-programing-book-notes
/docs/2018-08/2018-08-06/019-if-modifer.rb
UTF-8
99
3
3
[]
no_license
a,b = 120,100; if a > b puts 'A > B' end ## 等效于下面的 puts "a 比b 大" if a > b
true
9a11ba123335dbcff2e62f9ed8dfe3fe91000697
Ruby
tfxl/CA_projects
/workbook_T1A1/code_Q11.rb
UTF-8
1,156
3.3125
3
[]
no_license
class Consumables attr_reader attr_writer attr_accessor @@consumables_sold = [] def self.number_items_sold @@consumables_sold.length end def self.profit @@consumables_sold.sell_cost - @@consumables_sold.buy_cost end def initialize(buy_cost, sell_cost, size) #size will have default refere...
true
8601511799cf0d797b3a2dbbd1f1542f7f4dc607
Ruby
rdark/yasst
/lib/yasst/provider/openssl.rb
UTF-8
2,434
2.609375
3
[ "MIT" ]
permissive
require 'yasst/primatives/openssl' module Yasst class Provider ## # OpenSSL provider # ===== Parameters # - *profile* # ===== Required Parameters # - *passphrase* class OpenSSL < Yasst::Provider include Yasst::Primatives::OpenSSL attr_reader :profile ## # initial...
true
5b551a051e9d6d7a36b4ca940f74b350d95c077f
Ruby
TimPetricola/dayone-kindle
/lib/dayone-kindle/cli.rb
UTF-8
2,139
2.78125
3
[]
no_license
module DayOneKindle module CLI def self.dialog(value) script = <<-END tell app "System Events" display dialog "#{value}" end tell END system('osascript ' + script.split(/\n/).map { |line| "-e '#{line}'" }.join(' ') + '> /dev/null 2>&1') end def self.options return @options if @...
true
5288cd4f9277a0db6634aa7afa2b51061f17e1c7
Ruby
kf8a/metadata
/app/models/variate.rb
UTF-8
2,037
2.515625
3
[]
no_license
# frozen_string_literal: true require 'rexml/document' # A variate is a variable that is measured or recorded. It represents the # column in a datatable. class Variate < ApplicationRecord include REXML belongs_to :datatable, touch: true, optional: true belongs_to :unit, optional: true scope :valid_for_eml, -...
true
9c1d22cbf1292199486791170753732291f550b4
Ruby
rbk/ruby_class
/modules/modules/include_vs_extend.rb
UTF-8
482
3.5
4
[]
no_license
# include_vs_extend module ModuleA def self.included(base) base.extend(ClassMethods) end def methodA puts "methodA" end module ClassMethods def methodB puts "methodB" end end end class ClassA include ModuleA #extend ModuleA end # when included #a = ClassA.new #a.methodA...
true