repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
murny/jupiter | app/helpers/items/draft_helper.rb | module Items::DraftHelper
def progress_bar_step_class(wizard_step, draft)
if draft.uncompleted_step?(draft.class.wizard_steps, wizard_step)
'disabled'
elsif wizard_step == step
'active'
else
'visted'
end
end
def header
if @draft.is_a? DraftItem
@is_edit ? t('items.draf... |
murny/jupiter | test/services/doi_service_test.rb | require 'test_helper'
class DoiServiceTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
EXAMPLE_DOI = 'doi:10.21967/fk2-jaje-4d53'.freeze
test 'DOI state transitions' do
assert_no_enqueued_jobs
Rails.application.secrets.doi_minting_enabled = true
community = Community.new_locked_ldp_o... |
murny/jupiter | app/models/thesis.rb | class Thesis < JupiterCore::LockedLdpObject
include ObjectProperties
include ItemProperties
include GlobalID::Identification
ldp_object_includes Hydra::Works::WorkBehavior
# Dublin Core attributes
has_attribute :abstract, ::RDF::Vocab::DC.abstract, type: :text, solrize_for: :search
# Note: language is s... |
murny/jupiter | test/controllers/downloads_controller_test.rb | require 'test_helper'
class DownloadsControllerTest < ActionDispatch::IntegrationTest
def before_all
super
community = locked_ldp_fixture(Community, :nice).unlock_and_fetch_ldp_object(&:save!)
collection = locked_ldp_fixture(Collection, :nice).unlock_and_fetch_ldp_object(&:save!)
item = locked_ldp_f... |
murny/jupiter | app/helpers/page_layout_helper.rb | <reponame>murny/jupiter
module PageLayoutHelper
def page_title(title = nil)
# title tags should be around 55 characters, so lets truncate them if they quite long
# With '... | ERA' being appended, we want to aim for a bit smaller like 45 characters
title = truncate(strip_tags(title), length: 45, separator... |
murny/jupiter | test/system/deposit_item_test.rb | <reponame>murny/jupiter
require 'application_system_test_case'
class DepositItemTest < ApplicationSystemTestCase
def before_all
super
# Setup a community/collection pair for respective dropdowns
@community = Community.new_locked_ldp_object(title: 'Books', owner: 1).unlock_and_fetch_ldp_object(&:save!)
... |
PaymentsHubRebels/kafka-boshrelease | spec/jobs/sanitytest_spec.rb | require 'rspec'
require 'json'
require 'yaml' # todo fix bosh-template
require 'bosh/template/test'
describe 'sanitytest job' do
let(:release) { Bosh::Template::Test::ReleaseDir.new(File.join(File.dirname(__FILE__), '../..')) }
let(:job) { release.job('sanitytest') }
describe "config/kafka_discovery/cluster.yam... |
PaymentsHubRebels/kafka-boshrelease | spec/jobs/reassignpartitions_spec.rb | <gh_stars>0
require 'rspec'
require 'json'
require 'yaml' # todo fix bosh-template
require 'bosh/template/test'
describe 'reassignpartitions job' do
let(:release) { Bosh::Template::Test::ReleaseDir.new(File.join(File.dirname(__FILE__), '../..')) }
let(:job) { release.job('reassignpartitions') }
describe "run sc... |
PaymentsHubRebels/kafka-boshrelease | spec/jobs/generatetopics_spec.rb | <reponame>PaymentsHubRebels/kafka-boshrelease
require 'rspec'
require 'json'
require 'yaml' # todo fix bosh-template
require 'bosh/template/test'
describe 'generatetopics job' do
let(:release) { Bosh::Template::Test::ReleaseDir.new(File.join(File.dirname(__FILE__), '../..')) }
let(:job) { release.job('generatetopi... |
skipteel/form_builder | db/schema.rb | # 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.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... |
skipteel/form_builder | config/routes.rb | <reponame>skipteel/form_builder
Rails.application.routes.draw do
resources :forms, :member => { :sort_fields => :post } do |forms|
resources :submissions, :collection => { :thank_you => :get }
end
root :controller => :forms, :action => :index
end
|
skipteel/form_builder | app/models/form_field.rb | <filename>app/models/form_field.rb
class FormField < ActiveRecord::Base
acts_as_list :scope => :form
belongs_to :form
has_many :form_values
end
|
skipteel/form_builder | app/models/notifier.rb | <reponame>skipteel/form_builder
class Notifier < ActionMailer::Base
def form_submission(submission, sent_at = Time.now)
subject "Form Submission: #{submission.form.name}"
recipients submission.form.email
from "<EMAIL>"
sent_on sent_at
body :submission => submission
end
end
|
skipteel/form_builder | app/helpers/submissions_helper.rb | <reponame>skipteel/form_builder<filename>app/helpers/submissions_helper.rb
module SubmissionsHelper
def generate_label_and_form_tag(ff)
html = "<p>"
case ff.object.form_field.tag
when "text_field"
html += "<strong>" + (ff.label :entry, "#{ff.object.form_field.label}:") + "</strong>" + "<br />"
... |
skipteel/form_builder | app/controllers/submissions_controller.rb | class SubmissionsController < ApplicationController
before_filter :find_form
before_filter :find_submission, :only => %w(show edit update destroy)
def index
@submissions = Submission.all
end
def show
end
def new
@submission = @form.submissions.new
@form.form_fields.all.each do |fie... |
skipteel/form_builder | app/models/form.rb | <reponame>skipteel/form_builder
class Form < ActiveRecord::Base
has_many :submissions, :dependent => :destroy
has_many :form_fields,-> { order "position" }, :dependent => :destroy
accepts_nested_attributes_for :form_fields, :allow_destroy => true
scope :published, -> { where(published: true) }
end
|
skipteel/form_builder | db/migrate/20090918234029_create_form_values.rb | class CreateFormValues < ActiveRecord::Migration[5.0]
def self.up
create_table :form_values do |t|
t.integer :submission_id
t.integer :form_field_id
t.string :entry
t.datetime :entry_datetime
t.timestamps
end
end
def self.down
drop_table :form_values
end
end
|
skipteel/form_builder | app/models/form_value.rb | class FormValue < ActiveRecord::Base
belongs_to :form_field
belongs_to :submission
end
|
skipteel/form_builder | app/models/submission.rb | class Submission < ActiveRecord::Base
has_many :form_values, :dependent => :destroy
belongs_to :form
accepts_nested_attributes_for :form_values
validate :required_form_values_are_present?
private
def required_form_values_are_present?
form_values.each do |val|
if val.form_field.re... |
skipteel/form_builder | app/controllers/forms_controller.rb | <filename>app/controllers/forms_controller.rb
class FormsController < ApplicationController
def index
@forms = Form.all
end
def show
@form = Form.find(params[:id])
end
def new
@form = Form.new
@form.form_fields.build
end
def create
binding.pry
@form = Form.new(form_params)
... |
skipteel/form_builder | app/helpers/application_helper.rb | module ApplicationHelper
def remove_child_link(name)
content_tag(:div,"<span>#{name}</span>".html_safe,
:class => "remove_child")
end
def add_child_link(name, association, target)
content_tag(:button,"<span>#{name}</span>".html_safe,
:class => "add_child",
:"data-association" => associa... |
speedy32129/entityid-sequence | lib/entityid/sequence.rb | <filename>lib/entityid/sequence.rb<gh_stars>0
require "entityid/sequence/version"
module Entityid
module Sequence
class Error < StandardError; end
# Your code goes here...
end
end
|
speedy32129/entityid-sequence | test/entityid/sequence_test.rb | <filename>test/entityid/sequence_test.rb
require "test_helper"
class Entityid::SequenceTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Entityid::Sequence::VERSION
end
def test_it_does_something_useful
assert false
end
end
|
speedy32129/entityid-sequence | lib/entityid/sequence/version.rb | <filename>lib/entityid/sequence/version.rb
module Entityid
module Sequence
VERSION = "0.1.0"
end
end
|
abegosum/carhole_minder | button_listener.rb | require 'rpi_gpio'
BUTTON_PIN = 25
RELAY_PIN = 24
LED_PIN = 2
LOOP_DELAY = 0.01
def initialize_gpio
RPi::GPIO.set_numbering :bcm
RPi::GPIO.setup BUTTON_PIN, :as => :input
RPi::GPIO.setup RELAY_PIN, :as => :output
RPi::GPIO.setup LED_PIN, :as => :output
end
def toggle_relay
if RPi::GPIO.high? RELAY_PIN
RPi::GP... |
abegosum/carhole_minder | button_listener_service.rb | require 'rpi_gpio'
require_relative 'constants'
class ButtonListenerService
attr_reader :button_pin
attr_reader :button_name
attr_accessor :long_press_lambda
attr_accessor :long_press_delay
def initialize(button_pin, button_name)
@button_pin = button_pin
@button_name = button_name
@long_press_delay... |
abegosum/carhole_minder | alert_mailer.rb | require_relative 'constants'
require 'net/smtp'
require 'date'
class AlertMailer
def self.send_door_long_opened_alert(timestamp_opened)
time_opened = Time.at(timestamp_opened).to_datetime
message = <<~EOF
Subject: Garage Door Open too Long
Your garage door has been open since #{time_opened.s... |
abegosum/carhole_minder | daemon_start.rb |
require_relative 'carhole_minder'
require_relative 'service_frontend'
require_relative 'constants'
require 'drb/drb'
SERVICE_SAFE = 1
daemon_object = CarholeMinder.new
drb_front_object = ServiceFrontend.new(daemon_object)
DRb.start_service("druby://localhost:#{DRB_PORT}", drb_front_object, { :safe_level => SERVICE... |
abegosum/carhole_minder | service_frontend.rb | require_relative 'carhole_minder'
require_relative 'constants'
class ServiceFrontend
def initialize(carhole_minder)
@carhole_minder = carhole_minder
end
def door_open?
@carhole_minder.door_open?
end
def open_or_close_garage_door
if @carhole_minder.door_open?
result = :closing
else
... |
abegosum/carhole_minder | daemon_control.rb | <filename>daemon_control.rb
$LOAD_PATH.unshift('.')
require 'daemons'
require 'carhole_minder'
Daemons.run('daemon_start.rb')
|
abegosum/carhole_minder | door_open_switch_listener_service.rb | <gh_stars>0
require 'rpi_gpio'
require_relative 'constants'
DOOR_DELAYS = [TIMER_SETTING_1_MINUTES, TIMER_SETTING_2_MINUTES, TIMER_SETTING_3_MINUTES]
class DoorOpenSwitchListenerService
attr_reader :timer_setting
def initialize(timer_setting)
@timer_setting = timer_setting
@door_open_lambdas = []
@d... |
abegosum/carhole_minder | carhole_minder.rb | <reponame>abegosum/carhole_minder<gh_stars>0
require_relative 'constants'
require_relative 'button_listener_service'
require_relative 'door_open_switch_listener_service'
require_relative 'alert_mailer'
TIMER_PINS = [ TIMER_SETTING_1_LED, TIMER_SETTING_2_LED, TIMER_SETTING_3_LED ]
class CarholeMinder
attr_reader ... |
shoji-k/useful | serverspec/spec/newdev/sample_spec.rb | require 'spec_helper'
describe package('httpd'), :if => os[:family] == 'redhat' do
it { should be_installed }
end
describe package('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
describe service('httpd'), :if => os[:family] == 'redhat' do
it { should be_enabled }
it { should be_... |
FPhillips27/lojong | spec/controllers/lojong_saying_controller_spec.rb | require 'spec_helper'
require 'rails_helper'
RSpec.describe LojongSayingsController, :type => :controller do
describe "GET #index" do
it "should be successful" do
get :index
response.should be_successful
end
end
end
|
FPhillips27/lojong | db/migrate/20160514222716_create_lojong_sayings.rb | <filename>db/migrate/20160514222716_create_lojong_sayings.rb
class CreateLojongSayings < ActiveRecord::Migration[4.2]
def change
create_table :lojong_sayings do |t|
t.string :content
t.string :number
t.timestamps null: false
end
end
end
|
FPhillips27/lojong | app/controllers/lojong_sayings_controller.rb | class LojongSayingsController < ApplicationController
#GET
def index
@lojong_sayings = LojongSaying.randomSaying
end
#GET
def show
end
#GET
def new
end
#GET
def edit
end
#POST
def create
end
#PUT
def update
end
... |
FPhillips27/lojong | spec/requests/navigation_spec.rb | require "rails_helper"
require "spec_helper"
RSpec.describe "Navbar Link", :type => :request do
it "takes to the user to the About page when they click ABOUT" do
visit "#index"
click_on("ABOUT")
current_path.should == "/about"
end
it "takes to the user to the Slogans page when they click SLOGANS" ... |
FPhillips27/lojong | app/controllers/about_controller.rb | <filename>app/controllers/about_controller.rb
class AboutController < ApplicationController
def show
end
end
|
FPhillips27/lojong | features/step_definitions/lojong_steps.rb | Given(/^that I am on the Lojong Slogans page$/) do
visit('/lojong_sayings')
end
Given(/^that I am on the about page$/) do
visit('/about')
end
Then(/^I will see the number of a Lojong saying$/) do
find("p.number")
end
Then(/^I will see the text of a Lojong saying$/) do
page.has_css?('.content')
end
T... |
FPhillips27/lojong | app/models/lojong_saying.rb | <filename>app/models/lojong_saying.rb
class LojongSaying < ActiveRecord::Base
scope :recent, lambda { order('created_at DESC').limit(10) }
scope :randomSaying, lambda { order('id DESC').sample(1).shuffle }
end
|
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/utils/recommendation_util.rb | module DomoscioRails
class RecommendationUtil < Resource
include DomoscioRails::HTTPCalls::Util
end
end |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails.rb |
require 'net/https'
require 'cgi/util'
require 'multi_json'
# helpers
require 'domoscio_rails/version'
require 'domoscio_rails/json'
require 'domoscio_rails/errors'
require 'domoscio_rails/authorization_token'
# resources
require 'domoscio_rails/http_calls'
require 'domoscio_rails/resource'
require 'domoscio_rails/dat... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/version.rb | module DomoscioRails
VERSION = "0.3.8a"
end |
Celumproject/domoscio_rails_v2 | spec/spec_helper.rb | require_relative '../lib/domoscio_rails'
require_relative './lib/domoscio_rails/shared_resources'
require 'fileutils'
require 'pp'
require 'active_support/all'
def reset_domoscio_rails_configuration
DomoscioRails.configure do |c|
c.client_id = 14
c.client_passphrase = '<PASSWORD>'#
c.temp_dir = File.exp... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/http_calls.rb | <reponame>Celumproject/domoscio_rails_v2<filename>lib/domoscio_rails/http_calls.rb
module DomoscioRails
module HTTPCalls
module Create
module ClassMethods
def create(*id, params)
id = id.empty? ? nil : id[0]
DomoscioRails.request(:post, url(id), params)
end
end
... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/objective/objective_knowledge_node_student.rb | <filename>lib/domoscio_rails/objective/objective_knowledge_node_student.rb
module DomoscioRails
class ObjectiveKnowledgeNodeStudent < Resource
include DomoscioRails::HTTPCalls::Create
include DomoscioRails::HTTPCalls::Fetch
include DomoscioRails::HTTPCalls::Destroy
include DomoscioRails::HTTPCalls::U... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/data/learning_session.rb | <filename>lib/domoscio_rails/data/learning_session.rb
module DomoscioRails
class LearningSession < Resource
include DomoscioRails::HTTPCalls::Create
include DomoscioRails::HTTPCalls::Fetch
include DomoscioRails::HTTPCalls::Destroy
include DomoscioRails::HTTPCalls::Update
include DomoscioRails::HT... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/data/recommendation.rb | <reponame>Celumproject/domoscio_rails_v2<filename>lib/domoscio_rails/data/recommendation.rb
module DomoscioRails
class Recommendation < Resource
include DomoscioRails::HTTPCalls::Fetch
end
end |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/data/instance.rb | <filename>lib/domoscio_rails/data/instance.rb<gh_stars>1-10
module DomoscioRails
class Instance < Resource
include DomoscioRails::HTTPCalls::Create
include DomoscioRails::HTTPCalls::Fetch
include DomoscioRails::HTTPCalls::UpdateSelf
include DomoscioRails::HTTPCalls::Destroy
end
end
|
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/errors.rb | module DomoscioRails
# Generic error superclass for MangoPay specific errors.
class Error < StandardError
end
# Error Message from AdaptiveEngine
class ResponseError < Error
attr_reader :request_url, :code, :details, :body, :request_params
def initialize(request_url, code, details = {}, body = nil, r... |
Celumproject/domoscio_rails_v2 | lib/domoscio_rails/utils/gameplay_util.rb | module DomoscioRails
class GameplayUtil < Resource
include DomoscioRails::HTTPCalls::Util
end
end |
xattacker/RxRequiredPropertyChecker | RxRequiredPropertyChecker.podspec | Pod::Spec.new do |s|
s.name = 'RxRequiredPropertyChecker'
s.version = '1.0.11'
s.license = 'MIT'
s.summary = 'a RxSwift Related component'
s.homepage = 'https://github.com/xattacker/RxRequiredPropertyChecker'
s.authors = { 'Xattacker' => '<EMAIL>' }
s.source = { :git => 'https://github.com/xattacker/RxReq... |
khaled/mongoid_acts_as_tree | test/models/ordered_category.rb | <gh_stars>0
require "mongoid"
require "mongoid/acts_as_tree"
class OrderedCategory
include Mongoid::Document
include Mongoid::Acts::Tree
field :name, :type => String
field :value, :type => Integer
acts_as_tree :order => [['value', 'asc']]
end
|
khaled/mongoid_acts_as_tree | test/models/category.rb | <gh_stars>0
require "mongoid"
require "mongoid/acts_as_tree"
class Category
include Mongoid::Document
include Mongoid::Acts::Tree
field :name, :type => String
acts_as_tree
end
|
khaled/mongoid_acts_as_tree | test/test_order.rb | require 'helper'
require 'set'
class TestMongoidActsAsTree < Test::Unit::TestCase
context "Ordered tree" do
setup do
@root_1 = OrderedCategory.create(:name => "Root 1", :value => 2)
@child_1 = OrderedCategory.create(:name => "Child 1", :value => 1)
@child_2 = OrderedCategory.create(:n... |
khaled/mongoid_acts_as_tree | test/models/sub_category_2.rb | class SubCategory2 < SubCategory
end
|
khaled/mongoid_acts_as_tree | test/helper.rb | <reponame>khaled/mongoid_acts_as_tree
require 'rubygems'
require 'test/unit'
require 'shoulda'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'mongoid'
Mongoid.load!(File.join(File.dirname(__FILE__), "mongoid.yml"), :test)
Dir["#{File.dirname(__F... |
khaled/mongoid_acts_as_tree | lib/mongoid/acts_as_tree.rb | require "mongoid"
require "mongoid/acts/tree/fields"
require "mongoid/acts/tree/children"
module Mongoid
module Acts
module Tree
def self.included(model)
model.class_eval do
extend InitializerMethods
end
end
module InitializerMethods
def acts_as_tree(options = {})
options = {
:... |
khaled/mongoid_acts_as_tree | test/test_children.rb | <filename>test/test_children.rb
require 'helper'
require 'set'
class TestMongoidActsAsTree < Test::Unit::TestCase
context "Create Children Criteria" do
setup do
@category = Category.create(:name => "Root 2")
@children = Mongoid::Acts::Tree::Children.new(@category, Category)
end
should "have initialized ... |
khaled/mongoid_acts_as_tree | lib/mongoid/acts/tree/fields.rb | module Mongoid
module Acts
module Tree
module Fields
def parent_id_field
acts_as_tree_options[:parent_id_field]
end
def path_field
acts_as_tree_options[:path_field]
end
def depth_field
acts_as_tree_options[:depth_field]
end
def tree_order
acts_as_tree_options... |
khaled/mongoid_acts_as_tree | lib/mongoid/acts/tree/children.rb | module Mongoid
module Acts
module Tree
class Children < Mongoid::Criteria
def initialize(owner, tree_base_class)
@parent = owner
@tree_base_class = tree_base_class
super(tree_base_class)
other = self.merge!(tree_base_class.where(@parent.parent_id_field => @parent.id).order_by(@parent.tr... |
khaled/mongoid_acts_as_tree | test/test_tree.rb | require 'helper'
require 'set'
$verbose = false
class TestMongoidActsAsTree < Test::Unit::TestCase
context "Tree" do
setup do
@root_1 = Category.create(:name => "Root 1")
@child_1 = Category.create(:name => "Child 1")
@child_2 = Category.create(:name => "Child 2")
@child_2_1 = SubCategory.cre... |
khaled/mongoid_acts_as_tree | test/models/sub_category.rb | class SubCategory < Category
end
|
EdCordata-Ruby-Gems/breadcrumbs_rails | breadcrumbs_rails.gemspec | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'breadcrumbs_rails/version'
Gem::Specification.new do |spec|
spec.name = 'breadcrumbs_rails'
spec.version = BreadcrumbsRails::VERSION
spec.authors = %w(EdCordata... |
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/breadcrumbs_rails/breadcrumb.rb | <filename>lib/breadcrumbs_rails/breadcrumb.rb
module BreadcrumbsRails
class Breadcrumb
attr_accessor :name, :name_string,
:path, :path_string,
:localize, :locale
def initialize(name_string: nil, path_string: nil, localize: nil, locale: nil)
@locale = ... |
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/generators/breadcrumbs/config_generator.rb | module Breadcrumbs
module Generators
class ConfigGenerator < Rails::Generators::Base
source_root ::File.expand_path(::File.join(::File.dirname(__FILE__), 'templates/config/initializers'))
def copy_config_file
template 'breadcrumbs_config.rb', 'config/initializers/breadcrumbs.rb'
end
... |
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/generators/breadcrumbs/views_generator.rb | module Breadcrumbs
module Generators
class ViewsGenerator < ::Rails::Generators::NamedBase
source_root ::File.expand_path(::File.join(::File.dirname(__FILE__), 'templates/app/views/breadcrumbs'))
desc 'Template engine for the views. Available options are "erb", "haml".'
class_option :format, ty... |
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/breadcrumbs_rails.rb | require 'breadcrumbs_rails/version'
require 'breadcrumbs_rails/railtie'
require 'breadcrumbs_rails/breadcrumb'
require 'breadcrumbs_rails/breadcrumbs'
module BreadcrumbsRails
extend ActiveSupport::Concern
# ----------------------------------------------------------
included do |base|
unless base.respond_... |
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/generators/breadcrumbs/templates/config/initializers/breadcrumbs_config.rb | <filename>lib/generators/breadcrumbs/templates/config/initializers/breadcrumbs_config.rb
# breadcrumbs config coming soon
|
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/breadcrumbs_rails/railtie.rb | module BreadcrumbsRails
class Railtie < Rails::Railtie
ActiveSupport.on_load(:action_controller) do
views_path = "#{File.dirname(__FILE__)}/../generators/breadcrumbs/templates/app/views"
::ActionController::Base.append_view_path(views_path)
end
end
end
|
EdCordata-Ruby-Gems/breadcrumbs_rails | lib/breadcrumbs_rails/breadcrumbs.rb | <reponame>EdCordata-Ruby-Gems/breadcrumbs_rails
module BreadcrumbsRails
class Breadcrumbs
attr_accessor :breadcrumbs,
:scope, :format,
:title, :title_string,
:localize, :locale
def initialize(breadcrumbs: [], title_string: nil, scope: nil, format: ... |
shurunxuan/vgm_ripping | demux/voxhound/voxhound.rb | puts 'voxhound 0.3 by hcs'
def valid_frame?(frame, idx)
# TODO: generally we have expectations and it would
# be nice to check them:
# 4 at the beginning of mono from MFAudio
# 6 at the beginning of stereo from MFAudio
# 7 at the end of a stream from MFAudio (after usable data)
# 2 in the original ... |
shurunxuan/vgm_ripping | etc/ddwlg/ddwlg00.rb | require "chunky_png"
fn = ARGV[0]
exit unless fn
File.open(fn, mode='rb') do |f|
puts fn
width = ARGV[1].to_i
raise 'bad width' if width == 0
magic, unk1, subfiles = (f.read(16).unpack('a8 L<2'))
raise 'Missing DDWLG00' unless magic == "DDWLG00\x00"
puts "#{subfiles} images"
start = ... |
shurunxuan/vgm_ripping | soundbank/lara/lara.rb | for fn in ARGV do
File.open(fn, mode='rb') do |f|
print fn, ': '
magic, data_size, six, zero1, id, neg1, sample_rate, zero2, zero3 =
f.read(0x24).unpack('a4 L<4 l< L<3')
raise 'Missing SECT' unless magic == 'SECT'
raise 'unknown values differ' unless
six == 6 and zero1 == 0 and ... |
thaniyarasu/sysenv | lib/sysenv.rb | <filename>lib/sysenv.rb
require 'sysenv/sysenv'
|
thaniyarasu/sysenv | test/test_sysenv.rb | require 'minitest/autorun'
require 'active_support'
require 'sysenv'
class SysenvTest < Minitest::Test
def setup
ENV["API_SECRET_KEY"] = "API_SECRET_VALUE" # system defined environment variables
@env = {api:{secret:{key: 'value',cert:'certificate'}}} # app defined environment variables
@sysenv = Sysen... |
thaniyarasu/sysenv | sysenv.gemspec | <reponame>thaniyarasu/sysenv
Gem::Specification.new do |s|
s.name = 'sysenv'
s.version = '0.0.1'
s.date = '2015-02-20'
s.summary = "Sysenv ! will load app envs and override with system envs"
s.description = <<-STRING
In Most Rails Application config/envs.yml file will be there , some
... |
thaniyarasu/sysenv | lib/sysenv/sysenv.rb | <reponame>thaniyarasu/sysenv
require "active_support"
class Sysenv
# Override Project Specific Environment variables with system specific
#
# Example:
# >> sysenv = Sysenv.new
# >> sysenv.parse({api:{secret:{key: 'value',cert:'certificate'}}})
# => {api:{secret:{key: 'value',cert:'certificate'}}}
... |
rafasoares/newrelic-perfmon-plugin | perfmon_metrics.rb | class PerfmonMetrics
attr_accessor :metric_types, :metric_samples, :typeperf_error_msg, :thread_count
def initialize
@metric_samples = 1
@typeperf_error_msg = "Error: No valid counters."
@thread_count = 5
@metric_types = Hash.new("ms")
@metric_types["% 401 HTTP Response Sent"] = "%"
@metri... |
rafasoares/newrelic-perfmon-plugin | perfmon_plugin_multithread.rb | #!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "newrelic_plugin"
require_relative "perfmon_metrics.rb"
# Fixes SSL cert without monkeying with PEM file!
require "certified"
module PerfmonAgent
class Agent < NewRelic::Plugin::Agent::Base
agent_config_options :local, :hostname, :debug, :te... |
AliShahbaj/alispec | test/test_helper.rb | <filename>test/test_helper.rb<gh_stars>0
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "alispec"
require "minitest/autorun"
|
AliShahbaj/alispec | lib/alispec.rb | require "alispec/version"
module Alispec
# Your code goes here...
end
|
PTC-Global/sensu-plugins-dcos | bin/metrics-dcos-system-health.rb | #! /usr/bin/env ruby
# frozen_string_literal: true
#
# metric-dcos-system-health
#
# DESCRIPTION:
# This plugin collects DC/OS system health status as metric exposed by the system/health/v1/[units|nodes] API endpoints
#
# OUTPUT:
# Metric data
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# ... |
PTC-Global/sensu-plugins-dcos | bin/check-dcos-ping.rb | <gh_stars>1-10
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# check-dcos-ping
#
# DESCRIPTION:
# This plugin checks the status of a DCOS host using the /ping entrypoint from the dcos-metrics API
#
# OUTPUT:
# Plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
#
# USAGE:
# Th... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/check-dcos-node-health-shared_spec.rb | <filename>test/integration/helpers/serverspec/check-dcos-node-health-shared_spec.rb<gh_stars>1-10
# frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-node-health.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_beha... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/metric-dcos-system-health-shared_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'metrics-dcos-system-health.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe command("#{check} -s dcos.health -u http://localho... |
PTC-Global/sensu-plugins-dcos | lib/sensu-plugins-dcos/common.rb | <reponame>PTC-Global/sensu-plugins-dcos<filename>lib/sensu-plugins-dcos/common.rb
# frozen_string_literal: true
# LICENCE:
# PTC http://www.ptc.com/
# Copyright 2017 PTC Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/check-dcos-component-health-shared_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-component-health.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe command("#{check} -u http://localhost/system/heal... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/check-dcos-ping-shared_spec.rb | <reponame>PTC-Global/sensu-plugins-dcos<gh_stars>1-10
# frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-ping.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe file(ch... |
PTC-Global/sensu-plugins-dcos | bin/check-dcos-container-metrics.rb | <reponame>PTC-Global/sensu-plugins-dcos
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# check-dcos-metrics
#
# DESCRIPTION:
# This plugin checks the value of a metric exposed by the dcos-metrics API across all running containers
#
# OUTPUT:
# Plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/check-dcos-container-metrics-shared_spec.rb | <gh_stars>1-10
# frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-container-metrics.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe file(check) do
it { should be_f... |
PTC-Global/sensu-plugins-dcos | lib/sensu-plugins-dcos.rb | <gh_stars>1-10
# frozen_string_literal: true
require 'sensu-plugins-dcos/version'
require 'sensu-plugins-dcos/common'
|
PTC-Global/sensu-plugins-dcos | bin/metrics-dcos-host.rb | <filename>bin/metrics-dcos-host.rb
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# dcos-metrics
#
# DESCRIPTION:
# This plugin extracts the metrics from a dcos server
#
# OUTPUT:
# metric data
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: uri
# gem: net/http
# gem: socket
... |
PTC-Global/sensu-plugins-dcos | test/integration/helpers/serverspec/check-dcos-metrics-shared_spec.rb | <reponame>PTC-Global/sensu-plugins-dcos
# frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-metrics.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe file(check) do
i... |
PTC-Global/sensu-plugins-dcos | bin/check-dcos-jobs-health.rb | #! /usr/bin/env ruby
# frozen_string_literal: true
#
# check-dcos-jobs-health
#
# DESCRIPTION:
# This plugin checks the health of a DC/OS jobs exposed by the mesos API endpoint /tasks
#
# OUTPUT:
# Plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
#
# USAGE:
# check-dcos-jobs-healt... |
PTC-Global/sensu-plugins-dcos | bin/metrics-dcos-containers.rb | <reponame>PTC-Global/sensu-plugins-dcos
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# dcos-metrics
#
# DESCRIPTION:
# This plugin extracts the container metrics from a dcos server
#
# OUTPUT:
# metric data
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: uri
# gem: net/http
#... |
PTC-Global/sensu-plugins-dcos | bin/check-dcos-container-count.rb | #! /usr/bin/env ruby
# frozen_string_literal: true
#
# check-dcos-metrics
#
# DESCRIPTION:
# This plugin checks the number of containers exposed by the dcos-metrics API
#
# OUTPUT:
# Plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
#
# USAGE:
# This example checks that the count o... |
PTC-Global/sensu-plugins-dcos | bin/check-dcos-component-health.rb | <reponame>PTC-Global/sensu-plugins-dcos<filename>bin/check-dcos-component-health.rb
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# check-dcos-component-health
#
# DESCRIPTION:
# This plugin checks the health of a DC/OS components exposed by the system/health/v1/units API endpoint
#
# OUTPUT:
# Plain text... |
dinesh/mongo-memcached | test/test_mongo-memcached.rb | <gh_stars>1-10
require 'helper'
require 'db'
class TestMongoMemcached < Test::Unit::TestCase
context "Testing memcached connection" do
setup do
$config = YAML.load(IO.read(File.join(File.dirname(__FILE__), '/../config/memcache.yml')))['test']
$cache = Memcached.new( Array($config['servers']) )
... |
dinesh/mongo-memcached | lib/mongo_memcached/membase.rb | <filename>lib/mongo_memcached/membase.rb
module MongoMemcached
module Membase
def self.included base
class << base
attr_accessor :repository
delegate :repository, :to => "self.class"
end
end
def fetch(keys, options = {}, &block)
case keys
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.