text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe MailUp::Console::Group do
before(:each) { init_mailup }
%w(add_recipients recipients subscribe unsubscribe send_message).each do |method|
it "should have a #{method} method" do
@mailup.console.group(1).should respond_to(method.to_sym)
end
end
it "should fire the c... |
require_relative './game_team'
require_relative './game'
require_relative './team'
require_relative './game_statistics'
require_relative './season_statistics'
require_relative './league_statistics'
require_relative './team_statistics'
class StatTracker
include GameStatistics
include SeasonStatistics
include Leag... |
require "fog/google"
module CustomPatch
def initialize(options = {})
shared_initialize(options[:google_project], Fog::Storage::GoogleJSON::GOOGLE_STORAGE_JSON_API_VERSION, Fog::Storage::GoogleJSON::GOOGLE_STORAGE_JSON_BASE_URL)
options[:google_api_scope_url] = Fog::Storage::GoogleJSON::GOOGLE_STORAGE_JSON_AP... |
class List < ActiveRecord::Base
self.primary_key = :list_item_id
belongs_to :list_item
belongs_to :superinformation, class_name: :BasicInformation
validates :ordinal, uniqueness: { scope: :superinformation }
before_validation :next_ordinal, on: :create
after_destroy ->(record){ order_after_destroy reco... |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
module FoobarWithoutChek
def self.piyo
"piyopiyo"
end
end
|
require "nice_enum"
require "test/unit"
class HashcodeTest < Test::Unit::TestCase
VALUE = 18505
HASH = VALUE.hash
class Enumeration < Enum
enum :Value, VALUE
end
def test_hashcode_is_underlying_hash
assert_equal HASH, Enumeration::Value.hash
end
def test_hashcode_from_constructor
value = Enumeration... |
class Pet
attr_accessor :name, :species
def initialize name; species
@name = name
@species = 'dog'
@watch_cases = [' is pulling onto the scarf.', ' is eating a water-melon, which is unbelievable.', ' always used to be near you, but then got out of you sight. Bye,']
@stuff_in_belly = 10
@photo_... |
Recaptcha.configure do |config|
config.site_key = Rails.application.credentials.recapcha[:recapcha_public_key]
config.secret_key = Rails.application.credentials.recapcha[:recapcha_private_key]
end |
#Problem 2: You have array of integers. Write a recursive solution to determine
#whether or not the array contains a specific value.
def includes?(array, target)
return false if array.empty?
return true if array.first == target
includes?(array.drop(1), target)
end |
class Course < ApplicationRecord
#contient plusieurs lessons
has_many :lessons
end
|
require 'digest/sha2'
class User < ActiveRecord::Base
before_save :encrypt_password
attr_accessor :password
attr_accessible :email, :username, :password, :password_confirmation
validates :username, :presence => true, :length => { :minimum => 3 }
validates :email, :format => /@/
validates :password, :... |
# Add a box to the admin dashboard to see site stats at a glance
Ansuz::PluginManagerInstance.register_admin_dashboard_box("At a Glance", 'admin/default_dashboard_boxes/at_a_glance')
# Register an At-a-Glance entry for number of pages, page comments.
Ansuz::PluginManagerInstance.register_at_a_glance_statistic "Pages",... |
class Inquiry < ApplicationRecord
include ActiveModel::Model #ここでActiveModelを読み込んで、DBと繋がらないモデルとしている
attr_accessor :name, :organization, :telephone, :email, :message #持ち回り情報
validates :name, :presence => {:message => '氏名を入力してください'}
validates :email, :presence => {:message => 'メールアドレスを入力してください'}
validates :me... |
require "mechanize_clip/version"
require "tempfile"
require "mechanize"
module MechanizeClip
# Tempfiles capatible with paperclip
class PageTmpFile < Tempfile
attr :content_type
attr :page
def initialize page
@page = page
ext = File.extname(self.original_filename)
name = File.ba... |
require_relative 'invalid_route'
module Rough
class Route
attr_reader :route
def initialize(route)
@route = route
end
def path
@path ||= load_path
end
def request_method
@request_method ||= load_request_method
end
private
def load_request_method
meth... |
require 'spec_helper'
describe GroupBuzz::EmailBodyProcessor do
DEFAULT_TOPIC_LINK = "http://indyhall.groupbuzz.io/topics/16997-next-week-is-member-photo-week/"
context "removal" do
it "should not strip out the GB message header if it is not there" do
original = "\r\n\r\nThis is the first real sentenc... |
# DISCLAIMER: OK, this is 100% ADOPTED FOR THE GIVEN INPUT CASES SOLUTION
# WHICH TAKES INTO A COUNT THAT BOTH RULE 42 AND RULE 31 PRODUCES LISTS OF
# 8-CHARS WORDS
# I am not proud of this, but it solves the daily story. Also, the story
# explicitly says:
#
# Remember, you only need to handle the rules you have; bui... |
require_relative 'journey'
class JourneyLog
attr_reader :journeys, :entry_station, :exit_station
def initialize
@entry_station = nil
@exit_station = nil
@journeys = []
end
def touch_in(station)
@entry_station = @ent_journey
end
def touch_out(station)
@exit_station = @ex_journey
@j... |
class CreateAwards < ActiveRecord::Migration
def change
create_table :awards do |t|
t.string :award_name
t.string :award_recipient
t.integer :award_count, default: 1
t.references :travel_conference
t.references :category
t.boolean :is_active, default: true
t.timestamps n... |
::SearchController
class SearchController
def search
@repo_id = params.fetch(:rid, nil)
repo_url = "/repositories/#{@repo_id}"
@base_search = @repo_id ? "#{repo_url}/search?" : '/search?'
fallback_location = @repo_id ? app_prefix(repo_url) : app_prefix('/search?reset=true');
@new_search = fallbac... |
control "M-1.8" do
title "1.8 Ensure auditing is configured for Docker files and directories
docker.service (Scored)"
desc "
Audit docker.service, if applicable.
Apart from auditing your regular Linux file system and system calls, audit
all Docker
related files and directories. Docker daemon runs with ... |
require_relative '../automated_init'
context "Output" do
context "Skip Test" do
context "Title" do
output = Output.new
output.writer.enable_styling!
output.writer.indentation_depth = 1
output.skip_test("Some test")
test "Title is indented and written in yellow" do
assert(... |
require "danbooru/model/forum_post"
require "fumimi/model"
class Fumimi::Model::ForumPost < Danbooru::Model::ForumPost
include Fumimi::Model
def self.render_forum_posts(channel, forum_posts, booru)
creator_ids = forum_posts.map(&:creator_id).join(",")
users = booru.users.each("search[id]": creator_ids).in... |
module CDI
module V1
class InstitutionUserSerializer < SimpleInstitutionUserSerializer
attributes :user
def user
SimpleUserSerializer.new(object.user)
end
end
end
end
|
require 'spec_helper'
describe "Portfolios" do
describe "Add a portfolio" do
describe "failure" do
it "should not add a new portfolio" do
lambda do
visit new_portfolio_path
fill_in "Name", :with => ""
fill_in "Classification", :with => ""
click_button
response.should rende... |
class CreateCrimes < ActiveRecord::Migration[6.0]
def change
create_table :crimes do |t|
t.string :title
t.string :labels
t.string :place
t.string :description
t.timestamps
end
end
end
|
require 'antlr4/runtime/writable_token'
require 'antlr4/runtime/token_stream'
module Antlr4::Runtime
class BufferedTokenStream < TokenStream
def initialize(token_source)
raise NilPointerException, 'token_source cannot be nil' if token_source.nil?
@token_source = token_source
@tokens = []
... |
class InterimAttestationsController < ApplicationController
# GET /interim_attestations
# GET /interim_attestations.json
def index
@interim_attestations = InterimAttestation.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @interim_attestations }
end
en... |
require 'spec_helper'
describe 'LD4L::OreRDF::AddAggregatedResources' do
subject { LD4L::OreRDF::CreateAggregation.call(
title: "Test Title",
description: "Test description of aggregation.",
owner: LD4L::FoafRDF::Person.new("http://vivo.cornell.edu/individual/JohnSmith")) }
describe... |
require 'spec_helper'
describe Transaction do
subject { build(:transaction) }
it { should be_valid }
let(:transaction){ build(:transaction)}
describe "validations" do
it "should require a source account" do
build(:transaction, :account_from => nil).should_not be_valid
end
it "should req... |
module Api
class TestSetsController < ApplicationController
skip_filter :set_current_user_and_project, :apply_currents, :clean_data
http_basic_authenticate_with name: "admin", password: "secret"
# Method: GET
# Ex: curl localhost:3000/api/projects/11/test_sets -u "admin:secret"
# Returns JSON... |
# frozen_string_literal: true
require "test_helper"
class Ractor::LVarTest < Test::Unit::TestCase
test "VERSION" do
assert do
::Ractor::LVar.const_defined?(:VERSION)
end
end
test 'Ractor::LVar can has a value' do
lv = Ractor::LVar.new{ 42 }
assert_equal 42, lv.ractor_local_value
end
... |
class Judge::Problem
attr_reader :id, :input_file_name, :output_file_name, :fspath, :time_limit, :memory_limit
def initialize(problem)
@input_file_name = problem.input_file
@output_file_name = problem.output_file
@check_method = problem.check_method
@time_limit = problem.time_limit
@memory_l... |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all
protect_from_forgery :secret => "1OlbmzDdcwfiYKxfeAKnDq4WTglo3BpvC3OR581UnzOvkGGnwDozG6HiPP3tZUJN... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
load 'repo/boxes.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# vagrant-berkshelf hijacks cookbooks_path
#config.berkshelf.enabled = false
# va... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Formatters
class TimespanFormatter < Formatter
def format(tokens, number, options = {})
tokens.map(&:value).join.gsub(/\{[0-9]\}/, number.abs.to_s)
end
end
end
end |
module Alipay
module Return
def self.verify?(params, options = {})
params = Utils.stringify_keys(params)
pid = options[:pid] || Alipay.pid
Sign.verify?(params, options)
end
end
end
|
class AddImageUrlToMovies < ActiveRecord::Migration[5.2]
def change
add_column :movies, :image_url, :string, null: false
add_column :movies, :video_url, :string, null: false
end
end
|
#
# Copyright 2013, Holger Amann <holger@fehu.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
class ChangeKToNameInDataChildren < ActiveRecord::Migration[5.1]
def change
rename_column :data_children, :k, :name
end
end
|
require 'rails_helper'
RSpec.describe ReportMailer do
it "sends a standard message" do
r = described_class.msg(to: "test@example.com", subject: "test email", message: "This is the body text")
expect(r.to).to eq(["test@example.com"])
expect(r.subject).to eq("test email")
expect(r.body.raw_source).to e... |
RSpec.describe Hanami::Action do
describe '.after' do
it 'invokes the method(s) from the given symbol(s) after the action is run' do
action = AfterMethodAction.new
action.call({})
expect(action.egg).to eq('gE!g')
expect(action.logger.join(' ')).to eq('Mrs. Jane Dixit')
end
it 'in... |
class RecipesController < ApplicationController
before_action :find_recipe, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, expect: [:show]
require 'nokogiri'
require 'open-uri'
# TODO: I would extract this to a separate file and call it from here. This is such an im... |
require 'rails_helper'
RSpec.describe Item, type: :model do
describe 'associations' do
it { should have_and_belong_to_many(:menus) }
it { should have_many(:orders).through(:item_orders) }
end
describe 'validations' do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:c... |
class UserOrder
include ActiveModel::Model
attr_accessor :post_number, :sender_id, :municipality , :building_name,:address, :phone_number, :user_id, :item_id, :order_id, :token
with_options presence: true do
validates :post_number, format:{with:/\A\d{3}[-]\d{4}\z/}
validates :sender_id
validates... |
require 'sqlite3'
$database = SQLite3::Database.new '../lib/data/seed-data.db'
$database.results_as_hash = true
def update_given_name_sum_count
sexes = %w(M F)
sexes.each do |sex|
get_rows = <<-SQL
select * from given_names where sex = ?
SQL
put_count_to = <<-SQL
update given_names set co... |
class Drink < ActiveRecord::Base
has_and_belongs_to_many :ingredients
belongs_to :user
end |
require 'fileutils'
require 'singleton'
class MyApp
class Clean
include Singleton
def task
FileUtils.rm_rf(Dir.glob(MyApp.instance.get_release_path + '/*'))
FileUtils.touch MyApp.instance.get_release_path + '/.gitkeep'
puts '=== release directory cleaned ==='
end
end
end
|
class BasicPartyInfo < ApplicationRecord
belongs_to :party, optional: true
belongs_to :attorney, optional: true
validates :first_name, presence: true
validates :last_name, presence: true
end |
define :verify_java do
ohai "reload" do
action :reload
end
ruby_block "verify java for #{params[:name]}" do
block do
# check java dependency
unless node[:languages][:java] && node[:languages][:java][:version].start_with?('1.6', '1.7')
Chef::Application.fatal!("The New Relic #{params[:n... |
# coding: utf-8
# require 'erb'
# require 'type_map.rb'
# require 'CppHelper.rb'
# require 'CppIntValueGenerator.rb'
# require 'CppStringValueGenerator.rb'
# require 'pathname'
module CodegenLib::YamlToIni
class CppGenerator
include CppHelper
include TypeResolver
def initialize
@self_path = F... |
class SvtplayDl < Formula
include Language::Python::Virtualenv
desc "Download videos from https://www.svtplay.se/"
homepage "https://svtplay-dl.se/"
url "https://files.pythonhosted.org/packages/6a/24/02d3d89cd4bd4677859df5c1101a5bb55a96ea3ff080c7a74e232e604758/svtplay-dl-2.7.tar.gz"
sha256 "2f0534cf237011a20... |
require 'spec_helper'
describe 'Doctor' do
it 'is initialized with a name' do
test_doctor = Doctor.new('Joe')
end
it 'starts off with no doctors' do
Doctor.all.should eq []
end
describe 'save' do
it 'saves a new doctor to the database' do
test_doctor = Doctor.new('Dr. Con')
test_doc... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
describe "Authorization Model" do
let(:account) { Account.create(:name => "John", :surname => "Doe",
:email => "john@doe.com", :password => "john",
:password_confirmation => "john", :role =>... |
# frozen_string_literal: true
module Tar
VERSION = "0.1.0"
end
|
class OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
# GET /orders
# GET /orders.json
def index
if current_user.product_name == 'gold'
redirect_to root_path
end
@order = Order.new
end
# GET /o... |
require "rails_helper"
describe UserMailer, :type => :mailer do
describe '#notify_subscribers' do
let!(:subscriber_one) { Subscriber.create!(email: 'user@example.com', registration_completed: true) }
let!(:subscriber_two) { Subscriber.create!(email: 'user2@example.com', registration_completed: true) }
le... |
class AddOAuthRefreshTokenAndAccessTokenToMoocProviderUsers < ActiveRecord::Migration
def change
remove_column(:mooc_provider_users, :authentication_token)
add_column(:mooc_provider_users, :refresh_token, :string)
add_column(:mooc_provider_users, :access_token, :string)
add_column(:mooc_provider_users... |
class HomeController < ApplicationController
def index
@categories = Category.public.where depth: nil
end
end
|
require "spec_helper"
describe User, "password" do
subject(:user){
User.new({
:name => "John",
:email => "John@gmail.com",
:password => "teste",
:password_confirmation => "teste"
})
}
it "cleans password after saving user" do
user.save!
expect(user.password).to be_nil
e... |
require File.dirname(__FILE__) + '/test_helper.rb'
class MyTestClass
include WDDX
attr_accessor :test
def initialize
@test = "Klaus Tester"
end
end
class AnotherClass < MyTestClass
def initialize
super
@name = "Stefan Saasen"
end
end
class MyObject2
include WDDX
attr_accessor :name, :v... |
class ItemsController < ApplicationController
before_action :authenticate!, except: [:index]
before_action :authenticate_admin!, only: [:new, :create, :update, :destroy]
# GET /Items
def index
@auction = Auction.find(params[:auction_id])
@items = @auction.items
end
# GET /Items/1
def show
@... |
class AddUseOnRuAndUseOnComToBoatTypes < ActiveRecord::Migration[5.0]
def change
add_column :boat_types, :use_on_ru, :boolean, default: true
add_column :boat_types, :use_on_com, :boolean, default: false
end
end
|
require 'time'
require 'bigdecimal'
class Item
attr_accessor :id,
:name,
:description,
:unit_price,
:created_at,
:updated_at,
:merchant_id
def initialize(hash)
@id = hash[:id].to_i
@name = hash[:name]
@desc... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
before... |
json.comments @comments.each do |comment|
json.body comment.body
json.author comment.author.username
json.date comment.created_at
json.profile_pic asset_path(comment.author.image.url(:avatar))
end
|
require 'knife-pkg'
require 'knife-pkg/controllers/apt'
include Knife::Pkg
describe 'AptPackageController' do
describe '#new' do
it 'should create an instance of AptPkgCtrl' do
p = AptPackageController.new('a', 'b', :h => 1)
expect(p).to be_an_instance_of(AptPackageController)
expect(p.node).t... |
FactoryGirl.define do
factory :post do |f|
f.title { Faker::Lorem.word }
f.body { Faker::Lorem.sentence }
end
factory :invalid_post, parent: :post do |f|
f.title nil
end
end |
class AddDefaultRateTypeToActivities < ActiveRecord::Migration[6.1]
def change
change_column_default :contracts, :rate_type, 0
end
end
|
class ChecklistsController < ApplicationController
before_filter :must_be_logged_in
def create
@checklist = Checklist.new(params[:checklist])
@checklist.card_id = params[:card_id]
if @checklist.save
render json: @checklist
else
render json: { errors: @checklist.errors.full_messages },... |
# frozen_string_literal: true
module BraintreeHelper
# This module defines no public methods.
def _; end
private
def braintree_enabled?
ENV['ENABLE_BRAINTREE'] == 'enabled' ||
current_user.id.in?(ENV['ENABLE_BRAINTREE'].split(',').map(&:to_i))
end
def transaction_details
@token = clean_param... |
module JackCompiler
module Parser
module VisitorTestHelper
def self.build_variable(kind)
JackCompiler::Parser::Node::Variable.new(
kind
)
end
def self.build_terminal(kind, value, source_location: 123)
JackCompiler::Parser::Node::Terminal.new(
kind,
... |
require 'spec_helper'
feature "Creating comments" do
let!(:user) { FactoryGirl.create(:user) }
let!(:activity) { FactoryGirl.create(:activity) }
let!(:folder) { FactoryGirl.create(:folder, :activity => activity, :user => user) }
before do
define_permission!(user, "view", activity)
define_permission!(u... |
class ChallengesController < ApplicationController
skip_before_action :authenticate_user!, only: [:index]
before_action :set_recipe, only: [:show]
def index
@challenges = Challenge.all
end
def show
end
private
def set_recipe
@challenge = Challenge.find(params[:id])
end
end
|
# frozen_string_literal: true
class FriendshipRequestController < ApplicationController
def index
@friendship_request = current_user.friend_requests
end
def create
@friendship_request = Friendships.new(friendship_params)
@friendship_request.user_id = current_user.id
if friendship_request.save
... |
#
# Copyright (C) 2017 ThatNameGroup, LLC. and Al Piepho
# All Rights Reserved
#
require './gc_common'
require './gc_appearences'
class InningHalf
def initialize(xml_elements)
@inning_half_str = xml_elements[0].text
@appearences = Appearences.new(xml_elements)
end
def displ... |
class InquiryMailer < ApplicationMailer
def send_mail(inquiry)
@inquiry = inquiry
mail(
from:'system@example.com',
to: 'minnanotool@gmail.com',
subject: 'メール内容')
end
end
|
require 'rails_helper'
RSpec.describe Link, type: :model do
it 'should only accept a valid url' do
link = Link.new(title: "Cats", url: "www.reddit")
expect(link).to be_invalid
end
it 'should have a url' do
link = Link.new(title: "Cats")
expect(link).to be_invalid
end
it 'should have a tit... |
RtdRailsApp::Application.routes.draw do
# home routes
get "home/index"
get "home/about"
get "home/events"
get "home/registration"
get "home/social"
get "home/press"
get "home/contact"
resources :events
resources :users
resources :sessions
# root route
root 'home#index'
end
|
require_relative '../../../../spec_helper'
describe "collectd::plugin::elasticsearch", :type => :class do
let(:pre_condition) { 'Collectd::Plugin <||>' }
let(:params){ {
:es_port => 4242,
:log_index_type_count => {
'test_index' => ['type_1',]
}
} }
it 'Includes the correct resources' do
... |
class Order < ApplicationRecord
# behaviours
include Unique
# associations
belongs_to :user
belongs_to :product
# attributes
attr_accessor :product_uuid
# validations
validates :product_uuid, presence: true, length: { is: 36 }
validates :price, numericality: { greater_than: 0 }
validates :quant... |
class TrackingEvent < ActiveRecord::Base
include Accessable
belongs_to :enrolled_learning_track
belongs_to :presentation_slide
alias :slide :presentation_slide
# REVIEW: This will create a huge impact in database
# has_one :origin, as: :originable
has_one :user, through: :enrolled_learning_track
ha... |
# Build a class Phone that takes phone "brand" and "type" as parameters.
#
# Add two methods: call
# Add two private methods: connect to internet
class Phones
def initialize(brand, type)
@brand, @type = brand, type
@contact = ""
end
def call(contact)
if @contact == contact
puts "Already connec... |
# frozen_string_literal: true
class GithubScore
SCORING_PARAMS = {
'IssuesEvent' => 1,
'IssueCommentEvent' => 2,
'PushEvent' => 3,
'PullRequestReviewCommentEvent' => 4,
'WatchEvent' => 5,
'CreateEvent' => 6
}.freeze
def initialize(handle)
@handle = handle
end
def compute
eve... |
class SessionsController < ApplicationController
def new
end
def create
admin = Admin.find_by(email: params[:session][:email].downcase)
if admin && admin.authenticate(params[:session][:password])
flash[:secondary] = "Welcome back!"
log_admin(admin)
#params[:session][:remember_me] == '1'... |
require 'digest/md5'
module Ipizza::Provider
class Nordea::PaymentResponse < Ipizza::PaymentResponse
def initialize(params)
@params = params
end
def verify(key_path)
key = File.read(key_path)
@valid = @params['RETURN_MAC'] == Digest::MD5.hexdigest(mac_data_string(key)).upcase
... |
module Pading
module Actionview
PARAM_KEY_BLACKLIST = [:authenticity_token, :commit, :utf8, :_method, :script_name].freeze
class Tag
def initialize(template, params: {}, theme: nil, views_prefix: nil, **options)
@template, @theme, @views_prefix, @options = template... |
class Invoice < ApplicationRecord
belongs_to :customer
belongs_to :merchant
has_many :transactions
has_many :invoice_items, dependent: :destroy
has_many :items, through: :invoice_items
has_many :merchants, through: :items
end
|
class DestroyGenreView
def render(genre)
if genre.nil?
view = GenreNotFound.new
view.render
else
genre.delete
puts "You have deleted #{genre.name} from your database"
end
end
end |
require './spec/spec_helper.rb'
describe 'Flashing Numbers Test' do
self.use_transactional_fixtures = false
before :all do
ensure_server_is_running
DatabaseCleaner.clean
end
after :all do
DatabaseCleaner.clean
end
describe 'Reading Test' do
before :all do
@english = Language.crea... |
module Exchanges
module Kucoin
extend ExchangeMethods
extend self
def configured?
!!(settings["api_key"] && settings["api_secret"])
end
def client
raise "Kucoin not configured in config/exchanges.yml" unless configured?
require 'kucoin_ruby'
KucoinRuby::Net.config({api_ke... |
def noon_months_ago_utc(months)
to_noon = {:hour => 12, :min => 0, :sec => 0}
months.to_i.months.ago.change(to_noon).utc
end |
require 'ostruct'
# A LigerEngine Processing Strategy is responsible for taking
# an array of Pubmed IDs
#
# It must implement the instance method +process+, which accepts a
# query String and returns an array of Integer Pubmed IDs
module LigerEngine
module ProcessingStrategies
# This is a Composite for generat... |
require "pry"
module CodeChamp
class GitHub
include HTTParty
base_uri "https://api.github.com"
def initialize(oauth_token)
@headers = {
"Authorization" => "token #{oauth_token}",
"User-Agent" => "HTTParty"
}
end
def get_contributions(org, repo)
response = Gi... |
# == Schema Information
#
# Table name: answers
#
# id :integer not null, primary key
# content :string(255)
# question_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# is_correct :boolean default(FALSE)
#
class Answer < ActiveRecord:... |
require 'boris/profiler_core'
module Boris; module Profilers
class BrocadeFOSCore
include ProfilerCore
def self.connection_type
Boris::SSHConnector
end
def switchshow_data
@switchshow_data ||= @connector.values_at('switchshow')
end
def version_data
@version_data ||= @... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :rest do
report
location "MyString"
latitude 1.5
longitude 1.5
address "MyString"
started_at "2013-03-12 11:26:00"
ended_at "2013-03-12 11:26:00"
deleted_at nil
end
end
|
require "weixin_api"
class BirthdayPartiesController < ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :set_birthday_party, only: :show
def index
@birthday_parties = current_user.birthday_parties
.order(id: :desc)
.page(params[:page])
.per(params[:pe... |
require 'spec_helper'
describe 'ovn::northd' do
shared_examples_for 'ovn northd' do
it 'includes params' do
is_expected.to contain_class('ovn::params')
end
it 'starts northd' do
is_expected.to contain_service('northd').with(
:ensure => true,
:name => platform_params[... |
# vim: tabstop=2:shiftwidth=2:softtabstop=2
#
# Cookbook Name:: bcpc-hadoop
# Recipe:: disks
#
# Copyright 2014-2016, Bloomberg Finance L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.