repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
michaelgpearce/coinmux | bin/coinmux_gui.rb | <filename>bin/coinmux_gui.rb
raise "COINMUX_ENV not set" if ENV['COINMUX_ENV'].nil?
$: << File.join(File.dirname(__FILE__), '..')
require 'lib/coinmux'
if Coinmux.os == :macosx
# Need to set app name before loading any AWT/Swing components
{
"com.apple.mrj.application.apple.menu.about.name" => "Coinmux",
... |
michaelgpearce/coinmux | lib/coinmux/message/status.rb | <filename>lib/coinmux/message/status.rb
class Coinmux::Message::Status < Coinmux::Message::Base
property :state
property :transaction_id
validates :state, :presence => true
validate :transaction_id_presence
validate :state_valid
class << self
def build(coin_join, options = {})
options.assert_k... |
michaelgpearce/coinmux | spec/bitcoin_crypto_spec.rb | <gh_stars>10-100
require 'spec_helper'
describe Coinmux::BitcoinCrypto do
let(:message) { "this is a message" }
let(:address) { "mh9nRF1ZSqLJB3hbUjPLmfDHdnGUURdYdK" }
let(:private_key_hex) { "585C660C887913E5F40B8E34D99C62766443F9D043B1DE1DFDCC94E386BC6DF6" }
let(:private_key_wif) { "<KEY>" }
let(:private_ke... |
michaelgpearce/coinmux | gui/view/available_mixes.rb | <gh_stars>10-100
class Gui::View::AvailableMixes < Gui::View::Base
import 'java.awt.Dimension'
import 'java.awt.GridLayout'
import 'javax.swing.BorderFactory'
import 'javax.swing.ListSelectionModel'
import 'javax.swing.JButton'
import 'javax.swing.JTextArea'
import 'javax.swing.JScrollPane'
import 'java... |
michaelgpearce/coinmux | lib/coinmux/digest.rb | require 'securerandom'
require 'digest/sha2'
class Coinmux::Digest
include Singleton
def digest(message)
Digest::SHA2.new(256).digest(message)
end
def hex_message_digest(*params)
message = params.join(':')
hex_digest(message)
end
def hex_digest(message)
digest(message).unpack('H*')... |
michaelgpearce/coinmux | lib/coinmux/config.rb | require 'yaml'
require 'erb'
class Coinmux::Config
include Coinmux::Proper
CONFIG = YAML.load(ERB.new(Coinmux::FileUtil.read_content('config', 'coinmux.yml')).result)
property :name, :bitcoin_network, :coin_join_uris, :webbtc_host, :show_transaction_url
class << self
def configs
@configs ||= %w(... |
michaelgpearce/coinmux | lib/coinmux/coin_join_uri.rb | <gh_stars>10-100
class Coinmux::CoinJoinUri
VALID_NETWORKS = %w(p2p filesystem test)
attr_accessor :params, :application, :network
class << self
def parse(uri)
match = uri.to_s.match(/coinjoin:\/\/([^\/]+)\/([^?]+)\??(.*)/)
raise Coinmux::Error, "Could not parse URI" if match.nil?
applica... |
michaelgpearce/coinmux | lib/coinmux/state_machine/director.rb | class Coinmux::StateMachine::Director < Coinmux::StateMachine::Base
STATES = %w(waiting_for_inputs waiting_for_outputs waiting_for_signatures failed completed)
STATUS_UPDATE_INTERVAL = 60
def initialize(options = {})
assert_initialize_params!(options)
super(options)
self.coin_join_message = Coinm... |
michaelgpearce/coinmux | lib/coinmux/cipher.rb | <filename>lib/coinmux/cipher.rb<gh_stars>10-100
class Coinmux::Cipher
include Singleton, Coinmux::Facades
def encrypt(secret_key, clear_text)
cipher = build_cipher(:encrypt)
cipher.key = digest_facade.digest(secret_key)
cipher.iv = iv = cipher.random_iv # 16 bytes
encrypted = cipher.update(cle... |
michaelgpearce/coinmux | lib/coinmux/application/available_coin_joins.rb | <reponame>michaelgpearce/coinmux<filename>lib/coinmux/application/available_coin_joins.rb<gh_stars>10-100
require 'thread'
class Coinmux::Application::AvailableCoinJoins
include Coinmux::Facades, Coinmux::Threading
attr_accessor :data_store
def initialize(data_store)
self.data_store = data_store
end
#... |
michaelgpearce/coinmux | lib/coinmux/bitcoin_util.rb | <filename>lib/coinmux/bitcoin_util.rb<gh_stars>10-100
module Coinmux::BitcoinUtil
SATOSHIS_PER_BITCOIN = 100_000_000
DEFAULT_TRANSACTION_FEE = (0.0001 * SATOSHIS_PER_BITCOIN).to_i
import 'com.google.bitcoin.core.NetworkParameters'
def network_params
Coinmux::Config.instance.bitcoin_network == 'mainnet' ... |
michaelgpearce/coinmux | spec/message/input_spec.rb | require 'spec_helper'
describe Coinmux::Message::Input do
before do
fake_all_network_connections
stub_bitcoin_network_for_coin_join(coin_join)
end
let(:template_message) { build(:coin_join_message, :with_inputs).inputs.value.detect(&:created_with_build) }
let(:input_identifier) { template_message.inpu... |
michaelgpearce/coinmux | spec/spec_helper.rb | require File.join(File.dirname(__FILE__), '..', 'lib', 'coinmux')
ENV['COINMUX_ENV'] = 'test'
module Coinmux
module Fake
end
end
require 'rspec'
# require 'spec/fake/application'
require 'spec/fake/bitcoin_network'
require 'factory_girl'
require 'pry'
FactoryGirl.find_definitions rescue puts "Warn: #{$!}"
incl... |
michaelgpearce/coinmux | spec/message/association_spec.rb | require 'spec_helper'
describe Coinmux::Message::Association do
before do
fake_all_network_connections
end
let(:template_message) { build(:association_message) }
let(:created_with_build) { template_message.created_with_build }
let(:name) { template_message.name }
let(:type) { template_message.type }
... |
michaelgpearce/coinmux | lib/coinmux/message/transaction_signature.rb | class Coinmux::Message::TransactionSignature < Coinmux::Message::Base
property :transaction_input_index, :script_sig, :message_verification
validates :transaction_input_index, :script_sig, :message_verification, :presence => true
validate :message_verification_correct, :if => :director?
validate :transaction_i... |
michaelgpearce/coinmux | lib/coinmux/state_machine/event.rb | <reponame>michaelgpearce/coinmux
class Coinmux::StateMachine::Event
attr_accessor :source, :type, :options
def initialize(params = {})
params.each do |key, value|
send("#{key}=", value)
end
end
end
|
michaelgpearce/coinmux | lib/coinmux/message/transaction.rb | class Coinmux::Message::Transaction < Coinmux::Message::Base
property :inputs, :outputs
validate :inputs_is_array_of_hashes
validate :outputs_is_array_of_hashes
validate :has_minimum_number_of_coin_join_amount_outputs
validate :has_no_duplicate_inputs
validate :has_no_duplicate_outputs
validate :has_corr... |
michaelgpearce/coinmux | lib/coinmux/bitcoin_crypto.rb | class Coinmux::BitcoinCrypto
include Singleton, Coinmux::BitcoinUtil
import 'java.math.BigInteger'
import 'java.security.SignatureException'
import 'com.google.bitcoin.core.AddressFormatException'
import 'com.google.bitcoin.core.ECKey'
import 'com.google.bitcoin.core.Address'
import 'com.google.bitcoin.c... |
michaelgpearce/coinmux | lib/coinmux/application/mixer.rb | <reponame>michaelgpearce/coinmux<filename>lib/coinmux/application/mixer.rb
class Coinmux::Application::Mixer
include Coinmux::Facades
ATTRS = [:event_queue, :data_store, :amount, :participants, :input_private_key, :output_address, :change_address]
attr_accessor *ATTRS
attr_accessor :participant, :director, :n... |
michaelgpearce/coinmux | lib/coinmux/message/association.rb | class Coinmux::Message::Association < Coinmux::Message::Base
attr_accessor :name, :type, :data_store_identifier_from_build, :data_store_identifier, :read_only
validate :data_store_identifier_has_correct_permissions, :unless => :created_with_build?
class << self
def build(coin_join, options = {})
optio... |
michaelgpearce/coinmux | spec/message/message_verification_spec.rb | <filename>spec/message/message_verification_spec.rb
require 'spec_helper'
describe Coinmux::Message::MessageVerification do
before do
fake_all_network_connections
end
let(:coin_join) { build(:coin_join_message, :with_inputs) }
let(:template_message) { Coinmux::Message::MessageVerification.build(coin_join)... |
michaelgpearce/coinmux | lib/coinmux/message/output.rb | <reponame>michaelgpearce/coinmux
class Coinmux::Message::Output < Coinmux::Message::Base
property :address, :message_verification, :transaction_output_identifier
validates :address, :message_verification, :transaction_output_identifier, :presence => true
validate :message_verification_correct, :if => :message_... |
michaelgpearce/coinmux | spec/message/status_spec.rb | require 'spec_helper'
describe Coinmux::Message::Status do
before do
fake_all_network_connections
end
let(:template_message) { build(:status_message) }
let(:state) { template_message.state }
let(:transaction_id) { template_message.transaction_id }
let(:coin_join) { template_message.coin_join }
desc... |
michaelgpearce/coinmux | gui/view/base.rb | <reponame>michaelgpearce/coinmux
class Gui::View::Base
include Coinmux::BitcoinUtil, Coinmux::Facades
attr_accessor :application, :root_panel, :primary_button
import 'java.awt.Dimension'
import 'java.awt.Font'
import 'java.awt.FlowLayout'
import 'java.awt.GridBagLayout'
import 'java.awt.GridBagConstrain... |
michaelgpearce/coinmux | gui/event_queue.rb | <gh_stars>10-100
class Gui::EventQueue
include Singleton
import 'javax.swing.SwingUtilities'
import 'javax.swing.Timer'
def sync_exec(&callback)
if SwingUtilities.isEventDispatchThread()
yield
else
SwingUtilities.invokeAndWait(create_callback_with_error_handling(&callback))
end
end
... |
michaelgpearce/coinmux | lib/coinmux/message/coin_join.rb | class Coinmux::Message::CoinJoin < Coinmux::Message::Base
include Coinmux::BitcoinUtil
VERSION = 1
DEFAULT_AMOUNT = 1 * SATOSHIS_PER_BITCOIN
DEFAULT_PARTICIPANTS = 5
property :version, :identifier, :message_public_key, :amount, :participants, :participant_transaction_fee
add_association :inputs, :list... |
michaelgpearce/coinmux | lib/coinmux/state_machine/participant.rb | class Coinmux::StateMachine::Participant < Coinmux::StateMachine::Base
attr_accessor :input_private_key, :input_address, :output_address, :change_address
STATE = %w(finding_available_coin_join failed completed)
COIN_JOIN_MESSAGE_FETCH_SIZE = 50
def initialize(options = {})
assert_initialize_params!(opti... |
michaelgpearce/coinmux | lib/coinmux/file_util.rb | require 'fileutils'
require 'tmpdir'
module Coinmux::FileUtil
import 'java.io.FileInputStream'
import 'java.io.InputStreamReader'
import 'java.io.ByteArrayOutputStream'
import 'java.io.IOException'
class << self
def root_mkdir_p(*paths)
begin
FileUtils.mkdir_p(path = File.join(Coinmux.root... |
michaelgpearce/coinmux | lib/coinmux/message/input.rb | class Coinmux::Message::Input < Coinmux::Message::Base
property :message_public_key, :address, :change_address, :change_transaction_output_identifier, :signature
attr_accessor :message_private_key, :private_key
validates :message_public_key, :address, :signature, :change_transaction_output_identifier, :pres... |
michaelgpearce/coinmux | spec/fake/bitcoin_network.rb | <filename>spec/fake/bitcoin_network.rb
class Coinmux::Fake::BitcoinNetwork
def initialize
@blocks = []
@transaction_pool = []
test_confirm_block
end
# nil returned if transaction not found, 0 returned if in transaction pool, 1+ if accepted into blockchain
def transaction_confirmations(transaction_... |
michaelgpearce/coinmux | spec/state_machine/director_spec.rb | <reponame>michaelgpearce/coinmux
require 'spec_helper'
describe Coinmux::StateMachine::Director do
before do
fake_all
end
# describe "#initialize" do
# subject do
# Coinmux::StateMachine::Director.new
# end
# it "should be in the initialized state" do
# expect(subject.state).t... |
michaelgpearce/coinmux | gui/component/link_button.rb | class Gui::Component::LinkButton < Java::JavaxSwing::JButton
import 'java.awt.Color'
import 'java.awt.Cursor'
import 'java.awt.Insets'
import 'javax.swing.UIManager'
def initialize(label = nil)
super(label.to_s)
setBorderPainted(false)
setBorder(nil)
setMargin(Insets.new(0, 0, 0, 0))
setC... |
michaelgpearce/coinmux | spec/http_spec.rb | require 'spec_helper'
describe Coinmux::Http do
before do
Coinmux::Http.instance.send(:clear_cache)
end
describe "#get" do
let(:http) { Coinmux::Http.instance }
let(:host) { 'http://valid-host.example.com' }
let(:path) { '/valid/path.html' }
let(:code) { '200' }
let(:body) { 'some conten... |
michaelgpearce/coinmux | lib/coinmux/proper.rb | <filename>lib/coinmux/proper.rb
module Coinmux::Proper
module ClassMethods
def properties
@properties ||= []
end
def property(*names)
names.each do |name|
properties << name.to_sym
define_method(name) do
self[name]
end
define_method(:"#{name}=") do ... |
michaelgpearce/coinmux | lib/coinmux/data_store/base.rb | class Coinmux::DataStore::Base
include Coinmux::Facades
DATA_TIME_TO_LIVE = 1 * 60 * 60
attr_accessor :coin_join_uri, :connected
def initialize(coin_join_uri)
self.connected = false
self.coin_join_uri = coin_join_uri
end
def coin_join_identifier
"#{coin_join_uri.params["identifier"] || "defau... |
michaelgpearce/coinmux | spec/fake/application.rb | <reponame>michaelgpearce/coinmux<gh_stars>10-100
class Coinmux::Fake::Application
class Invocation
include Coinmux::Proper
property :block, :time, :seconds
def <=>(other)
self.time <=> other.time
end
end
attr_reader :invocations
def initialize
@invocations = []
@current_time = ... |
michaelgpearce/coinmux | bin/coinmux_cli.rb | raise "COINMUX_ENV not set" if ENV['COINMUX_ENV'].nil?
require File.expand_path("../../lib/coinmux", __FILE__)
module Cli
end
require 'optparse'
require 'ostruct'
options = OpenStruct.new
OptionParser.new do |o|
o.banner = "#{Coinmux::BANNER}\n\nUsage: coinmux [options]\n"
o.separator ""
o.on('-v', '--versio... |
michaelgpearce/coinmux | gui/view/mixing.rb | <filename>gui/view/mixing.rb
class Gui::View::Mixing < Gui::View::Base
STATES = [:initializing, :waiting_for_other_inputs, :waiting_for_other_outputs, :waiting_for_completed, :completed]
TERMINATE_TEXT = "Terminate"
attr_accessor :director, :participant, :transaction_url, :mixer
import 'java.awt.Component'
... |
michaelgpearce/coinmux | cli/event_queue.rb | <reponame>michaelgpearce/coinmux
require 'thread'
require 'set'
class Cli::EventQueue
include Singleton, Coinmux::BitcoinUtil
attr_reader :queue, :event_thread
def initialize
@queue = Queue.new
end
def start
@event_thread = start_event_thread
nil
end
def stop
# nil message in queue ki... |
michaelgpearce/coinmux | lib/coinmux/facades.rb | <gh_stars>10-100
module Coinmux::Facades
module Methods
def bitcoin_crypto_facade
Coinmux::BitcoinCrypto.instance
end
def bitcoin_network_facade
Coinmux::BitcoinNetwork.instance
end
def cipher_facade
Coinmux::Cipher.instance
end
def config_facade
Coinmux::Config.... |
nkipreos/Post-Tester | app/models/request.rb | class Request < ActiveRecord::Base
belongs_to :page
end
|
koki1023/apnotic | lib/apnotic/abstract_notification.rb | # frozen_string_literal: true
require 'securerandom'
require 'json'
module Apnotic
class AbstractNotification
attr_reader :token
attr_accessor :apns_id,
:expiration,
:priority,
:topic,
:apns_collapse_id,
:authorization... |
TxbitExchange/coingecko-cryptoexchange | lib/cryptoexchange/exchanges/zgtop/market.rb | <gh_stars>1-10
module Cryptoexchange::Exchanges
module Zgtop
class Market < Cryptoexchange::Models::Market
NAME = 'zgtop'
API_URL = 'https://www.zg.top/API/api/v2'
def self.trade_page_url(args={})
"https://www.zg.top"
end
end
end
end
|
TxbitExchange/coingecko-cryptoexchange | lib/cryptoexchange/exchanges/uniswap/market.rb | module Cryptoexchange::Exchanges
module Uniswap
class Market < Cryptoexchange::Models::Market
NAME = 'uniswap'
API_URL = 'https://uniswap-analytics.appspot.com/api/v1'
end
end
end
|
TxbitExchange/coingecko-cryptoexchange | spec/exchanges/txbit/integration/market_spec.rb | require 'spec_helper'
RSpec.describe 'Txbit integration specs' do
let(:client) { Cryptoexchange::Client.new }
let(:market) { 'txbit' }
let(:btc_atl_pair) { Cryptoexchange::Models::MarketPair.new(base: 'atl', target: 'btc', market: 'txbit') }
it 'fetch pairs' do
pairs = client.pairs('txbit')
expect(pai... |
TxbitExchange/coingecko-cryptoexchange | lib/cryptoexchange/client.rb | <reponame>TxbitExchange/coingecko-cryptoexchange<gh_stars>1-10
module Cryptoexchange
class Client
def initialize(ticker_ttl: 3, cache_size: 200)
LruTtlCache.ticker_cache(ticker_ttl, cache_size)
end
def trade_page_url(exchange, args={})
pairs_classname = "Cryptoexchange::Exchanges::#{StringHel... |
TxbitExchange/coingecko-cryptoexchange | lib/cryptoexchange/exchanges/trx_market/market.rb | module Cryptoexchange::Exchanges
module TrxMarket
class Market < Cryptoexchange::Models::Market
NAME = 'trx_market'
API_URL = 'https://trx.market'
def self.trade_page_url(args={})
"https://trx.market/exchange"
end
end
end
end
|
TxbitExchange/coingecko-cryptoexchange | lib/cryptoexchange/exchanges/uniswap/services/market.rb | <reponame>TxbitExchange/coingecko-cryptoexchange<filename>lib/cryptoexchange/exchanges/uniswap/services/market.rb
module Cryptoexchange::Exchanges
module Uniswap
module Services
class Market < Cryptoexchange::Services::Market
class << self
def supports_individual_ticker_query?
... |
rrreeeyyy/promrule | lib/promrule/version.rb | <filename>lib/promrule/version.rb
module Promrule
VERSION = "0.1.0"
end
|
rrreeeyyy/promrule | lib/promrule.rb | require "promrule/version"
|
rrreeeyyy/promrule | spec/promrule_spec.rb | require "spec_helper"
RSpec.describe Promrule do
it "has a version number" do
expect(Promrule::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
__END__
group do
record "instance:errors:rate5m" do
expr "rate(errors_total[5m])"
end
record "instance:r... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager.rb | require 'kuby/cert-manager/plugin'
module Kuby
module CertManager
autoload :AcmeStrategy, 'kuby/cert-manager/acme_strategy'
autoload :ClusterIssuer, 'kuby/cert-manager/cluster_issuer'
autoload :ClusterIssuerSpec, 'kuby/cert-manager/cluster_issuer_spec'
autoload :Http01Solver, 'k... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/plugin.rb | <filename>lib/kuby/cert-manager/plugin.rb
require 'kuby'
module Kuby
module CertManager
class Plugin < ::Kuby::Plugin
class Config
extend ::KubeDSL::ValueFields
value_fields :email
end
NAMESPACE = 'cert-manager'.freeze
CERT_MANAGER_VERSION = '1.6.1'.freeze
CERT_MAN... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/http01_solver.rb | <filename>lib/kuby/cert-manager/http01_solver.rb
module Kuby
module CertManager
class Http01Solver < ::KubeDSL::DSLObject
object_field(:ingress) { Http01SolverIngress.new }
def serialize
{}.tap do |result|
result[:ingress] = ingress.serialize
end
end
def kind_sy... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/solver.rb | <gh_stars>0
module Kuby
module CertManager
class Solver < ::KubeDSL::DSLObject
object_field(:http01) { Http01Solver.new }
def serialize
{}.tap do |result|
result[:http01] = http01.serialize
end
end
def kind_sym
:http01
end
end
end
end
|
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/acme_strategy.rb | module Kuby
module CertManager
class AcmeStrategy < ::KubeDSL::DSLObject
value_fields :server, :email
object_field(:private_key_secret_ref) { PrivateKeySecretRef.new }
array_field(:solver) { Solver.new }
def serialize
{}.tap do |result|
result[:server] = server
... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/cluster_issuer_spec.rb | <filename>lib/kuby/cert-manager/cluster_issuer_spec.rb
module Kuby
module CertManager
class ClusterIssuerSpec < ::KubeDSL::DSLObject
object_field(:acme) { AcmeStrategy.new }
def serialize
{}.tap do |result|
result[:acme] = acme.serialize
end
end
def to_resource
... |
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/http01_solver_ingress.rb | module Kuby
module CertManager
class Http01SolverIngress < ::KubeDSL::DSLObject
value_fields :ingress_class
def serialize
{}.tap do |result|
result[:class] = ingress_class
end
end
def kind_sym
:http01_solver_ingress
end
end
end
end
|
kingdonb/kuby-cert-manager | lib/kuby/cert-manager/private_key_secret_ref.rb | <gh_stars>0
module Kuby
module CertManager
class PrivateKeySecretRef < ::KubeDSL::DSLObject
value_fields :name
def serialize
{}.tap do |result|
result[:name] = name
end
end
def kind_sym
:private_key_secret_ref
end
end
end
end
|
alpinelab/codestyle | alpinelab-codestyle.gemspec | # frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "alpine_lab/code_style/version"
Gem::Specification.new do |spec|
spec.name = "alpinelab-codestyle"
spec.version = AlpineLab::CodeStyle::VERSION
spec.files = Dir["README.md", "LICE... |
alpinelab/codestyle | lib/alpine_lab/code_style/version.rb | <gh_stars>1-10
# frozen_string_literal: true
module AlpineLab
module CodeStyle
VERSION = "0.8.0"
end
end
|
iCentris/time_zone_ext | lib/time_zone_ext.rb | require 'tzinfo'
require "active_support/core_ext"
require "time_zone_ext/version"
require "date"
require "i18n"
module TimeZoneExt
def strptime(date, format, locale: I18n.locale)
locale ||= I18n.config.locale
if format =~ /%z/i
DateTime.strptime(unlocalize_date_string(date,locale), format).in_time_zon... |
aquariumbio/rna-extraction-kits | libraries/MagMAXViralIINAIsolationKit.rb | # frozen_string_literal: true
# Written By <NAME> 2020-05-18
needs 'Standard Libs/LabwareNames'
# MagMAX Viral/Pathogen II Nucleic Acid Isolation Kit
# 1) Suspend magnetic beads in buffer
# 2) Proteinase K digestion
# 3) Wash beads (3x)
# 4) Release RNA from beads
module MagMAXViralIINAIsolationKit
include Units
... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/qiagenrneasyminikit/source.rb | <filename>rna_extraction_kits/libraries/qiagenrneasyminikit/source.rb
# frozen_string_literal: true
needs 'RNA Extraction Kits/QiagenRNAExtractionHelper'
# Module for Qiagen RNeasy Mini Kit
#
# @author <NAME> <<EMAIL>>
# @note The instructions here are based on the BU Center for Regenerative
# Medicine COVID-19 tes... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/qiagenrnaextractionhelper/source.rb | # frozen_string_literal: true
needs 'Standard Libs/Units'
# Module for common methods and constants in Qiagen RNA extraction kits
#
# @author <NAME> <<EMAIL>>
module QiagenRNAExtractionHelper
include Units
COLUMN_LONG = 'Qiagen spin column'
COLUMN_SHORT = 'spin column'
LYSIS_TUBE_LONG = 'lysis tube (LT)'
... |
aquariumbio/rna-extraction-kits | test/operation_types/rna_extraction_test/test.rb | <gh_stars>0
# frozen_string_literal: true
class ProtocolTest < ProtocolTestBase
def setup
add_random_operations(3)
# # Use this if you want to test alternative extraction kits
# # Kits
# # Qiagen RNeasy Mini Kit
# # QIAamp DSP Viral RNA Mini Kit
# # Test RNA Extraction Kit
# # Ma... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/qiaampdspviralrnaminikit/source.rb | <filename>rna_extraction_kits/libraries/qiaampdspviralrnaminikit/source.rb
# frozen_string_literal: true
needs 'RNA Extraction Kits/QiagenRNAExtractionHelper'
# Module for QIAamp DSP Viral RNA Mini Kit
#
# @author <NAME> <<EMAIL>>
module QIAampDSPViralRNAMiniKit
include QiagenRNAExtractionHelper
NAME = 'QIAamp D... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/supportedrnaextractionkits/source.rb | # frozen_string_literal: true
needs 'RNA Extraction Kits/TestRNAExtractionKit'
needs 'RNA Extraction Kits/QIAampDSPViralRNAMiniKit'
needs 'RNA Extraction Kits/QiagenRNeasyMiniKit'
# Module for enumerating supported RNA extraction kits
#
# @author <NAME> <<EMAIL>>
module SupportedRNAExtractionKits
# Extend the modul... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/testrnaextractionkit/source.rb | # frozen_string_literal: true
needs 'Standard Libs/Units'
# Minimal RNA Extraction Kit Module for testing
#
# @author <NAME> <<EMAIL>>
module TestRNAExtractionKit
include Units
NAME = 'Test RNA Extraction Kit'
MIN_SAMPLE_VOLUME = { qty: 140, units: MICROLITERS }.freeze
DEFAULT_SAMPLE_VOLUME = MIN_SAMPLE... |
aquariumbio/rna-extraction-kits | rna_extraction_kits/libraries/rnaextractionkits/source.rb | <filename>rna_extraction_kits/libraries/rnaextractionkits/source.rb
# frozen_string_literal: true
needs 'RNA Extraction Kits/SupportedRNAExtractionKits'
# Module for switching among several different RNA extraction kits
#
# @author <NAME> <<EMAIL>>
module RNAExtractionKits
include SupportedRNAExtractionKits
# Ru... |
JuniorBoaventura/react-native-keyboard-manager | RNKeyboardManager.podspec | require 'json'
version = JSON.parse(File.read('package.json'))["version"]
Pod::Spec.new do |s|
s.name = "RNKeyboardManager"
s.version = version
s.description = <<-DESC
This library allows to prevent issues of keyboard sliding up and cover on React-Native iOS projects
DESC
s.homepag... |
mneumann/rust-smtp | test.rb | <reponame>mneumann/rust-smtp
require 'net/smtp'
msgstr = <<END_OF_MESSAGE
From: <NAME> <<EMAIL>>
To: Destination Address <<EMAIL>>
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <<EMAIL>>
This is a test message.
END_OF_MESSAGE
Net::SMTP.start('127.0.0.1', 2525, 'mail.from.domain') do |smtp|
... |
lighty/oas_divider | lib/oas_divider/paths_object.rb | module OasDivider
class PathsObject
attr_accessor :path, :path_item_objects
def initialize(path, path_item_objects)
@path = path
@path_item_objects = path_item_objects
end
def to_file
make_directory
convert_ref
YAML.dump(path_item_objects, File.open( File.join(directory... |
lighty/oas_divider | lib/oas_divider/relative_document_referencer.rb | <reponame>lighty/oas_divider
module OasDivider
class RelativeDocumentReferencer
def self.execute(root, depth)
new(root, depth).execute
end
def initialize(root, depth)
@root = root
@depth = depth
end
def execute
lookup(root)
root
end
# hashで、keyが$refならconver... |
lighty/oas_divider | lib/oas_divider/schema_object.rb | module OasDivider
class SchemaObject
attr_accessor :schema_name, :schema_object
def initialize(schema_name, schema_object)
@schema_name = schema_name
@schema_object = schema_object
end
def to_file
convert_ref
YAML.dump(schema_object, File.open( File.join(directory, file_name)... |
lighty/oas_divider | lib/oas_divider.rb | require 'oas_divider/version'
require 'yaml'
require 'fileutils'
require 'oas_divider/components_object_field_object'
require 'oas_divider/paths_object'
require 'oas_divider/relative_document_referencer'
require 'oas_divider/schema_object'
module OasDivider
class Cli
def initialize(file_name)
@file_name ... |
lighty/oas_divider | spec/oas_divider_spec.rb | <filename>spec/oas_divider_spec.rb
RSpec.describe OasDivider do
it "has a version number" do
expect(OasDivider::VERSION).not_to be nil
end
let(:oas_divider) { OasDivider::Cli.new('spec/fixtures/openapi.yaml') }
before { oas_divider.divide }
after { FileUtils.rm_r %w(swagger_root.yml components paths) } #... |
lighty/oas_divider | lib/oas_divider/components_object_field_object.rb | module OasDivider
class ComponentsObjectFieldObject
attr_accessor :field_name, :field_object
def initialize(field_name, field_object)
@field_name = field_name
@field_object = field_object
end
def to_file
convert_ref
YAML.dump(field_object, File.open( File.join(directory, file... |
NStephenson/smartvote_sinatra_assessment | app/models/issue.rb | <filename>app/models/issue.rb<gh_stars>0
class Issue < ActiveRecord::Base
has_many :reactions
has_many :voters, through: :reactions
has_many :candidates, through: :reactions
def self.issue_categories
categories = []
all.map do |issue|
if !categories.include?(issue.category)
categories <... |
NStephenson/smartvote_sinatra_assessment | app/models/voter.rb | <filename>app/models/voter.rb
class Voter < ActiveRecord::Base
has_many :reactions
has_many :issues, through: :reactions
has_many :candidates, through: :reactions
has_secure_password
def best_candidate
reactions.each do |reaction|
end
end
end |
NStephenson/smartvote_sinatra_assessment | app/controllers/candidates_controller.rb | class CandidatesController < ApplicationController
get '/candidates' do
@candidates = Candidate.all
erb :'candidates/index'
end
get '/candidates/:id' do
@candidate = Candidate.find(params[:id])
erb :'candidates/show'
end
end |
NStephenson/smartvote_sinatra_assessment | app/controllers/voters_controller.rb | <gh_stars>0
class VotersController < ApplicationController
get '/voters' do
@voters = Voter.all
erb :'voters/index'
end
get '/voters/:id' do
@voter = Voter.find(params[:id])
erb :'voters/show'
end
get '/signup' do
if logged_in?
redirect to '/reactions'
else
erb :'voters/n... |
NStephenson/smartvote_sinatra_assessment | app/controllers/issues_controller.rb | class IssuesController < ApplicationController
get '/issues' do
@issues = Issue.all
erb :'issues/index'
end
get '/issues/:id' do
@issue = Issue.find(params[:id])
erb :'issues/show'
end
end |
NStephenson/smartvote_sinatra_assessment | app/controllers/reactions_controller.rb | require 'rack-flash'
class ReactionsController < ApplicationController
use Rack::Flash
get '/reactions' do
@reactions = Reaction.all
erb :'reactions/index'
end
get '/issues/:id/addreaction' do
if logged_in?
@issue = Issue.find(params[:id])
erb :'reactions/new'
else
redirect... |
NStephenson/smartvote_sinatra_assessment | config.ru | require './config/environment'
require 'rack-flash'
if ActiveRecord::Migrator.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
use Rack::MethodOverride
use VotersController
use CandidatesController
use IssuesController
use ReactionsController
run ApplicationController |
NStephenson/smartvote_sinatra_assessment | app/models/candidate.rb | class Candidate < ActiveRecord::Base
has_many :reactions
has_many :voters, through: :reactions
has_many :issues, through: :reactions
def issues_for
reactions.each_with_object([]) do |reaction, arr|
if reaction.agreement > 3
arr << reaction.issue
end
end
end
def issues_against... |
NStephenson/smartvote_sinatra_assessment | app/models/reaction.rb | class Reaction < ActiveRecord::Base
belongs_to :voter
belongs_to :candidate
belongs_to :issue
def agreeance
case agreement
when 1
"Strongly Disagree"
when 2
"Disagree"
when 3
"Neutral/Undeclared"
when 4
"Agree"
when 5
"Strongly Agree"
end
end
end |
NStephenson/smartvote_sinatra_assessment | db/migrate/20160309002330_create_reactions.rb | class CreateReactions < ActiveRecord::Migration
def change
create_table :reactions do |t|
t.text :text
t.integer :agreement
t.integer :issue_id
t.integer :candidate_id
t.integer :voter_id
end
end
end
|
chrisb/character-title-gen | lib/character_titles.rb | require 'active_support/all'
require 'character_titles/version'
require 'character_titles/helpers'
require 'character_titles/place'
require 'character_titles/evil'
require 'character_titles/good'
require 'character_titles/neutral'
class String
def titleize_for_character
self.strip.titleize.gsub('Of', 'of').gs... |
chrisb/character-title-gen | lib/character_titles/evil.rb | module CharacterTitles
module Evil
module_function
extend Helpers
SILLY = false
BODY_PARTS_SINGULAR = %w(anus blood flesh skin fat death eye sight)
BODY_PARTS = %w(intestine colon gonad skull leg arm body head gut beast heart liver)
VIOLENT_VERBS_AS_NOUNS = %w(vommitter cooker... |
chrisb/character-title-gen | lib/character_titles/good.rb | <reponame>chrisb/character-title-gen
module CharacterTitles
module Good
module_function
extend Helpers
NOUNS = %w(light wonder prosperity goodness truth)
VERBS_AS_NOUNS = %w(bringer restorer bearer guardian savior protector)
ANTI_VERBS_AS_NOUNS = %w(vanquisher slayer destroyer ... |
chrisb/character-title-gen | lib/character_titles/place.rb | module CharacterTitles
module Place
module_function
ADJECTIVES = %w(northern southern western eastern cold wintery snowy rugged dark crimson red bloody haunted)
MODIFIERS = %w(world land realm)
PLACES = %w(winter plains south east north west caves caverns towers)
PLACES_NEEDING_MODIFIER = %w... |
chrisb/character-title-gen | lib/character_titles/neutral.rb | <filename>lib/character_titles/neutral.rb
module CharacterTitles
module Neutral
module_function
extend Helpers
PREFIXES = %w(byr dy mi beo tyr)
POSTFIXES = %w(dren bor dun mar del lad ar gren grad gard born bar bel wren rend mel dar den ful ren)
ANIMALS = %w(wolf dragon bear beast)
P... |
chrisb/character-title-gen | lib/character_titles/helpers.rb | module CharacterTitles
module Helpers
module_function
def one_of(*args)
args.sample
end
def chance_of(obj, chance = 0.3)
obj = obj.sample if obj.is_a?(Array)
rand < chance ? obj : nil
end
def word_separator
['', '-', ' '].sample
end
def separator(include_non... |
talentnest/compendium | app/classes/compendium/presenters/base.rb | module Compendium::Presenters
class Base
def initialize(template, object)
@object = object
@template = template
end
def to_s
"#<#{self.class.name}:0x00#{'%x' % (object_id << 1)}>"
end
private
def self.presents(name)
define_method(name) do
@object
end
... |
talentnest/compendium | app/classes/compendium/presenters/csv.rb | require 'csv'
module Compendium::Presenters
class CSV < Table
def initialize(object, &block)
super(nil, object, &block)
end
def render
::CSV.generate do |csv|
csv << headings.map{ |_, val| formatted_heading(val) }
records.each do |row|
csv << row.map{ |key, val| fo... |
talentnest/compendium | spec/result_set_spec.rb | <reponame>talentnest/compendium
require 'compendium/result_set'
describe Compendium::ResultSet do
describe "#initialize" do
subject{ described_class.new(results).records }
context "when given an array" do
let(:results) { [1, 2, 3] }
it { should == [1, 2, 3] }
end
context "when given an ... |
talentnest/compendium | spec/presenters/chart_spec.rb | require 'spec_helper'
require 'compendium/presenters/chart'
describe Compendium::Presenters::Chart do
let(:template) { double('Template', protect_against_forgery?: false, request_forgery_protection_token: :authenticity_token, form_authenticity_token: "<KEY>").as_null_object }
let(:query) { double('Query', name: 't... |
talentnest/compendium | lib/compendium/open_hash.rb | <gh_stars>0
require 'active_support/hash_with_indifferent_access'
module Compendium
class OpenHash < ::ActiveSupport::HashWithIndifferentAccess
class << self
def [](hash = {})
new(hash)
end
end
def dup
self.class.new(self)
end
protected
def convert_value(value)
... |
talentnest/compendium | lib/compendium/engine/mount.rb | module ActionDispatch
module Routing
class Mapper
class ExportRouter
def matches?(request)
request.params[:export].present?
end
end
def mount_compendium(options = {})
scope options[:at], controller: options.fetch(:controller, 'compendium/reports'), as: 'compend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.