source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/spec_helper.rb
Ruby
mit
45
main
4,673
require 'simplecov' SimpleCov.start 'rails' do add_filter '/spec/' end # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cau...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression_spec.rb
Ruby
mit
45
main
9,430
# spec/models/regular_expression_spec.rb require 'rails_helper' RSpec.describe RegularExpression do describe 'validations' do context 'when regular_expression and test_string are present and valid' do let(:regex) { described_class.new(regular_expression: 'h(e)llo', test_string: 'hello') } it 'is val...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression/ruby_code_spec.rb
Ruby
mit
45
main
8,515
require 'rails_helper' RSpec.describe RegularExpression::RubyCode do describe '#generate' do context 'when expression and test_string are present' do let(:generator) { described_class.new( regular_expression: Regexp.new('h(e)llo'), test_string: 'hello' ) } i...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression/railroad_diagram_spec.rb
Ruby
mit
45
main
26,424
require 'rails_helper' RSpec.describe RegularExpression::RailroadDiagram do describe '#generate' do context 'when the regex contains quantifiers' do it 'generates valid SVG for zero or more quantifier (*)' do svg = described_class.new(regular_expression: 'a*').generate expect(svg).to includ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression/substitution_spec.rb
Ruby
mit
45
main
5,362
require 'rails_helper' RSpec.describe RegularExpression::Substitution do describe 'basic cases' do it 'escapes HTML in substitution result' do sub = described_class.new( regular_expression: '(foo)', test_string: 'foo foo foo', substitution_string: '<script>alert(1)</script>' )...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression/example_spec.rb
Ruby
mit
45
main
735
require 'rails_helper' RSpec.describe RegularExpression::Example do describe '.categories' do it 'returns a hash of categories with examples' do cats = described_class.categories expect(cats).to be_a(Hash) expect(cats).not_to be_empty key, data = cats.first expect(data).to include(...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/models/regular_expression/reference_spec.rb
Ruby
mit
45
main
849
require 'rails_helper' RSpec.describe RegularExpression::Reference do describe '.sections' do it 'returns an array of sections with title and items' do sections = described_class.sections expect(sections).to be_an(Array) expect(sections).not_to be_empty section = sections.first exp...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/controllers/application_controller_spec.rb
Ruby
mit
45
main
1,591
require 'rails_helper' RSpec.describe ApplicationController do # Create an anonymous controller that inherits ApplicationController so we can # exercise the private method via controller instance and have a route to call. controller(described_class) do def index head :ok end end describe '#ext...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/support/capybara.rb
Ruby
mit
45
main
1,337
RSpec.configure do |config| config.before(:each, type: :system) do case ENV.fetch("DRIVER", "playwright_chromium_headless") when "rack_test" driven_by(:rack_test) when "selenium_chrome" driven_by(:selenium_chrome) when "selenium_chrome_headless" driven_by(:selenium_chrome_headless) ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/requests/regular_expressions_multibyte_spec.rb
Ruby
mit
45
main
703
require 'rails_helper' RSpec.describe "RegularExpressions (multibyte named captures)" do it "does not raise and returns 200, showing a friendly error when named capture access fails" do params = { regular_expression: { regular_expression: '(?<名前>foo)', test_string: 'foo' } } ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/requests/regular_expressions_controller_spec.rb
Ruby
mit
45
main
2,403
require 'rails_helper' RSpec.describe "RegularExpressionsController" do describe 'POST #create' do let(:params) do { regular_expression: { regular_expression: 'foo', test_string: 'foo', options: '', substitution_string: substitution } } end ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
spec/system/regular_expressions_spec.rb
Ruby
mit
45
main
26,694
require 'rails_helper' RSpec.describe "RegularExpressionFlow" do describe 'Header examples dropdown' do before { visit root_path } it 'ensures legacy examples panel is removed and reference panel is present' do # The examples panel used to live in the page body; it was moved to the # header drop...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/application.rb
Ruby
mit
45
main
1,961
require_relative "boot" require "wasmify/rails/shim" require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" # require "active_storage/engine" require "action_controller/railtie" require "action_mailer/railtie" # require "action_mailb...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/ci.rb
Ruby
mit
45
main
876
# Run using bin/ci CI.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby (RuboCop)", "bin/rubocop" step "Style: Ruby (ERB Lint)", "bin/erb_lint --lint-all" step "Style: JavaScript (Biome)", "yarn run lint" step "Security: Gitleaks", "gitleaks detect --source=\"$(pwd)\" --verbose --redact --lo...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/boot.rb
Ruby
mit
45
main
272
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" unless RUBY_PLATFORM =~ /wasm/ # Set up gems listed in the Gemfile. require "bootsnap/setup" unless ENV["RAILS_ENV"] == "wasm" # Speed up boot time by caching expensive operations.
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/routes.rb
Ruby
mit
45
main
340
Rails.application.routes.draw do root "regular_expressions#index" resources :regular_expressions, only: %i[index create] get "regular_expressions/examples", to: "regular_expressions#examples", as: :regular_expression_examples get "*path", to: "regular_expressions#index", constraints: ->(req) { !req.xhr? && req...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/environments/development.rb
Ruby
mit
45
main
2,293
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager load code on boot. config.eager...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/environments/wasm.rb
Ruby
mit
45
main
925
# frozen_string_literal: true require_relative "production" Rails.application.configure do config.enable_reloading = false config.assume_ssl = false config.force_ssl = false # FIXME: Tags are not being reset right now config.log_tags = [] if ENV["DEBUG"] == "1" config.consider_all_requests_local =...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
config/environments/production.rb
Ruby
mit
45
main
2,676
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot for better performance and memory savings (ignor...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
lib/tasks/wasmify_patches.rake
Ruby
mit
45
main
2,084
# frozen_string_literal: true # Monkey-patches for ruby_wasm / wasmify-rails to support Ruby 3.4+ WASM builds. # # Fixes applied: # 1. Source URL override — use latest Ruby patch versions (3.3.11, 3.4.8, 4.0.2) # 2. Parser override — force parse.y instead of Prism (Prism crashes in WASM) # 3. shim.rb patch ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/controllers/regular_expressions_controller.rb
Ruby
mit
45
main
1,765
class RegularExpressionsController < ApplicationController def index @regular_expression = RegularExpression.new @svg_output = nil @diagram_error_message = nil end def create begin @regular_expression = RegularExpression.new(regular_expression_params) @regular_expression.display_capt...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/controllers/application_controller.rb
Ruby
mit
45
main
675
class ApplicationController < ActionController::Base # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. allow_browser versions: :modern before_action :set_locale private def set_locale if params[:locale].present? session[:locale] = params...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression.rb
Ruby
mit
45
main
4,336
class RegularExpression include ActiveModel::Model attr_accessor :regular_expression, :test_string, :options, :substitution_string validates :regular_expression, presence: true validates :test_string, presence: true validate :validate_regular_expression attr_reader :match_data, :elapsed_time_ms, :averag...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/reference.rb
Ruby
mit
45
main
3,315
class RegularExpression module Reference module_function def sections orig = [ { key: "character-classes-anchors", col_class: "grid-cols-[65px_1fr]" }, { key: "common-patterns", col_class: "grid-cols-[20px_1fr]" }, { key: "groups-quantifiers", col_class: "grid-cols-[50px_1fr]" }...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/ruby_code.rb
Ruby
mit
45
main
2,524
class RegularExpression class RubyCode include ActiveModel::Model attr_accessor :regular_expression, :test_string, :substitution_string def initialize(regular_expression:, test_string:, substitution_string: nil) @regular_expression = regular_expression @test_string = test_string @subst...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/substitution.rb
Ruby
mit
45
main
3,072
class RegularExpression class Substitution include ActiveModel::Model attr_accessor :regular_expression, :test_string, :substitution_string attr_reader :substitution_result validates :regular_expression, presence: true validates :test_string, presence: true validates :substitution_string, pr...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/railroad_diagram.rb
Ruby
mit
45
main
2,025
require_relative "./railroad_diagram_builder" class RegularExpression class RailroadDiagram include ActiveModel::Model attr_accessor :regular_expression, :options attr_reader :error_message validates :regular_expression, presence: true validate :check_for_lazy_or_possessive_quantifiers def...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/example.rb
Ruby
mit
45
main
9,263
class RegularExpression module Example module_function def categories orig = {} if I18n.exists?("regular_expressions.categories") begin locale_cats = I18n.t("regular_expressions.categories") if locale_cats.is_a?(Hash) && locale_cats.any? loaded = {} ...
github
aim2bpg/rubree
https://github.com/aim2bpg/rubree
app/models/regular_expression/railroad_diagram_builder.rb
Ruby
mit
45
main
15,429
class RegularExpression module RailroadDiagramBuilder module_function LABEL_MAP = { Regexp::Expression::Assertion::Lookahead => "positive lookahead", Regexp::Expression::Assertion::NegativeLookahead => "negative lookahead", Regexp::Expression::Assertion::Lookbehind...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
greenhouse_io.gemspec
Ruby
mit
45
master
1,336
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'greenhouse_io/version' Gem::Specification.new do |spec| spec.name = "greenhouse_io" spec.version = GreenhouseIo::VERSION spec.authors = %w(Greenhouse Software) spec.e...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
spec/spec_helper.rb
Ruby
mit
45
master
453
require "codeclimate-test-reporter" CodeClimate::TestReporter.start require 'rubygems' require 'bundler' require 'webmock/rspec' require 'vcr' require 'greenhouse_io' RSpec.configure do |config| end VCR.configure do |config| config.cassette_library_dir = 'spec/fixtures/cassettes' config.hook_into :webmock conf...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
spec/greenhouse_io/error_spec.rb
Ruby
mit
45
master
568
require 'spec_helper' describe GreenhouseIo::Error do describe "#inspect" do context "when http error code is present" do it "creates an error with the code" do http_error = GreenhouseIo::Error.new(nil, 404) expect(http_error.code).to eq(404) end end context "when its an in...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
spec/greenhouse_io/configuration_spec.rb
Ruby
mit
45
master
1,592
require 'spec_helper' describe GreenhouseIo::Configuration do after { restore_default_config } context "when no symbolize_keys is specified" do before do restore_default_config end it "returns the default value" do expect(GreenhouseIo.configuration.symbolize_keys).to be false end en...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
spec/greenhouse_io/api/job_board_spec.rb
Ruby
mit
45
master
6,471
require 'spec_helper' describe GreenhouseIo::JobBoard do it "should have a base url for an API endpoint" do expect(GreenhouseIo::JobBoard.base_uri).to eq("https://boards-api.greenhouse.io/v1") end context "given an instance of GreenhouseIo::JobBoard" do before do GreenhouseIo.configuration.symbo...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
spec/greenhouse_io/api/client_spec.rb
Ruby
mit
45
master
17,964
require 'spec_helper' describe GreenhouseIo::Client do FAKE_API_TOKEN = '123FakeToken' it "should have a base url for an API endpoint" do expect(GreenhouseIo::Client.base_uri).to eq("https://harvest.greenhouse.io/v1") end context "given an instance of GreenhouseIo::Client" do before do Greenh...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
lib/greenhouse_io.rb
Ruby
mit
45
master
241
require 'httmultiparty' require 'json' require "greenhouse_io/version" require "greenhouse_io/error" require "greenhouse_io/configuration" require "greenhouse_io/api" require "greenhouse_io/api/job_board" require "greenhouse_io/api/client"
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
lib/greenhouse_io/api.rb
Ruby
mit
45
master
398
module GreenhouseIo module API def get_response(url, options) self.class.get(url, options) end def post_response(url, options) self.class.post(url, options) end def parse_json(response) JSON.parse(response.body, symbolize_names: GreenhouseIo.configuration.symbolize_keys) en...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
lib/greenhouse_io/configuration.rb
Ruby
mit
45
master
364
module GreenhouseIo class Configuration attr_accessor :symbolize_keys, :organization, :api_token def initialize @symbolize_keys = false end end def self.configuration @configuration ||= Configuration.new end def self.configuration=(config) @configuration = config end def self...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
lib/greenhouse_io/api/job_board.rb
Ruby
mit
45
master
2,233
module GreenhouseIo class JobBoard include HTTMultiParty include GreenhouseIo::API attr_accessor :api_token, :organization base_uri 'https://boards-api.greenhouse.io/v1' def initialize(api_token = nil, default_options = {}) @api_token = api_token || GreenhouseIo.configuration.api_token ...
github
grnhse/greenhouse_io
https://github.com/grnhse/greenhouse_io
lib/greenhouse_io/api/client.rb
Ruby
mit
45
master
3,610
module GreenhouseIo class Client include HTTMultiParty include GreenhouseIo::API PERMITTED_OPTIONS = [:page, :per_page, :job_id] attr_accessor :api_token, :rate_limit, :rate_limit_remaining, :link base_uri 'https://harvest.greenhouse.io/v1' def initialize(api_token = nil) @api_token =...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
veritrans.gemspec
Ruby
apache-2.0
45
master
578
$:.push(File.expand_path("../lib", __FILE__)) require 'veritrans/version' Gem::Specification.new do |s| s.name = "veritrans" s.version = Veritrans::VERSION s.author = ["Veritrans Dev Team"] s.description= "Veritrans ruby client" s.email = ["pavel.evstigneev@midtrans.com"] s.homepage = "...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/subscription/credit_card_subscription_example.rb
Ruby
apache-2.0
45
master
5,261
require 'veritrans' # This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely. # Set Midtrans config # You can find it in Merchant Portal -> Settings -> Access keys Midtrans.config.server_key = "SB-Mid-server-uQmMImQMeo0Ky...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/subscription/gopay_subscription_example.rb
Ruby
apache-2.0
45
master
5,567
require 'veritrans' # This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely. # Set Midtrans config # You can find it in Merchant Portal -> Settings -> Access keys Midtrans.config.server_key = "SB-Mid-server-uQmMImQMeo0Ky...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/snap/snap_example.rb
Ruby
apache-2.0
45
master
1,500
require 'veritrans' # This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely. # Please refer to this docs for snap popup: # https://docs.midtrans.com/en/snap/integration-guide?id=integration-steps-overview # Please refer ...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/coreapi/core_api_credit_card_example.rb
Ruby
apache-2.0
45
master
2,650
require 'veritrans' # This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely. # Set Midtrans config # You can find it in Merchant Portal -> Settings -> Access keys Midtrans.config.server_key = "SB-Mid-server-uQmMImQMeo0Ky...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/tokenization/gopay_tokenization_example.rb
Ruby
apache-2.0
45
master
5,195
require 'veritrans' # This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely. # Set Midtrans config # You can find it in Merchant Portal -> Settings -> Access keys Midtrans.config.server_key = "SB-Mid-server-uQmMImQMeo0Ky...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/sinatra/webapp.rb
Ruby
apache-2.0
45
master
3,141
require 'veritrans' require 'json' require 'sinatra' Midtrans.config.server_key = "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2" Midtrans.config.client_key = "SB-Mid-client-ArNfhrh7st9bQKmz" Midtrans.config.api_host = "https://api.sandbox.midtrans.com" set :public_folder, File.dirname(__FILE__) set :views, File.dirname(__F...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
example/sinatra/Gemfile
Ruby
apache-2.0
45
master
320
source 'https://rubygems.org' gem 'sinatra' gem 'veritrans', path: "./../../" # install from local path, for testing purpose # @NOTE: in real usage scenario, for your project dependency you should only require # gem 'veritrans' # so the gem will be installed directly from rubygem repo. No need the `, path: "./../../"`
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans.rb
Ruby
apache-2.0
45
master
6,690
require 'veritrans/version' require 'veritrans/config' require 'veritrans/client' require 'veritrans/api' require 'veritrans/result' require 'veritrans/midtrans_error' if defined?(::Rails) require 'veritrans/events' end class Veritrans include Veritrans::Client include Veritrans::Api autoload :Events, 'v...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/config_test.rb
Ruby
apache-2.0
45
master
713
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox.midtrans.com", logger: Logger.new(STDO...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/gopay_tokenization_test.rb
Ruby
apache-2.0
45
master
2,088
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test i_suck_and_my_tests_are_order_dependent! def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox....
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/api_test.rb
Ruby
apache-2.0
45
master
9,133
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox.midtrans.com", logger: Logger.new(STD...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/transaction_test.rb
Ruby
apache-2.0
45
master
4,359
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox.midtrans.com", logger: Logger.new(STD...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/subscription_test.rb
Ruby
apache-2.0
45
master
2,899
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test i_suck_and_my_tests_are_order_dependent! def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox....
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/test/snap_test.rb
Ruby
apache-2.0
45
master
1,955
require 'veritrans' require 'minitest/autorun' class TestVeritrans < Minitest::Test def setup @mt_test = Veritrans.new( server_key: "SB-Mid-server-uQmMImQMeo0Ky3Svl90QTUj2", client_key: "SB-Mid-client-ArNfhrh7st9bQKmz", api_host: "https://api.sandbox.midtrans.com", logger: Logger.new(STD...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/events.rb
Ruby
apache-2.0
45
master
4,328
class Veritrans # # Rack based event notification callback processor # # Usage: # # Rails.application.routes.draw do # # ... # mount Veritrans::Events.new => '/vt_events' # end # # Veritrans::Events.subscribe('payment.success') do |payment| # payment.mark_paid!(payment.maske...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/client.rb
Ruby
apache-2.0
45
master
5,044
# Veritrans HTTP Client require "base64" require 'uri' require 'excon' class Veritrans module Client # If you using Rails then it will call ActiveSupport::JSON.encode # Otherwise JSON.pretty_generate def self._json_encode(params) if defined?(ActiveSupport) && defined?(ActiveSupport::JSON) ...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/config.rb
Ruby
apache-2.0
45
master
4,647
require 'yaml' require 'excon' require 'erb' class Veritrans class Config def initialize(options = nil) @api_host = "https://api.sandbox.midtrans.com" apply(options) if options end ## # Merhcant's Client key, used to make getToken request. (only for VT-Direct) # # Can be found ...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/midtrans_error.rb
Ruby
apache-2.0
45
master
448
class MidtransError < StandardError attr_reader :status alias_method :http_status_code, :status attr_reader :data alias_method :api_response, :data attr_reader :response alias_method :raw_http_client_data, :response def initialize(message, http_status_code = nil, api_response = nil, raw_http_client_data ...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/api.rb
Ruby
apache-2.0
45
master
9,744
# Veritrans API methods require 'erb' class Veritrans module Api # POST /v2/charge { payment_type: "credit_card" } # Docs https://api-docs.midtrans.com/#charge-features # # Example: # Veritrans.charge( # payment_type: "credit_card", # credit_card: { token_id: "<token from client>" }...
github
veritrans/veritrans-ruby
https://github.com/veritrans/veritrans-ruby
lib/veritrans/result.rb
Ruby
apache-2.0
45
master
4,569
class Veritrans # Midtrans response object, a wrapper for raw response object plus helper methods # # Usual response body for Midtrans.charge or Midtrans.status will look like this: # # { # "status_code": "200", # "status_message": "Success, Mandiri Clickpay transaction is successful", # "...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
Rakefile
Ruby
apache-2.0
45
master
537
require 'bundler/setup' require 'rake' require 'rake/clean' require 'rspec/core/rake_task' require_relative './lib/poi/version' NAME = 'jruby-poi' VERSION = POI.version desc "Build gem" task :package=>[:clean] do |p| sh %{#{FileUtils::RUBY} -S gem build jruby-poi.gemspec} end desc "Publish gem" task :release=>[:pa...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
jruby-poi.gemspec
Ruby
apache-2.0
45
master
817
# -*- encoding: utf-8 -*- require File.expand_path('../lib/poi/version', __FILE__) Gem::Specification.new do |s| s.name = "jruby-poi" s.version = POI.version s.authors = ["Scott Deming", "Jason Rogers"] s.date = "2016-11-04" s.description = "A rubyesque library for manipulating spreadsheets and other documen...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi.rb
Ruby
apache-2.0
45
master
970
JRUBY_POI_LIB_PATH=File.expand_path(File.dirname(__FILE__)) require File.join(JRUBY_POI_LIB_PATH, 'poi', 'version') # Java require 'java' require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'lib', 'commons-collections4-4.1.jar') require File.join(JRUBY_POI_LIB_PATH, 'poi-jars', 'poi-3.15.jar') require File.join(JRUBY_P...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook.rb
Ruby
apache-2.0
45
master
1,909
module POI AREA_REF = org.apache.poi.ss.util.AreaReference CELL_REF = org.apache.poi.ss.util.CellReference def self.Facade(delegate, java_class) cls = Class.new java_class.java_class.java_instance_methods.select{|e| e.public?}.each do | method | args = method.arity.times.collect{|i| "arg#{i}"}.jo...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/area.rb
Ruby
apache-2.0
45
master
2,550
module POI class Area def initialize reference, version @ref = reference @version = version end def in workbook if single_cell_reference? ref = area.all_referenced_cells.first return [workbook.single_cell(ref)] end begin by_column = {} # refs...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/cell.rb
Ruby
apache-2.0
45
master
4,346
# -*- coding: utf-8 -*- require 'date' module POI class Cells include Enumerable def initialize(row) @row = row @poi_row = row.poi_row @cells = {} end def [](index) @cells[index] ||= Cell.new(@poi_row.get_cell(index) || @poi_row.create_cell(index), @row) end de...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/worksheet.rb
Ruby
apache-2.0
45
master
1,771
module POI class Worksheets include Enumerable def initialize(workbook) @workbook = workbook @poi_workbook = workbook.poi_workbook end def [](index_or_name) worksheet = case when index_or_name.kind_of?(Numeric) @poi_workbook.get_sheet_at(index_or_name) || @poi...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/workbook.rb
Ruby
apache-2.0
45
master
8,427
require 'tmpdir' require 'stringio' require 'java' module POI class Workbook < Facade(:poi_workbook, org.apache.poi.ss.usermodel.Workbook) FONT = org.apache.poi.ss.usermodel.Font FONT_CONSTANTS = Hash[*FONT.constants.map{|e| [e.downcase.to_sym, FONT.const_get(e)]}.flatten] CELL_STYLE = org.apache.poi.ss...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/row.rb
Ruby
apache-2.0
45
master
1,072
module POI class Rows include Enumerable def initialize(worksheet) @worksheet = worksheet @poi_worksheet = worksheet.poi_worksheet @rows = {} end def [](index) @rows[index] ||= Row.new(@poi_worksheet.get_row(index) || @poi_worksheet.create_row(index), @worksheet) end ...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
lib/poi/workbook/named_range.rb
Ruby
apache-2.0
45
master
532
module POI class NamedRange # takes an instance of org.apache.poi.ss.usermodel.Name, and a POI::Workbook def initialize name, workbook @name = name @workbook = workbook end def name @name.name_name end def sheet @workbook.worksheets[@name.sheet_name] end ...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/workbook_spec.rb
Ruby
apache-2.0
45
master
12,771
require 'spec_helper' require 'date' require 'stringio' VARIOUS_SAMPLES_PATH = TestDataFile.expand_path("various_samples.xlsx") DATES_1904_WINDOW_XLS_PATH = TestDataFile.expand_path("1904_window_dates.xls") describe POI::Workbook do it "should open a workbook and allow access to its worksheets" do book = POI::...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/io_spec.rb
Ruby
apache-2.0
45
master
2,233
require 'spec_helper' describe POI::Workbook do before :each do @mock_output_stream = nil class POI::Workbook def mock_output_stream name @mock_output_stream ||= Java::jrubypoi.MockOutputStream.new name @mock_output_stream end alias_method :original_output_stream, :output_s...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/spec_helper.rb
Ruby
apache-2.0
45
master
634
require 'spec_helper' RSpec.configure do |c| c.filter_run_excluding :unimplemented => true c.expect_with(:rspec) { |expect_config| expect_config.syntax = :should } end require File.expand_path('../lib/poi', File.dirname(__FILE__)) Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f} require File...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/facade_spec.rb
Ruby
apache-2.0
45
master
2,112
require 'spec_helper' describe "POI.Facade" do it "should create specialized methods for boolean methods, getters, and setters" do book = POI::Workbook.create('foo.xlsx') sheet = book.create_sheet sheet.respond_to?(:column_broken?).should be true sheet.respond_to?(:column_hidden?).should be true ...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/writing_spec.rb
Ruby
apache-2.0
45
master
5,423
require 'date' require 'stringio' describe "writing Workbooks" do it "should create a new empty workbook" do name = 'new-workbook.xlsx' book = POI::Workbook.create(name) book.should_not be_nil end it "should create a new workbook and write something to it" do name = TestDataFile.expand_path("t...
github
kameeoze/jruby-poi
https://github.com/kameeoze/jruby-poi
spec/support/matchers/cell_matcher.rb
Ruby
apache-2.0
45
master
401
RSpec::Matchers.define :equal_at_cell do |expected, row, col| match do |actual| actual == expected end failure_message do |actual| "expected #{actual} to equal #{expected} (row:#{row}, cell:#{col})" end failure_message_when_negated do |actual| "expected #{actual} not to equal #{expected} (row:#{...
github
justin/SalesBoard
https://github.com/justin/SalesBoard
salesboard.rb
Ruby
mit
45
master
5,666
#!/usr/bin/env ruby startTime = Time.now require 'rubygems' require 'httparty' require 'base64' require 'date' require 'json' require 'action_view' require 'terminal-notifier' include ActionView::Helpers::DateHelper # SalesBoard - An AppFigures script for Status Board # Created by Justin Williams # http://twitter.com/...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
Capfile
Ruby
mit
45
master
1,163
# Load DSL and set up stages require "capistrano/setup" # Include default deployment tasks require "capistrano/deploy" require "capistrano/scm/git" install_plugin Capistrano::SCM::Git # Load the SCM plugin appropriate to your project: # # require "capistrano/scm/hg" # install_plugin Capistrano::SCM::Hg # or # requi...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
Gemfile
Ruby
mit
45
master
2,209
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '>= 2.5.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.1', '>= 6.1.3.1' # Use postgresql as the database for Active Record gem 'pg' # Use Puma as the app server gem 'puma', '~> 5' ...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/schema.rb
Ruby
mit
45
master
4,525
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `rails #...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20160626214140_add_thermostat_settings.rb
Ruby
mit
45
master
538
class AddThermostatSettings < ActiveRecord::Migration[4.2] def change add_column :thermostats, :temperature_sensor_id, :string, default: nil add_column :thermostats, :gpio_cool_pin, :integer, default: nil add_column :thermostats, :gpio_heat_pin, :integer, default: nil add_column :ther...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20140416001439_create_thermostats.rb
Ruby
mit
45
master
280
class CreateThermostats < ActiveRecord::Migration[4.2] def change create_table :thermostats do |t| t.string :name t.float :current_temperature t.float :target_temperature t.integer :mode t.boolean :running t.timestamps end end end
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20171002183604_add_air_stirring_to_schedule.rb
Ruby
mit
45
master
380
class AddAirStirringToSchedule < ActiveRecord::Migration[5.0] def change add_column :thermostat_schedules, :stir_air, :boolean, default: false add_column :thermostat_schedules, :stir_air_minutes, :integer, default: 5 add_column :thermostat_schedules, :stir_air_window, :integer, default: 60 add_colum...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20160623151122_set_defaults.rb
Ruby
mit
45
master
1,109
class SetDefaults < ActiveRecord::Migration[4.2] def change change_column :thermostat_schedule_rules, :sunday, :boolean, default: false change_column :thermostat_schedule_rules, :monday, :boolean, default: false change_column :thermostat_schedule_rules, :tuesday, :boolean, default: false chang...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20140421212051_create_thermostat_histories.rb
Ruby
mit
45
master
710
class CreateThermostatHistories < ActiveRecord::Migration[4.2] def change create_table :thermostat_histories do |t| t.integer :thermostat_id t.integer :year t.integer :day_of_year t.float :low_temperature t.float :high_temperature t.float :mean_temperature t.integer :runt...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20140421230334_create_thermostat_schedule_rules.rb
Ruby
mit
45
master
525
class CreateThermostatScheduleRules < ActiveRecord::Migration[4.2] def change create_table :thermostat_schedule_rules do |t| t.references :thermostat_schedule, index: true t.boolean :sunday t.boolean :monday t.boolean :tuesday t.boolean :wednesday t.boolean :thursday t.bo...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20140422005629_add_overrides_to_thermostat.rb
Ruby
mit
45
master
265
class AddOverridesToThermostat < ActiveRecord::Migration[4.2] def change add_column :thermostats, :override_until, :datetime add_column :thermostats, :override_target_temperature, :float add_column :thermostats, :override_hysteresis, :float end end
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20140421225819_create_thermostat_schedules.rb
Ruby
mit
45
master
249
class CreateThermostatSchedules < ActiveRecord::Migration[4.2] def change create_table :thermostat_schedules do |t| t.string :name t.references :thermostat, index: true t.boolean :active t.timestamps end end end
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
db/migrate/20200101224243_devise_create_users.rb
Ruby
mit
45
master
1,383
# frozen_string_literal: true class DeviseCreateUsers < ActiveRecord::Migration[6.0] def change create_table :users do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.stri...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/controllers/thermostat_schedules_controller.rb
Ruby
mit
45
master
1,612
class ThermostatSchedulesController < ApplicationController # respond_to :html, :json before_action :ensure_authentication!, except: [] before_action :load_thermostat, :load_thermostat_schedule def index @thermostat_schedules = ThermostatSchedule.order(:name) @thermostat_schedule = @thermostat.thermos...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/controllers/thermostat_schedule_rules_controller.rb
Ruby
mit
45
master
1,282
class ThermostatScheduleRulesController < ApplicationController before_action :load_thermostat, :load_thermostat_schedule, :load_thermostat_schedule_rule before_action :ensure_authentication!, except: [] def new @thermostat_schedule_rule = @thermostat_schedule.thermostat_schedule_rules.new end def ed...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/controllers/application_controller.rb
Ruby
mit
45
master
941
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :null_session, prepend: true def ensure_authentication! Current.api_request = false if request.headers[:authorizati...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/controllers/thermostats_controller.rb
Ruby
mit
45
master
4,509
class ThermostatsController < ApplicationController # respond_to :html, :json before_action :load_thermostat, except: [:new, :create] before_action :ensure_authentication!, except: [:new, :create, :show, :update_current_temperature, :log_current_data] def new @thermostat = Thermostat.new end def crea...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/controllers/users_controller.rb
Ruby
mit
45
master
733
class UsersController < ApplicationController def new if User.count > 0 redirect_to root_path, notice: "Only one user account can be created at this time." return end @user = User.new end def create if User.count > 0 redirect_to root_path, notice: "Only one user accoun...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/helpers/thermostats_helper.rb
Ruby
mit
45
master
435
module ThermostatsHelper def temperature_sensor_ids_from_system files = Dir.glob("/sys/bus/w1/devices/*") devices = if files.present? Dir.glob("/sys/bus/w1/devices/*").map do |device| File.basename(device) end else ["--No One-Wire devices detected--"] end devices << Therm...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/models/thermostat_history.rb
Ruby
mit
45
master
1,961
class ThermostatHistory < ApplicationRecord belongs_to :thermostat scope :now_for_thermostat, -> (thermostat) { year = Time.zone.now.year yday = Time.zone.now.yday where( ["thermostat_id = ? AND year = ? AND day_of_year = ?", thermostat.id, year, yday] ) } scope :today, -> { year = Time.zone...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/models/thermostat.rb
Ruby
mit
45
master
6,744
# You have to do this before you an get things to work: # $ gpio mode 0 out class Thermostat < ApplicationRecord enum mode: [ :off, :fan, :heat, :cool ] enum override_mode: [ :override_mode_off, :override_mode_fan, :override_mode_heat, :override_mode_cool ] has_many :thermostat_histories has_many :thermostat_...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/models/thermostat_schedule.rb
Ruby
mit
45
master
460
class ThermostatSchedule < ApplicationRecord belongs_to :thermostat has_many :thermostat_schedule_rules, dependent: :destroy scope :active, -> { where( active: true ) } after_save :make_active_if_no_other_schedules_active def make_active! thermostat.thermostat_schedules.update_all(active: false) up...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/models/user.rb
Ruby
mit
45
master
539
require 'securerandom' class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :lockable, :trackable ...