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 |
|---|---|---|---|---|---|---|---|---|
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/initializers/inflections.rb | dummy/rails-3.2/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/initializers/backtrace_silencers.rb | dummy/rails-3.2/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/initializers/mime_types.rb | dummy/rails-3.2/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/initializers/secret_token.rb | dummy/rails-3.2/config/initializers/secret_token.rb | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/environments/test.rb | dummy/rails-3.2/config/environments/test.rb | Rails3221::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test ... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/environments/development.rb | dummy/rails-3.2/config/environments/development.rb | Rails3221::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web ... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-3.2/config/environments/production.rb | dummy/rails-3.2/config/environments/production.rb | Rails3221::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.acti... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/app/helpers/users_helper.rb | dummy/rails-4.2/app/helpers/users_helper.rb | module UsersHelper
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/app/helpers/application_helper.rb | dummy/rails-4.2/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/app/controllers/users_controller.rb | dummy/rails-4.2/app/controllers/users_controller.rb | class UsersController < ApplicationController
def new
end
def create
render text: 'ok'
end
private
def honeypot_string
'im-not-a-honeypot-at-all'
end
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/app/controllers/application_controller.rb | dummy/rails-4.2/app/controllers/application_controller.rb | 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: :exception
def honeypot_fields
{
:my_custom_comment_body => 'Custom field name',
42 => 'Number field name',
... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/app/models/user.rb | dummy/rails-4.2/app/models/user.rb | class User
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :name
def persisted?
false
end
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/db/seeds.rb | dummy/rails-4.2/db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/test/test_helper.rb | dummy/rails-4.2/test/test_helper.rb | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/test/controllers/users_controller_test.rb | dummy/rails-4.2/test/controllers/users_controller_test.rb | require 'test_helper'
class UsersControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/test/models/user_test.rb | dummy/rails-4.2/test/models/user_test.rb | require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/application.rb | dummy/rails-4.2/config/application.rb | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Rails420
class Application < Rails::Application
# Settings in config/environments/* take prec... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/environment.rb | dummy/rails-4.2/config/environment.rb | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/routes.rb | dummy/rails-4.2/config/routes.rb | Rails.application.routes.draw do
resources :users
end
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/boot.rb | dummy/rails-4.2/config/boot.rb | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/filter_parameter_logging.rb | dummy/rails-4.2/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/session_store.rb | dummy/rails-4.2/config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_rails-4_2_0_session'
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/wrap_parameters.rb | dummy/rails-4.2/config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/inflections.rb | dummy/rails-4.2/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/cookies_serializer.rb | dummy/rails-4.2/config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/assets.rb | dummy/rails-4.2/config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/backtrace_silencers.rb | dummy/rails-4.2/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/initializers/mime_types.rb | dummy/rails-4.2/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/environments/test.rb | dummy/rails-4.2/config/environments/test.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/environments/development.rb | dummy/rails-4.2/config/environments/development.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/dummy/rails-4.2/config/environments/production.rb | dummy/rails-4.2/config/environments/production.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/spec/honeypot-captcha_spec.rb | spec/honeypot-captcha_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Honeypot Captcha" do
include RSpecHtmlMatchers
before do
@view = TestView.new
end
it 'inserts honeypot tags' do
options = {:honeypot => true}
html = @view.form_tag_html(options)
hp_string = @view.honeypot_string
... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
module SimpleCov::Configuration
def clean_filters
@filters = []
end
end
SimpleCov.configure do
clean_filters
load_adapter 'test_frameworks'
end
ENV["COVERAGE"] && SimpleCov.start do
add_filter "/.rvm/"
end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/lib/honeypot-captcha.rb | lib/honeypot-captcha.rb | require 'honeypot-captcha/form_tag_helper'
module HoneypotCaptcha
module SpamProtection
def honeypot_fields
{ :a_comment_body => 'Do not fill in this field' }
end
def honeypot_string
'hp'
end
def honeypot_style_class
nil
end
def protect_from_spam
head :ok if hon... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
curtis/honeypot-captcha | https://github.com/curtis/honeypot-captcha/blob/cb1317c3b5ef8138f91bdab81762c720dcf4b684/lib/honeypot-captcha/form_tag_helper.rb | lib/honeypot-captcha/form_tag_helper.rb | # Override the form_tag helper to add honeypot spam protection to forms.
module ActionView
module Helpers
module FormTagHelper
def form_tag_html_with_honeypot(options)
honeypot = options.delete(:honeypot) || options.delete('honeypot')
html = form_tag_html_without_honeypot(options)
... | ruby | MIT | cb1317c3b5ef8138f91bdab81762c720dcf4b684 | 2026-01-04T17:35:23.404602Z | false |
arr2036/omnigollum | https://github.com/arr2036/omnigollum/blob/6398e723920ababaaba47188bd9377f4742b92a5/views/login.rb | views/login.rb | module Omnigollum
module Views
class Login < Mustache
self.template_path = File.expand_path("../../templates", __FILE__)
self.template_name = 'Login'
def title
@title
end
def subtext
@subtext
end
def providers_active
providers ... | ruby | MIT | 6398e723920ababaaba47188bd9377f4742b92a5 | 2026-01-04T17:35:26.130927Z | false |
arr2036/omnigollum | https://github.com/arr2036/omnigollum/blob/6398e723920ababaaba47188bd9377f4742b92a5/views/error.rb | views/error.rb | module Omnigollum
module Views
class Error < Mustache
self.template_path = File.expand_path("../../templates", __FILE__)
self.template_name = 'Error'
def title
@title
end
def subtext
@subtext
end
def loginurl
@auth[:route_prefix] + '... | ruby | MIT | 6398e723920ababaaba47188bd9377f4742b92a5 | 2026-01-04T17:35:26.130927Z | false |
arr2036/omnigollum | https://github.com/arr2036/omnigollum/blob/6398e723920ababaaba47188bd9377f4742b92a5/lib/omnigollum.rb | lib/omnigollum.rb | require 'cgi'
require 'omniauth'
require 'mustache/sinatra'
require 'sinatra/base'
module Omnigollum
module Views; class Layout < Mustache; end; end
module Models
class OmniauthUserInitError < StandardError; end
class User
attr_reader :uid, :name, :email, :nickname, :provider
end
class Omni... | ruby | MIT | 6398e723920ababaaba47188bd9377f4742b92a5 | 2026-01-04T17:35:26.130927Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/rails/init.rb | rails/init.rb | require 'template_streaming'
require 'template_streaming/error_recovery'
require 'template_streaming/new_relic' if defined?(NewRelic)
| ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/template_streaming_spec.rb | spec/template_streaming_spec.rb | require 'spec/spec_helper'
describe TemplateStreaming do
include StreamingApp
describe "#flush" do
describe "when streaming" do
before do
action do
render :stream => true, :layout => 'layout'
end
end
it "should flush the rendered content immediately" do
lay... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/autoflushing_spec.rb | spec/autoflushing_spec.rb | require 'spec/spec_helper'
describe TemplateStreaming::Autoflushing do
include StreamingApp
describe "when streaming" do
describe "when autoflushing is on" do
use_attribute_value TemplateStreaming, :autoflush, 0
it "should automatically flush" do
layout "[<%= yield %>]"
view "(<%=... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/error_recovery_spec.rb | spec/error_recovery_spec.rb | require 'spec/spec_helper'
describe TemplateStreaming::ErrorRecovery do
include StreamingApp
describe "when there is an error during rendering" do
before do
class TestController
def rescue_action(exception)
# Run the default handler.
ActionController::Base.instance_method(:re... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/caching_spec.rb | spec/caching_spec.rb | require 'spec/spec_helper'
describe TemplateStreaming::Caching do
include StreamingApp
describe "page caching" do
use_attribute_value ActionController::Base, :page_cache_directory, "#{TMP}/page_cache"
use_attribute_value ActionController::Base, :perform_caching, true
before do
controller.caches... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/spec_helper.rb | spec/spec_helper.rb | $:.unshift File.expand_path('../lib', File.dirname(__FILE__))
ROOT = File.expand_path('..', File.dirname(__FILE__))
TMP = "#{ROOT}/spec/tmp"
require 'bundler'
Bundler.setup(:default, :development)
require 'action_controller'
require 'template_streaming'
require 'temporaries'
require 'support/streaming_app'
| ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/spec/support/streaming_app.rb | spec/support/streaming_app.rb | module StreamingApp
VIEW_PATH = "#{TMP}/views"
COOKIE_SECRET = 'x'*30
def self.included(base)
base.before { setup_streaming_app }
base.after { teardown_streaming_app }
end
def setup_streaming_app
push_temporary_directory TMP
ActionController::Base.session = {:key => "session", :secret => CO... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming.rb | lib/template_streaming.rb | module TemplateStreaming
class << self
def configure(config)
config.each do |key, value|
send "#{key}=", value
end
end
end
STREAMING_KEY = 'template_streaming.streaming'.freeze
module Controller
def self.included(base)
base.class_eval do
extend ClassMethods
... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming/version.rb | lib/template_streaming/version.rb | module TemplateStreaming
VERSION = [0, 1, 0]
class << VERSION
include Comparable
def to_s
join('.')
end
end
end
| ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming/new_relic.rb | lib/template_streaming/new_relic.rb | #
# The NewRelic agent won't consider activity outside of the
# controller's #perform_action inside the scope of the request. We
# need to add the rendering that occurs in the response body's #each
# to the stats and traces.
#
# The New Relic agent offers no useful API for this, so we resort to
# fugly, brittle hacks. ... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming/autoflushing.rb | lib/template_streaming/autoflushing.rb | module TemplateStreaming
class << self
#
# If non-nil, #flush will automatically be called when streaming
# before and after each render call.
#
# The value of this attribute should be a number, which is the
# number of milliseconds since the last flush that should elapse
# for the autoflu... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming/caching.rb | lib/template_streaming/caching.rb | module TemplateStreaming
module Caching
CACHER_KEY = 'template_streaming.caching.cacher'.freeze
module Controller
def cache_page(content = nil, options = nil)
if content
super
else
request.env[CACHER_KEY] = lambda { |c| super(c, options) }
end
end
e... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
oggy/template_streaming | https://github.com/oggy/template_streaming/blob/65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1/lib/template_streaming/error_recovery.rb | lib/template_streaming/error_recovery.rb | module TemplateStreaming
module ErrorRecovery
CONTROLLER_KEY = 'template_streaming.error_recovery.controller'.freeze
EXCEPTIONS_KEY = 'template_streaming.error_recovery.exceptions'.freeze
class Middleware
def initialize(app)
@app = app
end
def call(env)
response = *@app... | ruby | MIT | 65fd32732d3fe7dce65b223b99ffe11cf8fdc6e1 | 2026-01-04T17:35:26.974696Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/sanitize_flash_spec.rb | spec/sanitize_flash_spec.rb | require 'spec_helper'
describe UnobtrusiveFlash::ControllerMixin do
describe '.sanitize_flash' do
it 'should escape messages that are not html safe' do
expect(described_class.sanitize_flash({:notice => '<bar>'}, [:notice])).to eq([["notice", '<bar>']])
end
it 'should not escape messages that... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/domain_spec.rb | spec/domain_spec.rb | require 'spec_helper'
describe UnobtrusiveFlash::ControllerMixin do
describe '#unobtrusive_flash_domain' do
let(:controller_class) { Struct.new(:request) }
before(:each) { controller_class.send(:include, UnobtrusiveFlash::ControllerMixin) }
subject { controller_class.new( double('request', host: host) ) ... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/spec_helper.rb | spec/spec_helper.rb | require 'bundler'
require 'rspec'
require 'capybara/rspec'
ENV['JQUERY_VERSION'] ||= '2.1.1'
require 'rails'
require 'unobtrusive_flash'
require 'support/rails_app'
Capybara.app = TestApp
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
| ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/support/rails_app.rb | spec/support/rails_app.rb | # From https://gist.github.com/josevalim/1942658
require 'rails'
require 'action_controller/railtie'
require 'sprockets/railtie'
require 'jquery-rails'
if Rails::VERSION::MAJOR == 4
require 'turbolinks'
require 'jquery-turbolinks'
end
class TestApp < Rails::Application
routes.append do
%w(api ui bootstrap ... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/integration/turbolinks_spec.rb | spec/integration/turbolinks_spec.rb | require 'spec_helper'
if Rails.version.start_with? "4."
describe "turbolinks spec", type: :feature, js: true do
it 'should invoke the API for each flash message' do
visit '/test/turbolinks'
click_link 'This is a turbolink'
expect(page).to have_content 'Turbolink content'
expect(evaluate_s... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/integration/api_spec.rb | spec/integration/api_spec.rb | require 'spec_helper'
describe "api spec", type: :feature, js: true do
it 'should invoke the API for each flash message' do
visit '/test/api'
expect(page).to have_content 'Page loaded'
expect(evaluate_script('window.flashMessages')).to eq [
{'type' => 'notice', 'message' => 'Inline Notice'},
... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/integration/ui_spec.rb | spec/integration/ui_spec.rb | require 'spec_helper'
describe "ui spec", type: :feature, js: true do
it 'should show each flash message' do
visit '/test/ui'
expect(page).to have_content 'Page loaded'
expect(page).to have_content 'Inline Notice', count: 1
expect(page).to have_content 'Ajax Error', count: 1
end
end
| ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/spec/integration/bootstrap_spec.rb | spec/integration/bootstrap_spec.rb | require 'spec_helper'
describe "bootstrap spec", type: :feature, js: true do
it 'should show each flash message' do
visit '/test/bootstrap'
expect(page).to have_content 'Page loaded'
expect(page).to have_content 'Inline Notice', count: 1
expect(page).to have_content 'Ajax Error', count: 1
end
it... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/lib/unobtrusive_flash.rb | lib/unobtrusive_flash.rb | require "unobtrusive_flash/version"
require "unobtrusive_flash/engine"
module UnobtrusiveFlash
end
| ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/lib/unobtrusive_flash/version.rb | lib/unobtrusive_flash/version.rb | module UnobtrusiveFlash
VERSION = "3.3.2"
end
| ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/lib/unobtrusive_flash/controller_mixin.rb | lib/unobtrusive_flash/controller_mixin.rb | require 'active_support/core_ext/string/output_safety'
module UnobtrusiveFlash
module ControllerMixin
protected
def prepare_unobtrusive_flash
return unless flash.any?
# TODO: replace configuration based on overriding methods with a conventional config block
cookies[:flash] = {
valu... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
leonid-shevtsov/unobtrusive_flash | https://github.com/leonid-shevtsov/unobtrusive_flash/blob/c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d/lib/unobtrusive_flash/engine.rb | lib/unobtrusive_flash/engine.rb | require 'unobtrusive_flash'
require "unobtrusive_flash/controller_mixin"
require 'rails'
module UnobtrusiveFlash
class Engine < ::Rails::Engine
initializer 'unobtrusive_flash.initialize', :after => :after_initialize do
ActionController::Base.send :include, UnobtrusiveFlash::ControllerMixin
end
end
en... | ruby | MIT | c5f6ef3c344f57c43c6401061e79cfdf5bdbb12d | 2026-01-04T17:35:31.969888Z | false |
siebertm/parse-cron | https://github.com/siebertm/parse-cron/blob/5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b/spec/cron_parser_spec.rb | spec/cron_parser_spec.rb | require "time"
require "./spec/spec_helper"
require "cron_parser"
require "date"
def parse_date(str)
dt = DateTime.strptime(str, "%Y-%m-%d %H:%M")
Time.local(dt.year, dt.month, dt.day, dt.hour, dt.min, 0)
end
describe "CronParser#parse_element" do
[
["*", 0..59, (0..59).to_a],
["*/10", 0..59, [0, 10, 20... | ruby | MIT | 5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b | 2026-01-04T17:35:48.573950Z | false |
siebertm/parse-cron | https://github.com/siebertm/parse-cron/blob/5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b/spec/spec_helper.rb | spec/spec_helper.rb | spec_dir = File.dirname(__FILE__)
lib_dir = File.expand_path(File.join(spec_dir, '..', 'lib'))
$:.unshift(lib_dir)
$:.uniq!
RSpec.configure do |config|
end
require 'cron_parser'
| ruby | MIT | 5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b | 2026-01-04T17:35:48.573950Z | false |
siebertm/parse-cron | https://github.com/siebertm/parse-cron/blob/5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b/lib/cron_parser.rb | lib/cron_parser.rb | require 'set'
require 'date'
# Parses cron expressions and computes the next occurence of the "job"
#
class CronParser
# internal "mutable" time representation
class InternalTime
attr_accessor :year, :month, :day, :hour, :min
attr_accessor :time_source
def initialize(time,time_source = Time)
@ye... | ruby | MIT | 5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b | 2026-01-04T17:35:48.573950Z | false |
siebertm/parse-cron | https://github.com/siebertm/parse-cron/blob/5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b/lib/parse-cron.rb | lib/parse-cron.rb | # More logical way to require 'cron_parser'
require File.join(File.dirname(__FILE__), 'cron_parser')
| ruby | MIT | 5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b | 2026-01-04T17:35:48.573950Z | false |
siebertm/parse-cron | https://github.com/siebertm/parse-cron/blob/5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b/lib/parse-cron/version.rb | lib/parse-cron/version.rb | module Parse
module Cron
VERSION = "0.1.4"
end
end
| ruby | MIT | 5ff2cd5bb6c469bf5aa499a90fa49bdc19fcd94b | 2026-01-04T17:35:48.573950Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'coveralls'
Coveralls.wear!
require 'heytmux'
require 'minitest/autorun'
class HeytmuxTestBase < Minitest::Test
Tmux = Heytmux::Tmux
def query(window_index, pane_index, format = '#{pane_title}')
# XXX: It takes a lit... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/tmux_test.rb | test/heytmux/tmux_test.rb | # frozen_string_literal: true
require 'test_helper'
class HeytmuxTmuxTest < HeytmuxTestBase
def test_tmux
assert_match(/tmux [2-9]\.+[0-9]+|tmux master/, Tmux.tmux('-V'))
end
def test_list
list = Tmux.list
assert_instance_of Array, list
list.all? do |e|
assert_instance_of Hash, e
as... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/core_test.rb | test/heytmux/core_test.rb | # frozen_string_literal: true
require 'test_helper'
class HeytmuxCoreTest < HeytmuxTestBase
def test_that_it_has_a_version_number
refute_nil ::Heytmux::VERSION
end
def test_replace_env_vars
ENV['A'] = 'foo'
ENV.delete 'B'
assert_equal 'foo / bar',
Heytmux.replace_env_vars('{{ $... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/validations_test.rb | test/heytmux/validations_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'English'
class HeytmuxValidationsTest < HeytmuxTestBase
def test_validate
# Invalid
[1, '1', :foo, {},
{ 'windows' => 'foo' },
{ 'windows' => nil }].each do |spec|
assert_raises(ArgumentError) { Heytmux::Validations.validate(spec) ... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/pane_action_test.rb | test/heytmux/pane_action_test.rb | # frozen_string_literal: true
require 'test_helper'
class HeytmuxPaneActionTest < HeytmuxTestBase
class IncompleteAction < Heytmux::PaneAction
end
def test_unimplemented_process
assert_raises(NotImplementedError) do
IncompleteAction.new.process(nil, nil, nil)
end
end
def test_default_validat... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/pane_actions/keys_test.rb | test/heytmux/pane_actions/keys_test.rb | # frozen_string_literal: true
require 'test_helper'
module Heytmux
module PaneActions
class KeysTest < HeytmuxTestBase
def test_validate
# Nested arrays are not allowed
[{}, [[]]].each do |val|
assert_raises(ArgumentError) { Keys.new.validate(val) }
end
['foo', %w... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/test/heytmux/pane_actions/sleep_test.rb | test/heytmux/pane_actions/sleep_test.rb | # frozen_string_literal: true
require 'test_helper'
module Heytmux
module PaneActions
class SleepTest < HeytmuxTestBase
def test_validate
[-1, 'string', 0].each do |val|
assert_raises(ArgumentError) { Sleep.new.validate(val) }
end
[1, '1'].each do |val|
Sleep.ne... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux.rb | lib/heytmux.rb | # frozen_string_literal: true
require 'set'
# Hey tmux!
module Heytmux
DEFAULT_LAYOUT = ->(num_panes) { num_panes <= 3 ? 'even-vertical' : 'tiled' }
DEFAULT_OPTIONS = {
'automatic-rename' => 'off',
'allow-rename' => 'off',
'pane-base-index' => 0,
'pane-border-status' => 'bottom',
'pane-border-... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/core.rb | lib/heytmux/core.rb | # frozen_string_literal: true
# Core functions of Heytmux
module Heytmux
module_function
def replace_env_vars(raw_input)
raw_input.gsub(ENV_PAT) do
name = Regexp.last_match[1]
default = Regexp.last_match[2]
ENV.fetch(name, default) ||
raise(ArgumentError, "Missing environment variabl... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/version.rb | lib/heytmux/version.rb | # frozen_string_literal: true
module Heytmux
VERSION = '0.3.0'
end
| ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/pane_action.rb | lib/heytmux/pane_action.rb | # frozen_string_literal: true
module Heytmux
# Base class for pane actions. To implement a new type of action that is
# applied to a designated pane, one should write a class that derives from
# this class. Use register class method to associate the class with one or
# more labels.
class PaneAction
# Val... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/tmux.rb | lib/heytmux/tmux.rb | # frozen_string_literal: true
require 'shellwords'
require 'tempfile'
module Heytmux
# Tmux integration
module Tmux
module_function
def tmux(*args)
args = args.flatten.map { |a| Shellwords.escape(a.to_s) }
command = "tmux #{args.join(' ')}"
(@mutex ||= Mutex.new).synchronize do
... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/validations.rb | lib/heytmux/validations.rb | # frozen_string_literal: true
module Heytmux
# Validates workspace specification
module Validations
module_function
# Validates spec struct and raises ArgumentError on error
def validate(spec)
windows = case spec
when Hash
unless spec.key?(WINDOWS_KEY)
... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/pane_actions/paste.rb | lib/heytmux/pane_actions/paste.rb | # frozen_string_literal: true
module Heytmux
module PaneActions
# Waits for a certain regular expression pattern appears
class Paste < PaneAction
register :paste
def validate(body)
case body
when Hash, Array
raise ArgumentError, "Invalid command: #{body}"
end
... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/pane_actions/expect.rb | lib/heytmux/pane_actions/expect.rb | # frozen_string_literal: true
require 'English'
module Heytmux
module PaneActions
# Pastes the command onto the pane
class Expect < PaneAction
register :expect
def validate(body)
raise ArgumentError, 'Expect condition is empty' if body.to_s.empty?
end
def process(window_ind... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/pane_actions/keys.rb | lib/heytmux/pane_actions/keys.rb | # frozen_string_literal: true
module Heytmux
module PaneActions
# Send keys using tmux send-keys command
class Keys < PaneAction
register :keys, :key
def validate(body)
body = body.is_a?(Array) ? body : [body]
body.each do |key|
unless Validations.valid_string?(key)
... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
junegunn/heytmux | https://github.com/junegunn/heytmux/blob/f2feee5ddeedf20ca0d2f117cbb08c92d759615f/lib/heytmux/pane_actions/sleep.rb | lib/heytmux/pane_actions/sleep.rb | # frozen_string_literal: true
module Heytmux
module PaneActions
# Sleeps for the given duration
class Sleep < PaneAction
register :sleep
def validate(body)
raise ArgumentError, 'Sleep expects positive number' if body.to_f <= 0
end
def process(_window_index, _pane_index, body... | ruby | MIT | f2feee5ddeedf20ca0d2f117cbb08c92d759615f | 2026-01-04T17:35:53.709735Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/test/ort_value_test.rb | test/ort_value_test.rb | require_relative "test_helper"
class OrtValueTest < Minitest::Test
def test_from_numo
skip unless numo?
x = Numo::SFloat.cast([[5.8, 2.8]])
value = OnnxRuntime::OrtValue.from_numo(x)
assert_equal true, value.tensor?
assert_equal "tensor(float)", value.data_type
assert_equal :float, value.ele... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/test/model_test.rb | test/model_test.rb | require_relative "test_helper"
class ModelTest < Minitest::Test
def test_basic
model = OnnxRuntime::Model.new("test/support/model.onnx")
expected = [{name: "x", type: "tensor(float)", shape: [3, 4, 5]}]
assert_equal expected, model.inputs
expected = [{name: "y", type: "tensor(float)", shape: [3, 4,... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/test/test_helper.rb | test/test_helper.rb | require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
require "tmpdir"
class Minitest::Test
def setup
# autoload before GC.stress
OnnxRuntime::FFI if stress?
GC.stress = true if stress?
# avoid hanging from too many threads on CI
GC.start if linux? && ci?
end
def tea... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/test/datasets_test.rb | test/datasets_test.rb | require_relative "test_helper"
class DatasetsTest < Minitest::Test
def test_examples
assert_example "logreg_iris.onnx", ["float_input"]
assert_example "mul_1.onnx", ["X"]
assert_example "sigmoid.onnx", ["x"]
end
def test_bad_example
error = assert_raises(ArgumentError) do
OnnxRuntime::Data... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/test/inference_session_test.rb | test/inference_session_test.rb | require_relative "test_helper"
class InferenceSessionTest < Minitest::Test
def test_run_with_ort_values
skip unless numo?
sess = OnnxRuntime::InferenceSession.new("test/support/lightgbm.onnx")
x = OnnxRuntime::OrtValue.from_numo(Numo::SFloat.cast([[5.8, 2.8]]))
output = sess.run_with_ort_values(nil,... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime.rb | lib/onnxruntime.rb | # dependencies
require "ffi"
# modules
require_relative "onnxruntime/datasets"
require_relative "onnxruntime/inference_session"
require_relative "onnxruntime/model"
require_relative "onnxruntime/ort_value"
require_relative "onnxruntime/utils"
require_relative "onnxruntime/version"
module OnnxRuntime
class Error < S... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/version.rb | lib/onnxruntime/version.rb | module OnnxRuntime
VERSION = "0.10.1"
end
| ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/utils.rb | lib/onnxruntime/utils.rb | module OnnxRuntime
module Utils
class << self
attr_accessor :mutex
end
self.mutex = Mutex.new
def self.check_status(status)
unless status.null?
message = api[:GetErrorMessage].call(status).read_string
api[:ReleaseStatus].call(status)
raise Error, message
end
... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/ort_value.rb | lib/onnxruntime/ort_value.rb | module OnnxRuntime
class OrtValue
def initialize(ptr, ref = nil)
@ptr = ::FFI::AutoPointer.new(ptr, FFI.api[:ReleaseValue])
@ref = ref # keep reference to data
end
def self.from_numo(numo_obj)
element_type = numo_obj.is_a?(Numo::Bit) ? :bool : Utils.numo_types.invert[numo_obj.class]
... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/ffi.rb | lib/onnxruntime/ffi.rb | module OnnxRuntime
module FFI
extend ::FFI::Library
ffi_lib OnnxRuntime.ffi_lib
# https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_c_api.h
# keep same order
ORT_API_VERSION = 16
# enums
TensorElementDataType = enum(:undefined, :float, :u... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/inference_session.rb | lib/onnxruntime/inference_session.rb | module OnnxRuntime
class InferenceSession
attr_reader :inputs, :outputs
def initialize(path_or_bytes, enable_cpu_mem_arena: true, enable_mem_pattern: true, enable_profiling: false, execution_mode: nil, free_dimension_overrides_by_denotation: nil, free_dimension_overrides_by_name: nil, graph_optimization_leve... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/datasets.rb | lib/onnxruntime/datasets.rb | module OnnxRuntime
module Datasets
def self.example(name)
unless %w(logreg_iris.onnx mul_1.onnx sigmoid.onnx).include?(name)
raise ArgumentError, "Unable to find example '#{name}'"
end
File.expand_path("../../datasets/#{name}", __dir__)
end
end
end
| ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
ankane/onnxruntime-ruby | https://github.com/ankane/onnxruntime-ruby/blob/e878f5ad768f687152fab31e69914237bd4aa12e/lib/onnxruntime/model.rb | lib/onnxruntime/model.rb | module OnnxRuntime
class Model
def initialize(path_or_bytes, **session_options)
@session = InferenceSession.new(path_or_bytes, **session_options)
end
def predict(input_feed, output_names: nil, **run_options)
predictions = @session.run(output_names, input_feed, **run_options)
output_name... | ruby | MIT | e878f5ad768f687152fab31e69914237bd4aa12e | 2026-01-04T17:35:13.732199Z | false |
defunkt/lyndon | https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon.rb | lib/lyndon.rb | #
# It's pretty much that easy.
#
if !defined?(RUBY_ENGINE) || RUBY_ENGINE != 'macruby'
abort "Lyndon requires MacRuby. http://www.macruby.org/"
end
framework 'WebKit'
require 'lyndon/runtime'
require 'lyndon/coercion'
require 'lyndon/ruby'
require 'lyndon/delegate'
module Lyndon
def self.eval(js)
Runtime.n... | ruby | MIT | a3fa1f69053d2abe0e075f3781d9487d3eb38be6 | 2026-01-04T17:35:58.879303Z | false |
defunkt/lyndon | https://github.com/defunkt/lyndon/blob/a3fa1f69053d2abe0e075f3781d9487d3eb38be6/lib/lyndon/version.rb | lib/lyndon/version.rb | module Lyndon
VERSION = '0.0.1'
class Version
def self.to_s
VERSION
end
end
end
| ruby | MIT | a3fa1f69053d2abe0e075f3781d9487d3eb38be6 | 2026-01-04T17:35:58.879303Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.