repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
defunkt/lyndon
https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/repl.rb
lib/lyndon/repl.rb
require 'readline' module Lyndon class Repl Prompt = 'js> ' AwaitingInput = '?> ' Result = '=> ' HistoryFile = File.join(File.expand_path('~'), '.lyndon_history') def self.start(dom = nil) load_history @parser = Lyndon::Runtime.new(dom) loop do input = Readline.readlin...
ruby
MIT
a3fa1f69053d2abe0e075f3781d9487d3eb38be6
2026-01-04T17:35:58.879303Z
false
defunkt/lyndon
https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/runtime.rb
lib/lyndon/runtime.rb
# http://developer.apple.com/documentation/Cocoa/Reference/WebKit/ObjC_classic/index.html module Lyndon class Runtime def initialize(dom = nil) @webView = WebView.new @webView.setFrameLoadDelegate(Delegate.new) @scripter = @webView.windowScriptObject @scripter.setValue(Ruby.new, forKey:"...
ruby
MIT
a3fa1f69053d2abe0e075f3781d9487d3eb38be6
2026-01-04T17:35:58.879303Z
false
defunkt/lyndon
https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/ruby.rb
lib/lyndon/ruby.rb
module Lyndon class Ruby ## # Lets us call simple ruby methods # # Ruby.IO_read(file) # Ruby.puts('hi') # Ruby.require('uri') def invokeUndefinedMethodFromWebScript(name, withArguments:args) if respond_to? name send(name, *args) elsif Kernel.respond_to? name ...
ruby
MIT
a3fa1f69053d2abe0e075f3781d9487d3eb38be6
2026-01-04T17:35:58.879303Z
false
defunkt/lyndon
https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/coercion.rb
lib/lyndon/coercion.rb
# help convert objects WebKit's JS returns into # things we can use class NSCFNumber def inspect if Integer(self) == Float(self) Integer(self).to_s else Float(self).to_s end end end class NSCFBoolean def inspect (self == NSNumber.numberWithBool(true)).to_s end end class WebScriptO...
ruby
MIT
a3fa1f69053d2abe0e075f3781d9487d3eb38be6
2026-01-04T17:35:58.879303Z
false
defunkt/lyndon
https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/delegate.rb
lib/lyndon/delegate.rb
module Lyndon class Delegate def webView(sender, didFinishLoadForFrame:frame) NSApplication.sharedApplication.stop(self) end end end
ruby
MIT
a3fa1f69053d2abe0e075f3781d9487d3eb38be6
2026-01-04T17:35:58.879303Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/test/test_parsing.rb
test/test_parsing.rb
require File.expand_path(File.dirname(__FILE__) + '/helper') require 'time' require 'test/unit' class TestParsing < Test::Unit::TestCase def setup Tickle.debug = (ARGV.detect {|a| a == '--d'}) @verbose = (ARGV.detect {|a| a == '--v'}) puts "Time.now" p Time.now @date = Date.today end def ...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/test/helper.rb
test/helper.rb
require 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require File.join(File.dirname(__FILE__), '..', 'lib', 'tickle') class Test::Unit::TestCase end
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/lib/tickle.rb
lib/tickle.rb
#============================================================================= # # Name: Tickle # Author: Joshua Lippiner # Purpose: Parse natural language into recuring intervals # #============================================================================= $LOAD_PATH.unshift(File.dirname(__FILE__)...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/lib/tickle/repeater.rb
lib/tickle/repeater.rb
class Tickle::Repeater < Chronic::Tag #:nodoc: # def self.scan(tokens) # for each token tokens.each do |token| token = self.scan_for_numbers(token) token = self.scan_for_ordinal_names(token) unless token.type token = self.scan_for_ordinals(token) unless token.type token = self.scan_f...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/lib/tickle/handler.rb
lib/tickle/handler.rb
module Tickle #:nodoc: class << self #:nodoc: # The heavy lifting. Goes through each token groupings to determine what natural language should either by # parsed by Chronic or returned. This methodology makes extension fairly simple, as new token types can be # easily added in repeater and then process...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/lib/tickle/tickle.rb
lib/tickle/tickle.rb
# Copyright (c) 2010 Joshua Lippiner # # 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, # d...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
noctivityinc/tickle
https://github.com/noctivityinc/tickle/blob/134501844eb5969ca342c652d134526dd4ae0b1b/lib/numerizer/numerizer.rb
lib/numerizer/numerizer.rb
require 'strscan' class Numerizer DIRECT_NUMS = [ ['eleven', '11'], ['twelve', '12'], ['thirteen', '13'], ['fourteen', '14'], ['fifteen', '15'], ['sixteen', '16'], ['seventeen', '17'], ...
ruby
MIT
134501844eb5969ca342c652d134526dd4ae0b1b
2026-01-04T17:35:58.572721Z
false
Widdershin/sonic-pi-cli
https://github.com/Widdershin/sonic-pi-cli/blob/c4280f98edcec4de99801d013ec946cc47787932/lib/sonic_pi.rb
lib/sonic_pi.rb
require 'socket' require 'rubygems' require 'osc-ruby' require 'securerandom' class SonicPi PORT_LOG_REGEX = Regexp.compile(/Listen port:\s+(?<port>\d+)/) def initialize(port=nil) @port = port || find_port end RUN_COMMAND = "/run-code" STOP_COMMAND = "/stop-all-jobs" SERVER = 'localhost' GUI_ID = '...
ruby
MIT
c4280f98edcec4de99801d013ec946cc47787932
2026-01-04T17:35:57.914507Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/spec/integration_spec.rb
spec/integration_spec.rb
require 'spec_helper' require 'template_processor_spec' describe 'integration test', integration: true do let(:data) { DocxTemplater::TestData::DATA } let(:base_path) { SPEC_BASE_PATH.join('example_input') } let(:input_file) { "#{base_path}/ExampleTemplate.docx" } let(:output_dir) { "#{base_path}/tmp" } let(...
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/spec/template_processor_spec.rb
spec/template_processor_spec.rb
# encoding: UTF-8 require 'spec_helper' require 'nokogiri' module DocxTemplater module TestData DATA = { teacher: 'Priya Vora', building: 'Building #14', classroom: 'Rm 202'.to_sym, district: 'Washington County Public Schools', senority: 12.25, roster: [ { name: 'Sall...
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/spec/spec_helper.rb
spec/spec_helper.rb
require 'pathname' require 'docx_templater' SPEC_BASE_PATH = Pathname.new(File.expand_path(File.dirname(__FILE__))) RSpec.configure do |config| %i[expect_with mock_with].each do |method| config.send(method, :rspec) do |c| c.syntax = :expect end end end
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/lib/docx_templater.rb
lib/docx_templater.rb
module DocxTemplater module_function def log(str) # braindead logging puts str if ENV['DEBUG'] end end require 'docx_templater/template_processor' require 'docx_templater/docx_creator'
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/lib/docx_templater/docx_creator.rb
lib/docx_templater/docx_creator.rb
require 'zip' module DocxTemplater class DocxCreator attr_reader :template_path, :template_processor def initialize(template_path, data, escape_html = true) @template_path = template_path @template_processor = TemplateProcessor.new(data, escape_html) end def generate_docx_file(file_name...
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
jawspeak/ruby-docx-templater
https://github.com/jawspeak/ruby-docx-templater/blob/1719c933ff953497f05a0bd34c4b8c0fa29acced/lib/docx_templater/template_processor.rb
lib/docx_templater/template_processor.rb
require 'nokogiri' module DocxTemplater class TemplateProcessor attr_reader :data, :escape_html # data is expected to be a hash of symbols => string or arrays of hashes. def initialize(data, escape_html = true) @data = data @escape_html = escape_html end def render(document) d...
ruby
Apache-2.0
1719c933ff953497f05a0bd34c4b8c0fa29acced
2026-01-04T17:35:59.580729Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/spec/scallop_spec.rb
spec/scallop_spec.rb
# frozen_string_literal: true require 'scallop' RSpec.describe Scallop do describe '#to_command & #cmd & #sudo' do specify 'command building' do expect(Scallop.cmd(:ls).to_command).to eq 'ls' expect(Scallop.cmd('ls', '/home/scallop').to_command).to eq 'ls /home/scallop' expect(Scallop.sudo(:ch...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require 'simplecov' SimpleCov.start require 'bundler/setup' require 'scallop' FIXTURES_PATH = File.join(__dir__, 'fixtures') def fixture_path(filename) File.join(FIXTURES_PATH, filename).tap do |filepath| raise "Fixture doesn't exists: #{filename}" unless File.exist?(filepath) ...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop.rb
lib/scallop.rb
# frozen_string_literal: true require 'benchmark' require 'open3' require 'shellwords' require 'scallop/command_builder' require 'scallop/errors' require 'scallop/executor' require 'scallop/param' require 'scallop/public_api' require 'scallop/result' require 'scallop/version'
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/version.rb
lib/scallop/version.rb
# frozen_string_literal: true module Scallop VERSION = '0.9.1' end
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/errors.rb
lib/scallop/errors.rb
# frozen_string_literal: true module Scallop module Errors # Error representing command failure. class CommandFailed < StandardError attr_reader :result def initialize(message, result) @result = result super(message) end end # Error representing absense of required...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/result.rb
lib/scallop/result.rb
# frozen_string_literal: true module Scallop # Represents a result of command execution. class Result attr_reader :stdout attr_reader :stderr attr_reader :status attr_reader :timing attr_reader :output def initialize(stdout:, stderr:, status:, timing:) @stdout = stdout @stderr ...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/param.rb
lib/scallop/param.rb
# frozen_string_literal: true module Scallop # Represents named command parameter. class Param def self.[](key) new(key) end attr_reader :key def initialize(key) @key = key end end end
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/command_builder.rb
lib/scallop/command_builder.rb
# frozen_string_literal: true module Scallop # Implements command building interface with immutability. class CommandBuilder def initialize @params = {} @cmd = [] end def sudo(sudo = true) dup .tap do |instance| instance.instance_eval { @sudo = sudo } end ...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/public_api.rb
lib/scallop/public_api.rb
# frozen_string_literal: true # :nodoc: module Scallop # Adds ergonomic public API methods. module PublicAPI METHODS = %i[cmd sudo].freeze def self.included(base) base.extend ClassMethods end # :nodoc: module ClassMethods METHODS.each do |method| define_method(method) do |...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
fetlife/scallop
https://github.com/fetlife/scallop/blob/78b4a99442ac846b638c1f5e545b51d2f5312db1/lib/scallop/executor.rb
lib/scallop/executor.rb
# frozen_string_literal: true module Scallop # Executes command and returns result. module Executor def self.run(command, args = {}) capture3, timing = measure do Open3.capture3(command, args) end build_result(capture3, timing) end def self.run!(command, args = {}) run(...
ruby
MIT
78b4a99442ac846b638c1f5e545b51d2f5312db1
2026-01-04T17:35:58.919090Z
false
ByneappLLC/flutter_config
https://github.com/ByneappLLC/flutter_config/blob/4fe4a18c79bfda1cca2de66f1df104fd252c94ff/ios/Classes/BuildXCConfig.rb
ios/Classes/BuildXCConfig.rb
#!/usr/bin/env ruby # frozen_string_literal: true require_relative 'ReadDotEnv' envs_root = ARGV[0] config_output = ARGV[1] puts "reading env file from #{envs_root} and writing .config to #{config_output}" dotenv, custom_env = read_dot_env(envs_root) dotenv_xcconfig = dotenv.map { |k, v| %(#{k}=#{v.gsub(/\/\//, "/$...
ruby
BSD-2-Clause
4fe4a18c79bfda1cca2de66f1df104fd252c94ff
2026-01-04T17:36:02.560980Z
false
ByneappLLC/flutter_config
https://github.com/ByneappLLC/flutter_config/blob/4fe4a18c79bfda1cca2de66f1df104fd252c94ff/ios/Classes/BuildDotenvConfig.rb
ios/Classes/BuildDotenvConfig.rb
#!/usr/bin/env ruby # frozen_string_literal: true require_relative 'ReadDotEnv' envs_root = ARGV[0] m_output_path = ARGV[1] puts "reading env file from #{envs_root} and writing .m to #{m_output_path}" # Allow utf-8 charactor in config value # For example, APP_NAME=中文字符 Encoding.default_external = Encoding::UTF_8 Enc...
ruby
BSD-2-Clause
4fe4a18c79bfda1cca2de66f1df104fd252c94ff
2026-01-04T17:36:02.560980Z
false
ByneappLLC/flutter_config
https://github.com/ByneappLLC/flutter_config/blob/4fe4a18c79bfda1cca2de66f1df104fd252c94ff/ios/Classes/ReadDotEnv.rb
ios/Classes/ReadDotEnv.rb
#!/usr/bin/env ruby # frozen_string_literal: true # Allow utf-8 charactor in config value # For example, APP_NAME=中文字符 Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 # TODO: introduce a parameter which controls how to build relative path def read_dot_env(envs_root) defaultEn...
ruby
BSD-2-Clause
4fe4a18c79bfda1cca2de66f1df104fd252c94ff
2026-01-04T17:36:02.560980Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/spec/spec_helper.rb
spec/spec_helper.rb
# Coveralls! require 'coveralls' Coveralls.wear! # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # Require this file using `require "spec_helper"` to ensure that it is only # loaded once. require 'rubycards' requ...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/spec/rubycards/string_spec.rb
spec/rubycards/string_spec.rb
require 'spec_helper' include RubyCards describe String do describe '#next' do context 'one liners' do # cat <- dog == catdog it 'should concatenate strings' do expect('cat'.next('dog')).to eq 'catdog' end # hello <- "" == hello it 'should remain unchanged' do expe...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/spec/rubycards/card_spec.rb
spec/rubycards/card_spec.rb
require 'spec_helper' include RubyCards describe Card do describe '#initialize' do context 'no params' do it 'should return the ace of spades' do new_card = Card.new expect(new_card.suit).to eq 'Spades' expect(new_card.rank).to eq 'Ace' end end context 'params' do ...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/spec/rubycards/deck_spec.rb
spec/rubycards/deck_spec.rb
require 'spec_helper' include RubyCards describe Deck do subject(:deck) { Deck.new } describe '#initialize' do it 'initializes 52 cards' do expect(deck.cards.count).to eq 52 # test indexing expect(deck[0]).to be_a Card # test enumerability deck.each { |card| expect(card).to be_a...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/rubycards.rb
lib/rubycards.rb
$: << File.dirname(__FILE__) require 'extensions/string' require 'rubycards/card' require 'rubycards/deck' require 'rubycards/hand'
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/rubycards/hand.rb
lib/rubycards/hand.rb
require 'forwardable' module RubyCards class Hand include Enumerable extend Forwardable attr_reader :cards def_delegators :cards, :<<, :[] alias :add :<< # Initializes a hand of cards # # @param cards [Array<Card>] A predetermined array of cards # @return [Hand] The generated...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/rubycards/version.rb
lib/rubycards/version.rb
module RubyCards VERSION = "0.0.4" end
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/rubycards/card.rb
lib/rubycards/card.rb
# encoding: utf-8 require 'colored' module RubyCards # Class representation of a standard playing card. (French Design: 52 cards) class Card include Comparable CLUB = '♣' DIAMOND = '♦' HEART = '♥' SPADE = '♠' # Returns a new card instance. # # @param rank [String, Integer...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/rubycards/deck.rb
lib/rubycards/deck.rb
require 'forwardable' module RubyCards class Deck include Enumerable extend Forwardable attr_reader :cards def_delegators :cards, :empty?, :[], :shift alias :draw :shift RANKS = [*2..10, 'Jack', 'Queen', 'King', 'Ace'] SUITS = %w{ Clubs Diamonds Hearts Spades } # Initializes a s...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
jdan/rubycards
https://github.com/jdan/rubycards/blob/e6e7fda255451844681d43b5a9da2ab2393da052/lib/extensions/string.rb
lib/extensions/string.rb
class String # Places a string to the right of the current string # # Example: # ab ef abef # cd .next( gh ) => cdgh # # @param str [String] The string to place adjacent # @return [String] The constructed string def next(str) # zip the two strings, split by line breaks zipped =...
ruby
MIT
e6e7fda255451844681d43b5a9da2ab2393da052
2026-01-04T17:36:03.608937Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Shipping/Fallback Rates for External Carriers/script.rb
Shipping/Fallback Rates for External Carriers/script.rb
CARRIER_SOURCES = ['custom_app'] carrier_rates_present = Input.shipping_rates.any? { |shipping_rate| CARRIER_SOURCES.include?(shipping_rate.source) } # Filter rates as needed. filtered_shipping_rates = [] Input.shipping_rates.each do |shipping_rate| if carrier_rates_present && (shipping_rate.source == 'shopify') ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Shipping/VIP-Free-Shipping/script.rb
Shipping/VIP-Free-Shipping/script.rb
TAG = "VIP" #customer tag MESSAGE = "Free Shipping For Princeton University Members" #additional message customer = Input.cart.customer if customer if customer.tags.include?(TAG) Input.shipping_rates.each do |shipping_rate| if shipping_rate.code.include?("INSERT_SHIPPING_CODE_HERE") shipping_rate.chang...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Shipping/Offer Pickup For Customers By Shipping Location/script.rb
Shipping/Offer Pickup For Customers By Shipping Location/script.rb
# Define the name of the pick up shipping rate - this should be added manually in the Shopify Admin. PICKUP_SHIPPING_RATE_NAME = 'Pick Up In-Store' # Define a list of postcode prefixes that are allowed to pick up from the store. PICKUP_POSTCODE_PREFIXES = [ '100', '101', '102' ] # Output filtered shipping rates. ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Shipping/Free shipping for certain products/script.rb
Shipping/Free shipping for certain products/script.rb
FREE_TAG = 'freeship' if Input.cart.shipping_address.country_code == 'US' && Input.cart.line_items.any?{|item| item.variant.product.tags.include? FREE_TAG} Input.shipping_rates.each do |shipping_rate| next if shipping_rate.price == Money.zero shipping_rate.apply_discount(shipping_rate.price, message: "Free S...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Payment/Provide Invoice Payment Option For Wholesale Order/script.rb
Payment/Provide Invoice Payment Option For Wholesale Order/script.rb
# Name of the invoice payment method. INVOICE_GATEWAY_NAME = 'Invoice' # Tag that wholesale customers are expected to have. WHOLESALE_CUSTOMER_TAG = 'Wholesale' ## # Filter out the invoice payment gateway if the customer is so tagged. Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| c...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Payment/Auto-Select Default Payment Method/script.rb
Payment/Auto-Select Default Payment Method/script.rb
# Define the preferred order of gateways. PREFERRED_GATEWAY_ORDER = ['Invoice', 'Shopify Payments'] # Sort gateways. Output.payment_gateways = Input.payment_gateways.sort_by do |payment_gateway| PREFERRED_GATEWAY_ORDER.index(payment_gateway.name) || 999 end
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Free Gift With Purchase/script.rb
Line-Item/Free Gift With Purchase/script.rb
# Define the ID of the free product. FREE_GIFT_PRODUCT_ID = 9307791812 # Check that we have at least two items in the cart (so that there's a "purchase"). if Input.cart.line_items.size > 1 Input.cart.line_items.each do |line_item| # If the free gift is found, set its price to zero. if line_item.variant.produ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/20 percent off for first time customers/script.rb
Line-Item/20 percent off for first time customers/script.rb
DISCOUNT_AMOUNT = 20 if Input.cart.line_items.size > 1 && (Input.cart.customer.nil? || Input.cart.customer.orders_count < 1) line_item = Input.cart.line_items.sort_by { |line_item| line_item.variant.price }.first if line_item.quantity > 1 line_item = line_item.split(take: 1) Input.cart.line_items << line_i...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Free Standard Shipping For VIP Customers/script.rb
Line-Item/Free Standard Shipping For VIP Customers/script.rb
# Define a list of shipping service names that are eligible for free shipping for VIPs. ELIGIBLE_SERVICES = ['Standard Ground Shipping'] # Define the tag that identifies VIP customers. VIP_CUSTOMER_TAG = 'VIP' # If the customer is a VIP, give them free shipping on the defined services. if !Input.cart.customer.nil? an...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/10 percent off storewide/script.rb
Line-Item/10 percent off storewide/script.rb
# Set to the percentage discount you'd like to apply store-wide. DISCOUNT_AMOUNT = 10 # Apply the discount to every item in the cart. Input.cart.line_items.each do |line_item| line_item.change_line_price(line_item.line_price * (1.0 - (DISCOUNT_AMOUNT / 100.0)), message: "#{DISCOUNT_AMOUNT}% off store-wide!") end Ou...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Remove VAT (Value Added Tax) outside of Europe/script.rb
Line-Item/Remove VAT (Value Added Tax) outside of Europe/script.rb
# Remove Value-Added Tax (VAT) outside of Europe # This script will remove VAT when the destination country is not in Europe # To be used only when the tax is included in the price of the items # Set the VAT percentage included in product price VAT_PERCENT = 20 # Message that will be shown to customers on the cart pa...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Stop customers from using a discount code/script.rb
Line-Item/Stop customers from using a discount code/script.rb
# Stop customers from using a discount code # This script will reject all discount codes. Useful if you have a sale # and don't want additional discounts to be applied # Set the rejection message for discount codes REJECTION_MESSAGE = "Discount codes cannot be used during this sale" class RejectAllDiscountCodes # I...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Tiered Discounts By Spending Thresholds/script.rb
Line-Item/Tiered Discounts By Spending Thresholds/script.rb
# Define spending thresholds, from lowest spend to highest spend. SPENDING_THRESHOLDS = [ { spend: 3000, # spend amount (in cents) discount: 10 # percentage discount }, { spend: 5000, discount: 15 }, { spend: 10000, discount: 20 } ] # Find any applicable spending threshold. el...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/VIP Membership Discount/script.rb
Line-Item/VIP Membership Discount/script.rb
# Set to the percentage discount you'd like to apply store-wide. DISCOUNT_AMOUNT = 10 CUSTOMER_TAG = 'MEMBERSHIP' if !Input.cart.customer.nil? and Input.cart.customer.tags.include?(CUSTOMER_TAG) # Apply the discount to every item in the cart. Input.cart.line_items.each do |line_item| next if line_item.variant....
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Buy One Get One Free/script.rb
Line-Item/Buy One Get One Free/script.rb
# Buy One, Get One Free Script # The basis of this script provided by the Script Editor itself as a "default" script option. # Adjusting these values lets you tweak the scope of the discount, eg: # PAID_ITEM_COUNT = 1, DISCOUNTED_ITEM_COUNT = 1 -> Buy One, Get One # PAID_ITEM_COUNT = 3, DISCOUNTED_ITEM_COUNT = 2 -> Bu...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Tiered Pricing For Bulk Purchases/script.rb
Line-Item/Tiered Pricing For Bulk Purchases/script.rb
# Define a list of price tiers. PRICE_TIERS = [ # Pricing tiers for Shoes { product_types: ['Shoes'], group_by: :product, # :product or :variant tiers: [ { quantity: 10, discount_percentage: 10, discount_message: '10% off for 10+' }, { quantity: 50, ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Percentage off least expensive item/script.rb
Line-Item/Percentage off least expensive item/script.rb
DISCOUNT_AMOUNT = 15 if (Input.cart.line_items.size > 1) line_item = Input.cart.line_items.sort_by { |line_item| line_item.variant.price }.first if line_item.quantity > 1 line_item = line_item.split(take: 1) Input.cart.line_items << line_item end line_item.change_line_price(line_item.line_price * (1.0 ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Conditionally Remove Products from the Cart/Conditional Vendor and Country/script.rb
Line-Item/Conditionally Remove Products from the Cart/Conditional Vendor and Country/script.rb
# ======================================= # # Script code (do not modify) # # ======================================= # class RemoveLineItemsCampaign def initialize(vendors, countries) @vendors = vendors.map(&:downcase) @countries = countries.map(&:downcase) end def run(cart) return if cart.nil? || ...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
Shopify/shopify-scripts
https://github.com/Shopify/shopify-scripts/blob/77fc9b4ac7318c6e06d4d3d48e59d98b169b173a/Line-Item/Percentage Off Next Purchase If Accepted Marketing/script.rb
Line-Item/Percentage Off Next Purchase If Accepted Marketing/script.rb
# Define the discount for eligible customers. DISCOUNT_AMOUNT = 10 # Checks to see if this is a customer's second order, and that they opted into marketing the first time around. if (!Input.cart.customer.nil? && Input.cart.customer.orders_count == 1 && Input.cart.customer.accepts_marketing?) Input.cart.line_items.ea...
ruby
MIT
77fc9b4ac7318c6e06d4d3d48e59d98b169b173a
2026-01-04T17:36:03.560184Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/spec/models.rb
spec/models.rb
class VoteableModel < ActiveRecord::Base make_voteable end class VoterModel < ActiveRecord::Base make_voter end class InvalidVoteableModel < ActiveRecord::Base end class User < ActiveRecord::Base make_voter end class Admin < User end
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/spec/schema.rb
spec/schema.rb
ActiveRecord::Schema.define :version => 0 do create_table :voteable_models, :force => true do |t| t.string :name t.integer :up_votes, :null => false, :default => 0 t.integer :down_votes, :null => false, :default => 0 end create_table :voter_models, :force => true do |t| t.string :name t.integ...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/spec/spec_helper.rb
spec/spec_helper.rb
require 'rubygems' require 'bundler' require 'logger' require 'rspec' require 'active_record' require 'database_cleaner' $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') require 'make_voteable' ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log') ActiveRecord::Base.configurations = YAML...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/spec/generators/make_voteable_generator_spec.rb
spec/generators/make_voteable_generator_spec.rb
require 'spec_helper' require 'action_controller' require 'generator_spec/test_case' require 'generators/make_voteable/make_voteable_generator' describe MakeVoteableGenerator do include GeneratorSpec::TestCase destination File.expand_path("/tmp", __FILE__) tests MakeVoteableGenerator before do prepare_des...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/spec/lib/make_voteable_spec.rb
spec/lib/make_voteable_spec.rb
require File.expand_path('../../spec_helper', __FILE__) describe "Inheritance" do let(:voteable) { VoteableModel.create(:name => "Votable 1") } describe "user (User < ActiveRecord::Base)" do let(:user) { User.create } before(:each) do user.up_vote(voteable) end it { MakeVoteable::Voting.fi...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable.rb
lib/make_voteable.rb
require 'make_voteable/voting' require 'make_voteable/voteable' require 'make_voteable/voter' require 'make_voteable/exceptions' module MakeVoteable def voteable? false end def voter? false end # Specify a model as voteable. # # Example: # class Question < ActiveRecord::Base # make_voteab...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/generators/make_voteable/make_voteable_generator.rb
lib/generators/make_voteable/make_voteable_generator.rb
require 'rails/generators/migration' require 'rails/generators/active_record' class MakeVoteableGenerator < Rails::Generators::Base include Rails::Generators::Migration desc "Generates a migration for the Vote model" def self.source_root @source_root ||= File.dirname(__FILE__) + '/templates' end def s...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/generators/make_voteable/templates/migration.rb
lib/generators/make_voteable/templates/migration.rb
class CreateMakeVoteableTables < ActiveRecord::Migration def self.up create_table :votings do |t| t.string :voteable_type t.integer :voteable_id t.string :voter_type t.integer :voter_id t.boolean :up_vote, :null => false t.timestamps end add_index :votings, [:...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable/voter.rb
lib/make_voteable/voter.rb
module MakeVoteable module Voter extend ActiveSupport::Concern included do has_many :votings, :class_name => "MakeVoteable::Voting", :as => :voter end module ClassMethods def voter? true end end # Up vote a +voteable+. # Raises an AlreadyVotedError if the voter...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable/version.rb
lib/make_voteable/version.rb
module MakeVoteable VERSION = "0.1.1" end
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable/exceptions.rb
lib/make_voteable/exceptions.rb
module MakeVoteable module Exceptions class AlreadyVotedError < StandardError attr_reader :up_vote def initialize(up_vote) vote = if up_vote "up voted" else "down voted" end super "The voteable was already #{vote} by the voter." end end ...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable/voteable.rb
lib/make_voteable/voteable.rb
module MakeVoteable module Voteable extend ActiveSupport::Concern included do has_many :votings, :class_name => "MakeVoteable::Voting", :as => :voteable end module ClassMethods def voteable? true end end # Return the difference of down and up votes. # May be ne...
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
medihack/make_voteable
https://github.com/medihack/make_voteable/blob/3cf3f7ca1c8db075a6a51e101c1b38ef724facd2/lib/make_voteable/voting.rb
lib/make_voteable/voting.rb
module MakeVoteable class Voting < ActiveRecord::Base belongs_to :voteable, :polymorphic => true belongs_to :voter, :polymorphic => true end end
ruby
MIT
3cf3f7ca1c8db075a6a51e101c1b38ef724facd2
2026-01-04T17:36:08.455919Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/tasks/setup.rb
tasks/setup.rb
require 'rubygems' require 'rake' require 'rake/clean' require 'fileutils' require 'ostruct' require 'find' class OpenStruct; undef :gem if defined? :gem; end # TODO: make my own openstruct type object that includes descriptions # TODO: use the descriptions to output help on the available bones options PROJ = Open...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_xor.rb
test/test_cli_xor.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/xor' class TestCliXor < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Xor super() @tst_dat = "my secrets are very secret" @tst_key_str = "sneaky" @tst_key_hex = "736e65616b79" @tst_x...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_b64.rb
test/test_cli_b64.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/b64' class TestCliB64 < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::B64 super() end def test_basic_string_arg assert_equal 0, run_with_args(%w(fooby)) assert_equal "Zm9vYnk=\n", @stdou...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_len.rb
test/test_cli_len.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') require 'rbkb/cli/len' class TestCliLen < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Len super() @tst_in = 'helu world'.force_to_binary @bigtst_in = ('A' * 65_536).force_to_binary end def test_string_...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_helper.rb
test/test_cli_helper.rb
require File.join(File.dirname(__FILE__), 'test_helper.rb') require 'rbkb/cli.rb' Rbkb::Cli::TESTING = true unless defined? Rbkb::Cli::TESTING module CliTest def setup @stdout_io = StringIO_compat.new @stderr_io = StringIO_compat.new @stdin_io = StringIO_compat.new @cli_obj = @cli_class.new( ...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_d64.rb
test/test_cli_d64.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/d64' class TestCliD64 < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::D64 super() end def test_basic_string_arg assert_equal 0, run_with_args(%w(Zm9vYnk=)) assert_equal "fooby", @stdout_...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_urlenc.rb
test/test_cli_urlenc.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/urlenc' class TestCliUrlenc < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Urlenc super() end def test_basic_string_arg assert_equal 0, run_with_args(["foo"]) assert_equal "foo\n", @std...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_bgrep.rb
test/test_cli_bgrep.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/bgrep' class TestCliBgrep < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Bgrep super() @rawdat = (0..255).map {|x| x.chr}.join end def test_need_search_arg @stdin_io.write(@rawdat) ; @...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_rstrings.rb
test/test_cli_rstrings.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/rstrings' # FIXME Finish test cases for rstrings cli class TestCliRstrings < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Rstrings super() @test_dat = "a\000bc\001def\002gehi\003jklmn\004stri...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/disabled_test_cli_blit.rb
test/disabled_test_cli_blit.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') class TestCliBlit < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Blit super() end end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_chars.rb
test/test_cli_chars.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/chars' class TestCliChars < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Chars super() end def test_chars assert_equal 0, go_with_args(%w(1000 A)) assert_equal "A"*1000, @stdout_io.str...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_helper.rb
test/test_helper.rb
require 'pp' require 'stringio' require 'test/unit' $:.unshift File.dirname(__FILE__) + '/../lib' class StringIO_compat < StringIO def string(*args) s = super(*args) s.force_encoding("binary") if RUBY_VERSION >= "1.9" return s end end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_hexify.rb
test/test_cli_hexify.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/hexify' class TestCliHexify < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Hexify super() end def test_string_arg assert_equal 0, go_with_args(%w(foo)) assert_equal("666f6f\n", @stdout_...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/disabled_test_cli_telson.rb
test/disabled_test_cli_telson.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') class TestCliTelson < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Telson super() end end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/disabled_test_cli_feed.rb
test/disabled_test_cli_feed.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') class TestCliFeed < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Feed super() end end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_urldec.rb
test/test_cli_urldec.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/urldec' class TestCliUrldec < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Urldec super() end def test_basic_string_arg assert_equal 0, run_with_args(["foo"]) assert_equal "foo", @stdou...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_dedump.rb
test/test_cli_dedump.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') require 'rbkb/cli/dedump' class TestCliDedump < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Dedump super() @tst_string = "this is a \x00\n\n\ntest\x01\x02\xff\x00".force_to_binary @tst_dump = <<~_EOF_ ...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_crc32.rb
test/test_cli_crc32.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/crc32' class TestCliCrc32 < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Crc32 super() @rawdat = "\306\363\375/l\375\204oK\215o\275\334\037\254\333\276\257\313\267\fr\231\333!\373v|\303W7p\263\3...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_slice.rb
test/test_cli_slice.rb
require File.join(File.dirname(__FILE__), 'test_cli_helper.rb') require 'rbkb/cli/slice' class TestCliSlice < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Slice super() @rawdat = (0..255).map { |x| x.chr }.join @stdin_io.write(@rawdat) @stdin_io.rewind end def te...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/test/test_cli_unhexify.rb
test/test_cli_unhexify.rb
require File.join(File.dirname(__FILE__), "test_cli_helper.rb") require 'rbkb/cli/unhexify' class TestCliUnhexify < Test::Unit::TestCase include CliTest def setup @cli_class = Rbkb::Cli::Unhexify super() end def test_string_arg assert_equal 0, go_with_args(%w(666f6f)) assert_equal("foo", @std...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/spec/string_extends_spec.rb
spec/string_extends_spec.rb
require_relative 'spec_helper' require 'rbkb/extends/string' # note by definition extends are really meant to be used as mixins or # monkey-patches on base classes (like String) But here we use # RbkbString to avoid performing the mixin for our tests describe Rbkb::Extends::String do it "should hexify" do RbkbS...
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/spec/rbkb_spec.rb
spec/rbkb_spec.rb
require File.join(File.dirname(__FILE__), %w[spec_helper]) describe Rbkb do end # EOF
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/spec/spec_helper.rb
spec/spec_helper.rb
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'rbkb' RSpec.configure do |config| end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb.rb
lib/rbkb.rb
require 'rbkb/version' require 'rbkb/extends' module Rbkb end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/version.rb
lib/rbkb/version.rb
module Rbkb VERSION = '0.7.3' end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false
emonti/rbkb
https://github.com/emonti/rbkb/blob/4645025c4317c9bd71257c5bbb70f5fe2342ffa5/lib/rbkb/extends.rb
lib/rbkb/extends.rb
require_relative 'extends/array' require_relative 'extends/enumerable' require_relative 'extends/float' require_relative 'extends/numeric' require_relative 'extends/object' require_relative 'extends/string' require_relative 'extends/symbol' class String include Rbkb::Extends::String end
ruby
MIT
4645025c4317c9bd71257c5bbb70f5fe2342ffa5
2026-01-04T17:36:07.822164Z
false