repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
deivid-rodriguez/activeadmin_addons | activeadmin_addons.gemspec | # rubocop:disable Metrics/LineLength
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "activeadmin_addons/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "activeadmin_addons"
s.version = ActiveadminAddons::VERSION
s.... |
nikukyugamer/character-recognition-by-vision-api | lib/character_recognition_by_vision_api.rb | require "character_recognition_by_vision_api/version"
require 'rest-client'
require 'base64'
require 'json'
module CharacterRecognitionByVisionApi
extend self
def extract_to_text(image_file, api_key)
JSON.parse(response_json(image_file, api_key))['responses'][0]['fullTextAnnotation']['text']
end
def payl... |
nikukyugamer/character-recognition-by-vision-api | spec/character_recognition_by_vision_api_spec.rb | RSpec.describe CharacterRecognitionByVisionApi do
it "has a version number" do
expect(CharacterRecognitionByVisionApi::VERSION).not_to be nil
end
before do
@image_file = 'spec/sample_image.png'
end
it 'the return value is correct headers' do
expect(CharacterRecognitionByVisionApi.headers_for_pos... |
JimmyLTS/JLLayoutConstraint | JLLayoutConstraint.podspec | <filename>JLLayoutConstraint.podspec
Pod::Spec.new do |s|
s.name = "JLLayoutConstraint"
s.version = "0.0.2"
s.summary = "A until for layout constraint"
s.description = <<-DESC
It is a until to add layout constraint.
DESC
s.homepage = "https://git... |
machine23/cobalt2-vim-theme | test_files/test.rb | require "gem"
string = "base16"
symbol = :base16
fixnum = 0
float = 0.00
array = Array.new
array = ['chris', 85]
hash = {"test" => "test"}
regexp = /^\b1?[-.\s]?(\d{3})|([A-z])[-.\s]?\d{3}[-.\s]?\d{4}\?\b$/
# TODO This is a comment
module Earth
class Person < Creature
attr_accessor :name
def initializ... |
jgarcia/recommendify | lib/recommendify/base.rb | class Recommendify::Base
attr_reader :similarity_matrix, :input_matrices, :max_neighbors
def initialize(input_matrices = nil, opts = {})
@max_neighbors = opts[:max_neighbors] || Recommendify::DEFAULT_MAX_NEIGHBORS
@input_matrices = if input_matrices
Hash[input_matrices.map{ |key, opts|
opts... |
bogdanmatasaru/Keychain.swift | Simple-KeychainSwift.podspec | #
# Be sure to run `pod lib lint Simple-KeychainSwift.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = ... |
qiniu/ruby-sdk | lib/qiniu/resumable_upload.rb | # -*- encoding: utf-8 -*-
require 'zlib'
require 'yaml'
require 'tmpdir'
require 'fileutils'
require 'mime/types'
require 'digest/sha1'
require 'qiniu/abstract'
require 'qiniu/exceptions'
require 'json'
module Qiniu
module Storage
module AbstractClass
class ChunkProgressNotifier
include Q... |
qiniu/ruby-sdk | lib/qiniu/host_manager.rb | require 'thread'
require 'cgi'
module Qiniu
# @deprecated
class BucketIsMissing < RuntimeError; end
class HostManager
def initialize(config)
@config = config
@mutex = Mutex.new
@hosts = {}
end
def up_host(bucket, opts = {})
if !multi_region_support?
"#{extract_protoc... |
qiniu/ruby-sdk | lib/qiniu/upload.rb | <filename>lib/qiniu/upload.rb<gh_stars>100-1000
# -*- encoding: utf-8 -*-
# vim: sw=2 ts=2
require 'stringio'
module Qiniu
module Storage
class << self
include Utils
def upload_with_token(uptoken,
local_file,
bucket,
... |
qiniu/ruby-sdk | spec/qiniu/pfop_spec.rb | <reponame>qiniu/ruby-sdk
# -*- encoding: utf-8 -*-
# vim: sw=2 ts=2
require 'spec_helper'
require 'qiniu/auth'
require 'qiniu'
require 'qiniu/fop'
module Qiniu
module Fop
module Persistance
describe Persistance do
before :all do
@bucket = 'rubysdk'
pic_fname = "image_logo_for... |
qiniu/ruby-sdk | spec/qiniu/auth_spec.rb | # -*- encoding: utf-8 -*-
# vim: sw=2 ts=2
require 'spec_helper'
require 'qiniu/auth'
require 'qiniu/config'
require 'qiniu/storage'
require 'digest/sha1'
module Qiniu
module Auth
describe Auth do
before :all do
@bucket = 'rubysdk'
end
after :all do
end
### 测试私有资源下载
... |
sous-chefs/nano | test/fixtures/cookbooks/test/recipes/default.rb | nano_install 'nano' do
end
colour = {}
options = {}
colour['yellow'] = '\\<(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\>'
options['header'] = '"^#!.*/(env ... |
sous-chefs/nano | resources/config.rb | unified_mode true
property :syntax_name, String, name_property: true
property :filename_regex, String, required: true
property :colour, Hash, default: {}
property :options, Hash, default: {}
property :config_directory, String, default: '/etc/nanorc.d'
property :config_file, String, default: '/... |
sous-chefs/nano | test/integration/default/default_spec.rb | describe file('/etc/nanorc') do
it { should be_a_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('content') { should match(%r{include /etc/nanorc.d/ruby.nanorc}) }
end
describe file('/etc/nanorc.d') do
it { should be_a_directory }
it { should be_owned_by 'root' }
it { sho... |
sous-chefs/nano | resources/install.rb | unified_mode true
property :package_name, String, name_property: true
action :install do
package new_resource.package_name do
action :install
end
end
action :remove do
package new_resource.package_name do
action :remove
end
end
|
sous-chefs/nano | metadata.rb | <filename>metadata.rb
name 'nano'
maintainer '<NAME>'
maintainer_email '<EMAIL>'
license 'Apache-2.0'
description 'Installs and configures nano'
version '3.0.0'
source_url 'https://github.com/sous-chefs/nano'
issues_url 'https://github.com/sous-chefs/nano/iss... |
nWoKcir33/programming-univbasics-3-labs-with-tdd-online-web-prework | calculator.rb | # Add your variables here
first_number = 1
second_number = 2
sum = 3
difference = -1
product = 2
quotient = 0.5 |
everydayhero/money | lib/money/version.rb | <reponame>everydayhero/money
class Money
VERSION = "6.1.0.beta1"
end
|
lisk-builders/lisk.rb | lib/lisk/api.rb | require "time"
# The Lisk API Ruby wrapper gem.
module Lisk
# Helper functions to wrap raw legacy APIs into meaningul methods.
class API < Legacy
# Returns true if chain is syncing.
def is_syncing?
synced = self.loader_status_sync
if synced["success"]
return synced["syncing"]
el... |
lisk-builders/lisk.rb | examples/legacy_api.rb | #!/usr/bin/env ruby
require 'lisk'
# Try to connect a local Lisk client on test network.
# Warning: Think twice and test thoroughly before enabling this on main network!
client = Lisk::Client.new "127.0.0.1", 7000
legacy_api = Lisk::Legacy.new client
# Test data
_user = "4fryn_lorem_ipsum_42"
_secret = "lorem ipsum ... |
lisk-builders/lisk.rb | examples/status.rb | #!/usr/bin/env ruby
require 'lisk'
# Try to connect a local Lisk client.
node = Lisk::Client.new
# Configure host and port of the Lisk client.
node = node.configure "127.0.0.1", 7000
# Same as above, just in one line, let's stick to test network for now.
node = Lisk::Client.new "127.0.0.1", 7000
# Lisk tools wraps... |
lisk-builders/lisk.rb | lib/lisk/legacy.rb | # The Lisk API Ruby wrapper gem.
module Lisk
# Implements raw legacy APIs of the Lisk Core pre-1.0.0 node.
class Legacy
# A "lisk/client" connecting to a Lisk Core API node.
attr_accessor :client
# Initializing the legacy API with a legacy Lisk Core API client.
def initialize client
if not ... |
lisk-builders/lisk.rb | lib/lisk/delegate.rb | module Lisk
class Delegate
attr_accessor :api
attr_accessor :delegate_name
attr_accessor :address
attr_accessor :public_key
attr_accessor :secret
attr_accessor :secret_secondary
attr_accessor :registered
def initialize api, delegate_name
@api = api
@delegate_name = deleg... |
lisk-builders/lisk.rb | lib/lisk/raw.rb | <reponame>lisk-builders/lisk.rb
# The Lisk API Ruby wrapper gem.
module Lisk
# Implements raw APIs of the Lisk Core node.
class Raw
# A "lisk/client" connecting to a Lisk Core API node.
attr_accessor :client
# Initializing the API with a Lisk Core API client.
def initialize client
if not cl... |
lisk-builders/lisk.rb | examples/delegates.rb | <gh_stars>1-10
#!/usr/bin/env ruby
require 'lisk'
node = Lisk::Client.new
api = Lisk::API.new node
delegate = Lisk::Delegate.new api, "4fryn"
p delegate.is_registered?
delegate = Lisk::Delegate.new api, "not_4fryn"
p delegate.is_registered?
delegate.set_secrets "lorem ipsum foo bar", "foo bar lorem ipsum"... |
lisk-builders/lisk.rb | lib/lisk/client.rb | require "net/http"
require "uri"
require "json"
# The Lisk API Ruby wrapper gem.
module Lisk
# A simple HTTP client connecting to a Lisk Core API node.
class Client
# Host and port of the API endpoint.
attr_accessor :host, :port, :ssl, :active
# Initializes the Lisk HTTP client and defaults to local... |
lisk-builders/lisk.rb | examples/lsk-shorty.rb | #!/bin/env ruby
require "lisk"
require "bip_mnemonic"
require "securerandom"
@counter = 0
@node = Lisk::Client.new "127.0.0.1", 7000
@lisk = Lisk::API.new @node
@start = Time.now.to_i.to_f
def runner id
target = 18
while true
@counter += 1
entropy = SecureRandom.hex
phrase = BipMnemonic.to_mnemonic(entropy: ... |
lisk-builders/lisk.rb | lisk.gemspec | <reponame>lisk-builders/lisk.rb<filename>lisk.gemspec
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "lisk/version"
Gem::Specification.new do |lisk|
lisk.name = "lisk"
lisk.version = Lisk::VERSION
lisk.authors = ["<N... |
lisk-builders/lisk.rb | examples/payout.rb | #!/usr/bin/env ruby
require 'lisk'
# Try to connect a local Lisk client on test network.
# Warning: Think twice and test thoroughly before enabling this on main network!
client = Lisk::Client.new "127.0.0.1", 7000
# The pre-1.0.0 legacy API connected to the client.
legacy_api = Lisk::Legacy.new client
# Only procee... |
lisk-builders/lisk.rb | lib/lisk.rb | <filename>lib/lisk.rb
require "lisk/version"
require "todonotes"
# The Lisk API Ruby wrapper gem.
module Lisk
require "lisk/client"
require "lisk/legacy"
require "lisk/raw"
require "lisk/api"
require "lisk/delegate"
# Handles unimplemented methods
def method_missing name, *args, &block
todo "#{self}... |
jibberia/rediscluster | lib/crc16.rb | # Copyright (C) 2013 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# ... |
jibberia/rediscluster | lib/rediscluster.rb | <gh_stars>0
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge,... |
danhixon/rails-brochure | app/controllers/home_controller.rb | <filename>app/controllers/home_controller.rb
class HomeController < ApplicationController
def four_zero_four
render 'four_zero_four', :status=>404
end
end
|
danhixon/rails-brochure | lib/rails-brochure.rb | <reponame>danhixon/rails-brochure
require File.expand_path(File.dirname(__FILE__)) + '/rails-brochure/home_content'
require File.expand_path(File.dirname(__FILE__)) + '/rails-brochure/route_reloader'
require File.expand_path(File.dirname(__FILE__)) + '/rails-brochure/engine'
|
danhixon/rails-brochure | config/routes.rb | <reponame>danhixon/rails-brochure
Rails.application.routes.draw do
Rails::Brochure::HomeContent.templates.each do |pg|
get "/#{pg}" => "home##{pg}", :as => pg.gsub(/(\/|-)/,'_').to_sym
end
get '*a', :to => 'home#four_zero_four' unless defined?(NONBROCHURE404) && Rails.application.config.consider_all_requests_... |
danhixon/rails-brochure | rails-brochure.gemspec | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rails-brochure/version"
Gem::Specification.new do |s|
s.name = "rails-brochure"
s.version = Rails::Brochure::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["<NAME>"]
s.email = ["<EMAIL>"]
s.homepa... |
danhixon/rails-brochure | lib/rails-brochure/engine.rb | <gh_stars>1-10
# Engine injects some middleware to reload
# routes if new files habe been added
module Rails
module Brochure
class Engine < Rails::Engine
initializer "brochure routes" do |app|
app.middleware.use "Rails::Brochure::RouteReloader"
end if Rails.env.development?
end
end
en... |
paul/uri_template | spec/spec_helper.rb | <reponame>paul/uri_template
require File.expand_path(File.dirname(__FILE__) + "/../lib/uri_template")
|
paul/uri_template | spec/examples_from_draft_spec.rb | <filename>spec/examples_from_draft_spec.rb
require 'spec_helper'
# These examples are take directly from the draft spec
# http://tools.ietf.org/html/draft-gregorio-uritemplate-07
describe "Examples given in the Draft" do
let(:params) do
{
"dom" => "example.com",
"dub" => "me/too",
... |
paul/uri_template | lib/uri_template.rb | <filename>lib/uri_template.rb
require 'addressable/uri'
__dir__ = File.dirname(__FILE__)
require __dir__ + "/uri_template/version"
require __dir__ + "/uri_template/parser"
require __dir__ + "/uri_template/transformer"
class UriTemplate
class ParseError < StandardError; end
def initialize(uri_template)
@uri_t... |
paul/uri_template | spec/errors_spec.rb | <filename>spec/errors_spec.rb<gh_stars>1-10
require 'spec_helper'
describe UriTemplate do
describe "with good uris" do
good = [
"{var}",
"http://example.com/",
"http://example.com/{foo}",
"http://example.com/search{?q}",
"http://example.com/search{?q,list}"
]
good.each do... |
paul/uri_template | lib/uri_template/parser.rb | <gh_stars>1-10
require 'parslet'
class UriTemplate
class Parser < Parslet::Parser
rule(:uri_template) do
(literals | expression).repeat
end
rule(:expression) do
str('{') >> operator.maybe.as(:operator) >> var_list.as(:var_list) >> str('}')
end
rule(:operator) do
str("+") | st... |
paul/uri_template | spec/params_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe UriTemplate do
describe "params" do
let(:template) { UriTemplate.new("{foo}") }
it "should handle string keys" do
template.expand("foo" => "bar").should == "bar"
end
it "should handle symbol keys" do
template.expand(:foo => "bar").should =... |
paul/uri_template | lib/uri_template/transformer.rb | require 'parslet'
class UriTemplate
class Transformer < Parslet::Transform
rule(:literals => simple(:l)) { l.to_s }
rule(:string => simple(:s)) { s.to_s }
rule(:array => subtree(:ar)) { ar.is_a?(Array) ? ar : [ar] }
rule(:explode) { true }
#rule(:name => simple(:name)) { name.to_s }
... |
Anthonyntilelli/Number_guessing | lib/challenge_number.rb | <reponame>Anthonyntilelli/Number_guessing<filename>lib/challenge_number.rb
################################################################################
#: Title : ChallengeNumber
#: Author : <NAME>
#: Description : Generates random number for user ot guess
#: Main Methods :
#: #guess - returns if... |
Anthonyntilelli/Number_guessing | number_guessing.rb | <reponame>Anthonyntilelli/Number_guessing<gh_stars>1-10
#!/usr/bin/env ruby
################################################################################
#: Title : Number_guessing
#: Author : <NAME>
#: Description : Commandline game where user guesss a hidden number within a
#: : range. Game ... |
Anthonyntilelli/Number_guessing | spec/challenge_number_spec.rb | require_relative '../lib/challenge_number.rb'
RSpec.describe 'ChallengeNumber ' do
describe '#initialize' do
context 'when initialize' do
subject(:valid) { ChallengeNumber.new(0, 100) }
it 'create new game with valid range' do
expect(valid.min_num).to eql(0)
expect(valid.max_num).to eq... |
danmayer/server_builder | lib/server_builder.rb | <filename>lib/server_builder.rb
require 'logger'
require 'server_builder/version'
require 'server_builder/multi_io'
require 'server_builder/fog_builder'
require 'server_builder/ecs_builder'
require 'server_builder/verifier'
module ServerBuilder
class Builder
attr_accessor :logger
def self.run(opts)
... |
danmayer/server_builder | lib/server_builder/fog_builder.rb | module ServerBuilder
class FogBuilder
attr_accessor :logger
def initialize(opts, logger)
@logger = logger
end
def build
logger.info "building with fog"
end
end
end
|
danmayer/server_builder | lib/server_builder/ecs_builder.rb | module ServerBuilder
class EcsBuilder
attr_accessor :logger, :cluster_name, :service_name, :desired_count,
:task_definition
def initialize(opts)
@logger = opts.fetch('logger'){
log_file = File.open("logs/server_builder.log", "a")
Logger.new MultiIO.new(STDOUT, log_fi... |
danmayer/server_builder | lib/server_builder/verifier.rb | <filename>lib/server_builder/verifier.rb
module ServerBuilder
class Verifier
attr_accessor :logger, :opts, :host
def initialize(opts, logger)
@opts = opts
@host = opts.fetch('host'){ "utils.picoappz.com" }
@logger = logger
end
def verify
logger.info "verifying server wit... |
quantierra/rgeo-activerecord | lib/rgeo/active_record/common_adapter_elements.rb | # frozen_string_literal: true
module RGeo
module ActiveRecord
# Return a feature type module given a string type.
def self.geometric_type_from_name(name)
case name.to_s
when /^geometrycollection/i then Feature::GeometryCollection
when /^geometry/i then Feature::Geometry
when /^linestr... |
quantierra/rgeo-activerecord | lib/rgeo/active_record/geometry_mixin.rb | <gh_stars>10-100
# frozen_string_literal: true
module RGeo
module ActiveRecord
# This module is mixed into all geometry objects. It provides an
# as_json method so that ActiveRecord knows how to generate JSON
# for a geometry-valued field.
module GeometryMixin
# The default JSON generator Proc... |
quantierra/rgeo-activerecord | lib/rgeo/active_record.rb | # frozen_string_literal: true
require "rgeo"
require "active_record"
require "rgeo/active_record/version"
require "rgeo/active_record/spatial_expressions"
require "rgeo/active_record/spatial_factory_store"
require "rgeo/active_record/arel_spatial_queries"
require "rgeo/active_record/common_adapter_elements"
require "r... |
quantierra/rgeo-activerecord | lib/rgeo/active_record/spatial_expressions.rb | <filename>lib/rgeo/active_record/spatial_expressions.rb
# frozen_string_literal: true
module RGeo
module ActiveRecord
# Returns true if spatial expressions (i.e. the methods in the
# SpatialExpressions module) are supported.
def self.spatial_expressions_supported?
defined?(Arel::Nodes::NamedFunctio... |
quantierra/rgeo-activerecord | lib/rgeo/active_record/version.rb | <reponame>quantierra/rgeo-activerecord
# frozen_string_literal: true
module RGeo
module ActiveRecord
VERSION = "7.0.0"
end
end
|
quantierra/rgeo-activerecord | lib/rgeo-activerecord.rb | <gh_stars>10-100
# frozen_string_literal: true
require "rgeo/active_record"
|
quantierra/rgeo-activerecord | lib/rgeo/active_record/spatial_factory_store.rb | # frozen_string_literal: true
module RGeo
module ActiveRecord
class SpatialFactoryStore
include Singleton
Entry = Struct.new(:attrs, :factory)
attr_accessor :registry
def initialize
@registry = []
@default = nil
end
def register(factory, attrs = {})
... |
quantierra/rgeo-activerecord | test/common_elements_test.rb | # frozen_string_literal: true
require "test_helper"
class CommonElementsTest < Minitest::Test
class Feature
def test
9
end
end
class Point
def test
8
end
end
def test_geometric_type_from_name
assert_equal RGeo::ActiveRecord.geometric_type_from_name(:point), RGeo::Feature::P... |
quantierra/rgeo-activerecord | test/spatial_factory_store_test.rb | <reponame>quantierra/rgeo-activerecord
# frozen_string_literal: true
require "test_helper"
class SpatialFactoryStoreTest < Minitest::Test
def test_default
store.default = nil
assert RGeo::Cartesian.preferred_factory === store.default
end
def test_set_default
store.clear
default_factory = Object... |
jcppkkk/redmine_live_relative_time | init.rb | <reponame>jcppkkk/redmine_live_relative_time
require 'redmine'
require 'application_helper_patch'
require_dependency 'hooks/append_javascript_head_hook'
Redmine::Plugin.register :redmine_live_relative_time do
name 'Redmine Live Relative Time'
author '<NAME>, <EMAIL>'
url 'https://github.com/igloonet/redmine_live... |
jcppkkk/redmine_live_relative_time | lib/application_helper_patch.rb | module RedmineLiveRelativeTime
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
alias_method :time_tag_dead, :time_tag
alias_method :time_tag, :time_tag_live
end
end
module InstanceMethods
def time_tag_live(time)
text =... |
thefrontiergroup/thefrontiergroup-matchers | spec/spec_helper.rb | require 'byebug'
$LOAD_PATH << './lib/' |
thefrontiergroup/thefrontiergroup-matchers | lib/thefrontiergroup/matchers/be_paginated.rb | <gh_stars>1-10
RSpec::Matchers.define :be_paginated do
match do |object|
object.respond_to?(:current_page) && object.respond_to?(:total_pages)
end
description do
"be paginated"
end
failure_message do |object|
"expected #{object.inspect} to be a paginated collection"
end
failure_message_when... |
thefrontiergroup/thefrontiergroup-matchers | spec/matchers/order_spec.rb | <filename>spec/matchers/order_spec.rb
require 'spec_helper'
require 'thefrontiergroup/matchers/order'
describe 'order matcher' do
subject { elements }
let(:elements) { [ first_element, second_element, third_element ] }
let(:first_element) { 'A' }
let(:second_element) { 'B' }
let(:third_element) { 'C' }
i... |
thefrontiergroup/thefrontiergroup-matchers | spec/matchers/be_paginated_spec.rb | require 'spec_helper'
require 'thefrontiergroup/matchers/be_paginated'
class PaginatedUser
class << self
def current_page
1
end
def total_pages
1
end
end
end
class NonPaginatedUser
end
describe 'be_paginated matcher' do
subject { resource }
context "when resource responds to pa... |
thefrontiergroup/thefrontiergroup-matchers | lib/thefrontiergroup/matchers/order.rb | RSpec::Matchers.define :order do |origin|
chain :after do |other|
@after = other
end
match do |actual|
@result = true
if @after
actual.each do |item|
if item == origin
@result = false
break
end
break if item == @after
end
end
@result
... |
thefrontiergroup/thefrontiergroup-matchers | lib/thefrontiergroup/matchers/set_flash.rb | <reponame>thefrontiergroup/thefrontiergroup-matchers
RSpec::Matchers.define :set_flash do |flash_type|
chain :to do |message|
@message = message
end
match do |response|
if @message.nil?
flash.has_key? flash_type
else
@message === flash[flash_type]
end
end
description do
"set ... |
thefrontiergroup/thefrontiergroup-matchers | spec/matchers/response_status_matchers_spec.rb | <gh_stars>1-10
require 'spec_helper'
require 'thefrontiergroup/matchers/response_status_matchers'
require 'ostruct'
[
[ "be_bad_request", 400 ],
[ "be_forbidden", 403 ],
[ "be_not_found", 404 ],
[ "be_unauthorised", 401 ],
[ "be_unprocessable_entity", 422 ],
[ "be_internal_server_error", 500 ]
].each do |m... |
thefrontiergroup/thefrontiergroup-matchers | lib/thefrontiergroup/matchers.rb | require "thefrontiergroup/matchers/be_paginated"
require "thefrontiergroup/matchers/order"
require "thefrontiergroup/matchers/response_status_matchers"
require "thefrontiergroup/matchers/set_flash"
require "thefrontiergroup/matchers/version" |
thefrontiergroup/thefrontiergroup-matchers | spec/matchers/set_flash_spec.rb | <gh_stars>1-10
require 'spec_helper'
require 'thefrontiergroup/matchers/set_flash'
describe 'set_flash matcher' do
subject { double(flash: {notice: 'foobar'}) }
it { is_expected.to set_flash(:notice) }
it { is_expected.not_to set_flash(:alert) }
it { is_expected.to set_flash(:notice).to('foobar') }
it { is_... |
thefrontiergroup/thefrontiergroup-matchers | lib/thefrontiergroup/matchers/response_status_matchers.rb | <gh_stars>1-10
def define_status_code_matcher(name, status)
RSpec::Matchers.define "be_#{name}" do
match do
subject
response.status == status
end
description do
"have the HTTP status code #{status}"
end
failure_message do |actual|
"expected HTTP status code to be #{status... |
philbritton/azure-sync | azure-sync.rb | require 'waz-blobs'
#
# Constants for accessing your azure account
#
# access key is the really long guid that is generated
@access_key = ""
# account name is the name of the storage. So buddystore.blob.core.windows.net
# the account name would be buddystore
@account_name = ""
# what is the name of the container you w... |
thepartisan/asciidoctor-kroki | ruby/lib/asciidoctor/extensions/asciidoctor_kroki/version.rb | <gh_stars>10-100
# frozen_string_literal: true
module Asciidoctor
module AsciidoctorKroki
VERSION = '0.5.0'
end
end
|
thepartisan/asciidoctor-kroki | ruby/asciidoctor-kroki.gemspec | # frozen_string_literal: true
require_relative 'lib/asciidoctor/extensions/asciidoctor_kroki/version'
Gem::Specification.new do |s|
s.name = 'asciidoctor-kroki'
s.version = Asciidoctor::AsciidoctorKroki::VERSION
s.summary = 'Asciidoctor extension to convert diagrams to images using Kroki'
s.description = 'An ... |
fernandofeoli/ApiCaelumEAP | app/controllers/interpretacoes_controller.rb | <gh_stars>0
class InterpretacoesController < ApplicationController
wrap_parameters :interpretacao, include: %i[nome valor_minimo valor_maximo]
before_action :set_escala
before_action :set_escala_interpretacao, only: [:show, :update, :destroy]
# GET /interpretacoes
def index
json_response(@escala.interpre... |
fernandofeoli/ApiCaelumEAP | app/models/resposta.rb | <reponame>fernandofeoli/ApiCaelumEAP
class Resposta < ApplicationRecord
belongs_to :parametro
has_many :resultados
has_many :registros, through: :resultados
end
|
fernandofeoli/ApiCaelumEAP | app/models/registro.rb | <filename>app/models/registro.rb
class Registro < ApplicationRecord
belongs_to :paciente
belongs_to :escala
has_many :resultados
has_many :parametros, through: :resultados
end
|
fernandofeoli/ApiCaelumEAP | app/models/paciente.rb | class Paciente < ApplicationRecord
validates :cpf, presence: { message: 'Invalid: Field can not be empty.' }
validates :nome, presence: { message: 'Invalid: Field can not be empty.' }
belongs_to :user
has_many :registros
has_many :escalas, through: :registros
end
|
fernandofeoli/ApiCaelumEAP | app/controllers/escalas_controller.rb | <reponame>fernandofeoli/ApiCaelumEAP<filename>app/controllers/escalas_controller.rb
class EscalasController < ApplicationController
before_action :set_escala, only: [:show, :update, :destroy]
# GET /escalas
def index
@escalas = Escala.all
json_response(@escalas)
end
# POST /escalas
def create
... |
fernandofeoli/ApiCaelumEAP | app/controllers/respostas_controller.rb | class RespostasController < ApplicationController
wrap_parameters :resposta, include: %i[nome pontuacao]
before_action :set_escala
before_action :set_escala_parametro
before_action :set_parametro_resposta, only: [:show, :update, :destroy]
# GET /respostas
def index
json_response(@parametro.respostas)
... |
fernandofeoli/ApiCaelumEAP | config/initializers/session_store.rb | if Rails.env == "production"
Rails.application.config.session_store :cookie_store, key: "_ApiCaelumEAP", domain: "api-caelum-eap.herokuapp.com"
else
Rails.application.config.session_store :cookie_store, key: "_ApiCaelumEAP"
end
|
fernandofeoli/ApiCaelumEAP | db/migrate/20191104074052_create_registros.rb | <reponame>fernandofeoli/ApiCaelumEAP
class CreateRegistros < ActiveRecord::Migration[6.0]
def change
create_table :registros do |t|
t.integer :pontuacao
t.references :paciente, null: false, foreign_key: true
t.references :escala, null: false, foreign_key: true
t.timestamps
end
end
e... |
fernandofeoli/ApiCaelumEAP | spec/requests/sessions_spec.rb | <reponame>fernandofeoli/ApiCaelumEAP
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'user correct login', type: :request do
headers = {
'ACCEPT' => 'application/json'
}
before do
@user = build(:user)
post '/sessions', params: { user: {
email: @user.email,
password: <... |
fernandofeoli/ApiCaelumEAP | app/models/interpretacao.rb | class Interpretacao < ApplicationRecord
belongs_to :escala
end
|
fernandofeoli/ApiCaelumEAP | spec/requests/registrations_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'create new user', type: :request do
before do
@user = build(:user)
post '/registrations', params: { user: {
nome: @user.nome,
email: @user.email,
password: <PASSWORD>,
password_confirmation: <PASSWORD>
} }
end... |
fernandofeoli/ApiCaelumEAP | app/controllers/resultados_controller.rb | <gh_stars>0
class ResultadosController < ApplicationController
wrap_parameters :resultado, include: %i[resposta_id parametro_id]
before_action :set_registro
before_action :set_registro_resultado, only: [:show, :update, :destroy]
# GET /resultados
def index
json_response(@registro.resultados)
end
# G... |
fernandofeoli/ApiCaelumEAP | app/controllers/parametros_controller.rb | <reponame>fernandofeoli/ApiCaelumEAP
class ParametrosController < ApplicationController
wrap_parameters :parametro, include: %i[nome]
before_action :set_escala
before_action :set_escala_parametro, only: [:show, :update, :destroy]
# GET /parametros
def index
json_response(@escala.parametros)
end
# GE... |
fernandofeoli/ApiCaelumEAP | db/migrate/20191102221110_create_interpretacoes.rb | <gh_stars>0
class CreateInterpretacoes < ActiveRecord::Migration[6.0]
def change
create_table :interpretacoes do |t|
t.string :nome
t.integer :valor_maximo
t.integer :valor_minimo
t.references :escala, null: false, foreign_key: true
t.timestamps
end
end
end
|
fernandofeoli/ApiCaelumEAP | db/migrate/20191031041327_add_details_to_user.rb | <filename>db/migrate/20191031041327_add_details_to_user.rb<gh_stars>0
class AddDetailsToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :nome, :string
add_column :users, :cargo, :string
add_column :users, :documento, :string
end
end
|
fernandofeoli/ApiCaelumEAP | config/routes.rb | Rails.application.routes.draw do
root to: "static#home"
resources :sessions, only: [:create]
resources :registrations, only: [:create]
delete :logout, to: 'sessions#logout'
get :logged_in, to: 'sessions#logged_in'
resources :pacientes do
resources :registros do
resources :resultados
end
end
... |
fernandofeoli/ApiCaelumEAP | app/models/parametro.rb | <filename>app/models/parametro.rb
class Parametro < ApplicationRecord
belongs_to :escala
has_many :respostas
has_many :resultados
has_many :registros, through: :resultados
end
|
fernandofeoli/ApiCaelumEAP | app/controllers/pacientes_controller.rb | class PacientesController < ApplicationController
include CurrentUserConcern
before_action :set_paciente, only: [:show, :update, :destroy]
# GET /pacientes
def index
@pacientes = Paciente.where(user_id: 6)
json_response(@pacientes)
end
# GET /pacientes/1
def show
render json: @paciente
e... |
malloc3/YG_Harmonization | libraries/PlateReaderMethods.rb | # By: <NAME>
# <EMAIL>
needs "Yeast Display/YeastDisplayHelper"
needs "Tissue Culture Libs/CollectionDisplay"
needs 'Standard Libs/AssociationManagement'
needs "YG_Harmonization/Upload_PlateReader_Data"
# needs "YG_Harmonization/BiotekPlateReaderCalibration"
module PlateReaderMethods
include YeastDisplayH... |
malloc3/YG_Harmonization | libraries/YG_Controls.rb | # By: <NAME>
# <EMAIL>
# Updated: 08/15/18
# This library is to help with creating additional controls to the YG_Harmonization workflow
needs 'Standard Libs/AssociationManagement'
module YG_Controls
include AssociationManagement
include PartProvenance
def creating_neg_pos_wt_staining_control(in_colle... |
malloc3/YG_Harmonization | libraries/HighThroughput_Lib.rb | # By: <NAME>
# <EMAIL>
# This library contains functions that aid in yeast high throughput screening.
# Ie: Calculations, formatting collections, etc...
needs "Standard Libs/AssociationManagement"
needs "Standard Libs/MatrixTools"
module HighThroughput_Lib
include AssociationManagement, MatrixTools
include ... |
malloc3/YG_Harmonization | libraries/SynchronizationLib.rb |
module SynchronizationLib
FINAL_OD = [0.0003, 0.00015, 0.000075]
FINAL_OUTPUT_VOL = 1#mL
ROWS = ('A'..'H').to_a
COLS = (1..12).to_a
def sync_experimental_cultures(in_collection, out_collection, input_plate_ods, bio_reps)
# Coordinates of wells in input collection that have e... |
malloc3/YG_Harmonization | libraries/Upload_PlateReader_Data.rb | <reponame>malloc3/YG_Harmonization<gh_stars>0
# By: <NAME>
# <EMAIL>
# This library contains functions that aid in uploading data that comes from yeast high throughput screening measurements
# Ie: Plate reader measurements
needs 'Standard Libs/MatrixTools'
needs 'Standard Libs/AssociationManagement'
module Upload_Plat... |
malloc3/YG_Harmonization | libraries/YG_Measure_OD_GFP.rb | <gh_stars>0
# By: <NAME>
# <EMAIL>
# 10/01/18
module YG_Measure_OD_GFP
def transfer_cultures(in_item, out_item)
if debug
in_item = Item.find(276614) # Contains new part_associations 100118
end
in_collection = Collection.find(in_item.id)
out_collec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.