text stringlengths 10 2.61M |
|---|
require 'archive/zip'
require 'optparse'
require 'fileutils'
require_relative '../lib/init'
require_relative '../lib/status'
require_relative '../lib/log'
require_relative '../lib/sync_ftp'
$YAVS_VERSION = 'v0.20'
module YAVS
def self.exist?
File.directory? '.yavs'
end
def self.lock
FileUtils.touch '.... |
class ChangeTo0Default < ActiveRecord::Migration
def change
change_column :products, :shipping, :integer, default: 0
end
end
|
require "rails_helper"
describe User, type: :model do
it { should validate_presence_of :username }
it { should validate_presence_of :email }
it { should validate_presence_of :password }
it { should validate_uniqueness_of :email }
it { should validate_length_of(:password).is_at_least(8) }
describe "access... |
class Admin::AdminController < ApplicationController
before_filter :require_user
filter_access_to :all
def index
@games = Game.find(:all, :order => :title )
end
protected
def permission_denied
flash[:error] = "You don't have permission to access that page"
re... |
# The owner name associated with a specific AwardWalletAccount.
#
# Every AwardWalletAccount has an 'owner', which can either be a 'user' (a
# fully-fledged login account on AW.com, which we represent with the
# `AwardWalletUser` class) or a 'member' (just a name which the user adds on
# their AW dashboard.)
#
# 'owner... |
class LetterFrequency
FREQUENCIES = {
'a' => 8.2,
'b' => 1.5,
'c' => 2.8,
'd' => 4.3,
'e' => 12.7,
'f' => 2.2,
'g' => 2.0,
'h' => 6.1,
'i' => 7.0,
'j' => 0.2,
'k' => 0.8,
'l' => 4.0,
'm' => 2.4,
'n' => 6.7,
'o' => 7.5,
'p' => 1.9,
'q' => 0.1,
'r... |
module Enumerable
def accumulate
[].tap do |accumulated|
each { |a| accumulated << yield(a) }
end
end
end
|
RSpec.describe 'api/users/slots', type: :request do
path '/api/users/slots' do
get 'Slots' do
tags 'Slots'
consumes 'application/json'
security [Bearer: {}]
response '200', 'Slots' do
let(:slot) { { doctor_id: 10, user_id: 10} }
run_test!
end
response '422', 'i... |
namespace :lapis do
task :docs do
abort "E: The current environment is `#{Rails.env}`. Please run CheckAPI in `test` mode to generate the documentation" unless Rails.env.test?
puts %x(cd doc && make clean && make && cd -)
puts 'Check the documentation under doc/:'
puts '- Licenses'
puts '- API end... |
module Defaults
@@defaults = {}
def self.defaults
@@defaults
end
def self.included(klazz)
klazz.extend(ClassMethods)
end
def load_defaults
@@defaults.each do |klazz, local_defaults|
if self.kind_of? klazz
local_defaults.each do |default|
attribute = default[:attribute]... |
class Item < ActiveRecord::Base
belongs_to :restaurant
belongs_to :category
validates :category, presence: true
end
|
class AddDefaultSortAndViewToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :sort, :string, null: false, default: "default"
add_column :users, :view, :string, null: false, default: "default"
end
end
|
module Boxzooka
class ShipmentBillingListResponseBill < BaseElement
# Date/Time the Bill data was received.
scalar :bill_date, type: :datetime
# Weight used to calculate billing, generally based on whichever is
# greater between GravitionalWeight and DimensionalWeight
scalar :chargeable_weight, t... |
module BlacklightDpla
class SolrDoc
def self.index_docs_from_response(response)
response['docs'].each do |doc|
solr_doc = BlacklightDpla::SolrDoc.from_response_doc doc
pp solr_doc
pp Blacklight.solr.add solr_doc
end
pp Blacklight.solr.commit
end
def self... |
class Api::BaseController < ActionController::Base
before_action :set_cors_headers
# skip_before_action :verify_authenticity_token
private
def set_cors_headers
response.set_header "Access-Control-Allow-Origin", origin
end
def origin
request.headers["Origin"] || "*"
... |
class Comment < ActiveRecord::Base
bad_attribute_names :changed
has_many :field_data_comment_bodies, :foreign_key => 'entity_id', :order => 'entity_id DESC'
def last_modified
attributes['changed']
end
def body
data.comment_body_value unless data.nil?
end
def body_format
d = data
... |
require 'json'
MyApp.add_route('GET', '/search', {
"resourcePath" => "/Default",
"summary" => "",
"nickname" => "search_get",
"responseClass" => "void",
"endpoint" => "/search",
"notes" => "e.g. /search?q=query-words",
"parameters" => [
{
"name" => "q",
"description" => "",
"data... |
require 'net/http'
require 'kafka_rest/event_emitter'
require 'kafka_rest/logging'
require 'kafka_rest/producable'
require 'kafka_rest/broker'
require 'kafka_rest/client'
require 'kafka_rest/consumer'
require 'kafka_rest/consumer_instance'
require 'kafka_rest/consumer_stream'
require 'kafka_rest/partition'
require 'k... |
class CreateShifts < ActiveRecord::Migration[6.0]
def change
create_table :shifts do |t|
t.string :shift_staff, nill: false
t.datetime :start_time
t.datetime :stop_time
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end
|
require 'test_helper'
require 'wsdl_mapper/type_mapping/string'
module TypeMappingTests
class StringTest < ::WsdlMapperTesting::Test
include WsdlMapper::TypeMapping
def test_to_ruby
assert_equal 'foo', String.to_ruby('foo')
end
def test_to_xml
assert_equal 'foo', String.to_xml('foo')
... |
class ClientsController < ApplicationController
def index
@clients = Client.all.reverse
end
def new
@new_client = Client.new
end
def create
@new_client = Client.create(client_params)
if @new_client.save
redirect_to root_path
else
render... |
class Admin::PostsController < Admin::ApplicationController
uses_tiny_mce :only => [:new, :create, :edit, :update]
make_resourceful do
actions :all
end
private
def current_object
@current_object ||= current_model.find_by_permalink(params[:id])
end
def current_objects
@current_objects ||= ... |
require "rails_helper"
describe "Counts Query API", :graphql do
describe "counts" do
let(:query) do
<<-'GRAPHQL'
query {
counts {
missedCalls
unreadConversations
newVoicemails
}
}
GRAPHQL
end
it "returns counts" do
... |
class WorkersController < ApplicationController
before_action :authenticate_user!
def index
@workers = Worker.all
end
def skills_list
render json: Worker.find_name_by_match(params[:query])
end
def show
@worker = Worker.includes(:skills).where('users.id = ?', params[:id]).first
end
def sk... |
#digits- Returns the array inluding the digits extracted by place-value notation with radix base of int
p 12345.digits
puts".............."
p 12345.to_s.chars.map(&:to_i).reverse
puts "........."
p 234.digits(100) # setting base 100
puts"................"
#base should be greater than or equal to 2
puts "executing -3432... |
require 'mechanize'
require 'date'
module FCleaner
HOMEPAGE_URL = "https://m.facebook.com".freeze
LOGIN_URL = "#{HOMEPAGE_URL}/login.php".freeze
PROFILE_URL = "#{HOMEPAGE_URL}/profile.php".freeze
class ActivityLog
attr_reader :email, :pass
def initialize(email, pass)
@email = email.chomp
... |
require_relative 'db_connection'
require_relative '01_sql_object'
module Searchable
def where(params)
where_line = params.keys.map{ |col| "#{col} = ?"}.join(" AND ")
col_values = params.values
results = DBConnection.execute(<<-SQL, *col_values)
SELECT
*
FROM
#{self.table_name}... |
# coding: utf-8
require "spec_helper"
describe Rstt do
describe "module variables" do
describe "responds to .." do
it "should respond to :lang" do
Rstt.respond_to?(:lang).should be_true
end
it "should respond to :content" do
Rstt.respond_to?(:content).should be_true
e... |
class Resources::Catalog::ProductsController < ResourcesController
def show
opts = options :include => {:product => [:pros, :cons, :user_tags]}
order, limit = opts.delete(:order), opts.delete(:limit)
opts.delete :offset
@product = Restful::PartnerProduct.find_by_partner_key! params[:id], opts
... |
#Function that returns all mutants
def get_all_mutants()
request = API_URL + "mutants"
@response = RestClient.get request
#@parsed_response = JSON.parse(@response)
#puts @parsed_response
parse_mutant(@response)
#puts @response
return
end
#Function that returns mutant, given the id
def get_mutant(m_id)
... |
require './Point'
class List
def initialize
@l = []
end
def add (p)
i = 0
while (i < @l.length) && (@l[i].distance < p.distance())
i += 1
end
@l.insert(i, p)
end
def to_s
to_ret = '['
for ps in @l
to_ret += ' ' + ps.to_s
end
return (to_ret + ' ]')
en... |
class ArticlesController < ApplicationController
skip_before_action :require_login, only: [:show]
def show
@article = Article.find_by(id: params[:id])
@user = User.find_by(id: @article.user_id)
end
def new
@user = User.find_by(id: session[:user_id])
@article = Article.new
end
def create
... |
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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 requir... |
require File.dirname(__FILE__) + '/spec_helper'
describe Google do
before(:each) do
@abbr = Google::DidYouMean.new
end
it "should search google for did you mean" do
@abbr.check("exalty").should eql("exactly")
end
it "should split word seperated by underline and search on this seperate" do
@abb... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,:recoverable, :rememberable, :confirmable,:validatable
validates :first_name,:last_name,:presence=> true,:if... |
class CreateMessageThreadSubscriptions < ActiveRecord::Migration
def change
create_table :message_thread_subscriptions do |t|
t.references :user
t.references :thread
t.timestamps
end
add_index :message_thread_subscriptions, :user_id
add_index :message_thread_subscriptions, :thread_i... |
class AddRateToPhotos < ActiveRecord::Migration
def up
add_column :photos, :rate, :integer, default: 1 unless column_exists? :photos, :rate
end
def down
remove_column :photos, :rate if column_exists? :photos, :rate
end
end
|
require 'matrix'
require 'benchmark'
=begin
class Matrix2 < Array
def initialize(n)
createRandomMatrix(n)
end
def createRandomMatrix(n)
matrix = Array.new(n)
n.times do |i|
row = Array.new(n)
n.times do |j|
row[j-1] = Random.rand(99)
end
self.push row
end
end
... |
require "spec_helper"
require "rake"
load "./lib/tasks/paperclip.rake"
describe Rake do
context "calling `rake paperclip:refresh:thumbnails`" do
before do
rebuild_model
allow(Paperclip::Task).to receive(:obtain_class).and_return("Dummy")
@bogus_instance = Dummy.new
@bogus_instance.id = "s... |
class RemoveGameIdFromCards < ActiveRecord::Migration[5.2]
def change
remove_column :cards, :game_id
remove_column :cards, :hand_id
end
end
|
class MailSender < ActionMailer::Base
default from: 'from@example.com'
def inquiry(inquiry)
@inquiry = inquiry
mail to: inquiry.email
end
end
|
class Tweet
attr_accessor :content
attr_reader :username
ALL_TWEETS=[]
def initialize (username, content)
@username=username
@content=content
ALL_TWEETS << self
end
def self.all
ALL_TWEETS
end
end
|
require_relative '../spec_helper.rb'
describe Role do
subject { role }
describe "role" do
let(:role) { Role }
its(:admin) { should eq("Admin") }
its(:user) { should eq("User") }
its(:denied) { should eq("Denied") }
end
end
|
Vagrant.configure("2") do |config|
# Use "precise32" Ubuntu 10.4 box
config.vm.box = "hashicorp/precise32"
# Our app server will run on port 3000, so mirror that to the host
config.vm.network "forwarded_port", guest: 3000, host: 3000
# On boot, we need to install some dependencies and such
# More precise... |
class Grid::LockingColumn < Netzke::Basepack::Grid
def configure(c)
super
c.model = 'Book'
end
column :title do |c|
c.locked = true
end
end
|
class AddProxiesToSession < ActiveRecord::Migration
def self.up
add_column :sessions, :forwarded_for, :string, :limit => 100
end
def self.down
remove_column :sessions, :forwarded_for
end
end
|
class LinkedBus::Message
class Metadata
METADATA_MESSAGES = [
:routing_key,
:content_type,
:priority,
:headers,
:timestamp,
:type,
:delivery_tag,
:redelivered?,
:exchange
]
def initialize(data)
@metadata = data
end
def method_missing(m... |
# frozen_string_literal: true
require 'spec_helper'
# let these existing styles stand, rather than going in for a deep refactoring
# of these specs.
#
# possible future work: re-enable these one at a time and do the hard work of
# making them right.
#
# rubocop:disable RSpec/ContextWording, RSpec/VerifiedDoubles, RSp... |
RSpec.shared_examples "has transfer fields" do |transfer|
it { should belong_to(:source).class_name("Activity") }
it { should belong_to(:destination).class_name("Activity") }
describe "validations" do
it { should validate_presence_of(:source) }
it { should validate_presence_of(:destination) }
it { sh... |
class Comment < ApplicationRecord
belongs_to :user
belongs_to :commentable, polymorphic: true
has_many :comments, as: :commentable, dependent: :destroy
def self.by_recent
order("created_at DESC")
end
end
|
class CreateReviews < ActiveRecord::Migration
def change
create_table :reviews do |t|
t.text :review
t.integer :complaint_id
t.timestamps null: false
end
add_index :reviews, :complaint_id, using: :btree
end
end
|
require_relative 'fixed_array'
describe FixedArray do
describe "let" do
let(:fixedArray) { FixedArray.new(10) }
it "creates a new FixedArray of size 10" do
expect(fixedArray.size).to eq 10
end
it "raises an error if index is out of bounds for FixedArray#get" do
expect { fixedArray.get(... |
class LevelLoader
def initialize()
@levels = [
{
:name => 'Silver Heart',
:description => 'Silver Heart',
:amount_points_of_required => 10,
:image_url => '/images/levels/silver_heart.png'
},{
:name => 'Bronze Heart',
:description => 'Bronze Heart',
... |
class ErrorsController < ActionController::Base
# layout to show with your errors. make sure it's not that fancy because we're
# handling errors.
layout 'application'
def show
@exception = env['action_dispatch.exception']
@status = ActionDispatch::ExceptionWrapper.new(env, @exception).status_code
... |
# frozen_string_literal: true
# An addon to the String class to change the colour of the text
class String
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
end
# The class for displaying the chessboard
class ChessBoard
def initialize(initial_column, initial_row)
@knight = Knight.new(initial_... |
FactoryBot.define do
factory :article_1, class: Article do
record_id { '28142765' }
title { 'We migrated ToolJet server from Ruby to Node.js' }
url { 'https://blog.tooljet.io/how-we-migrated-tooljet' }
author { 'navaneethpk' }
points { 4 }
num_comments ... |
# frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
module Huobi
class Websocket < Faye::WebSocket::Client
class Error < StandardError; end
URL = 'wss://api.huobi.pro/ws'
PING = 3
def initialize
super URL, [], ping: PING
@request_id = 0
end
... |
class CreateTeachers < ActiveRecord::Migration[5.2]
def change
create_table :teachers do |t|
t.string :mynumber, null:false
t.string :name, null: false
t.text :research
t.timestamps
t.index :mynumber, unique:true
end
end
end
|
class Pirate
@@all = []
attr_accessor :name, :weight, :height
def initialize(args)
@name = args[:name]
@weight = args[:weight]
@height = args[:height]
@@all << self
end
def self.all
@@all
end
end
|
class Api::MetricsController < ApplicationController
# Fetch all metrics for a given company
def index
metrics = Metric.where(company_id: params[:company_id])
if metrics.blank?
render(
json: {
error: {
code: 404,
message: "No metrics found for company",
... |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
layout "standard"
skip_before_filter :require_login_for_non_rest
skip_before_filter :find_portal
# render new.rhtml
def new
end
def create
logout_keeping_session!
user = User... |
class Api::Merchant::RafflesController < Api::Merchant::BaseController
def create
@raffle = current_merchant.raffles.create(params[:raffle])
if @raffle.errors.blank?
render json: {status: 200, raffle: @raffle.attributes}
else
render json: {status: 205, message: @raffle.errors.full_messages}
... |
module Messenger
module Commands
module Chat
class ShowSettings < Clamp::Command
parameter '[chat_id]', 'chat id'
option %w(-f --force), :flag, 'ignore cache'
def execute
if force?
chat_id = @chat_id || chat_id
response = Messenger.app.api.show_cha... |
Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '12.0'
s.name = "MessageToolbar"
s.summary = "MessageToolbar is an elegant drop-in message toolbar for your chat modules."
s.requires_arc = true
s.version = "1.0.0"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Tarek Sabry" => "tareksa... |
require "rails_helper"
RSpec.describe Activity::GroupedActivitiesFetcher do
let(:user) { create(:beis_user) }
context "when the organisation is a service owner" do
let(:organisation) { create(:beis_organisation) }
it "groups all programmes by parent" do
fund = create(:fund_activity)
programme... |
module Idv
class ScanIdController < ScanIdBaseController
before_action :ensure_fully_authenticated_user_or_token
before_action :ensure_user_not_throttled, only: [:new]
USER_SESSION_FLOW_ID = 'idv/doc_auth_v2'.freeze
def new
SecureHeaders.append_content_security_policy_directives(request,
... |
describe Neo4j::ActiveNode::Initialize do
before do
stub_active_node_class('MyModel') do
property :name, type: String
end
end
describe '@attributes' do
let(:first_node) { MyModel.create(name: 'foo') }
let(:keys) { first_node.instance_variable_get(:@attributes).keys }
it 'sets @attribut... |
require 'spec_helper'
describe Immutable::Vector do
describe '#zip' do
let(:vector) { V[1,2,3,4] }
context 'with a block' do
it 'yields arrays of one corresponding element from each input sequence' do
result = []
vector.zip(['a', 'b', 'c', 'd']) { |obj| result << obj }
result.s... |
class Api::V1::SalonController < ApplicationController
skip_before_action :verify_authenticity_token
def index
salons = Salon.all
render json: salons, status:200
end
def show
salon = Salon.find(params[:id])
render json: salon, status:200
end
def create
@salon = Salon.new(salon_params)
... |
# To finish the installation, you need to call this script from domready. I haven't
# included that part for fear of conflicts.
#
# $(document).ready(function () {
# imgSizer.collate();
# });
after_bundler do
# Add fluid image script
get_vendor_javascript 'http://unstoppablerobotninja.com/demos/re... |
class AddFieldsToWelcomers < ActiveRecord::Migration
def change
add_column :welcomers, :first_name, :string
add_column :welcomers, :last_name, :string
end
end
|
require 'rest-client'
module RestClientHasher
class Requests
def self.post_json_to_url input_url, json_body
response = RestClient.post(input_url, json_body, :content_type => 'application/json')
response.code.should == 200
JSON.parse response.body
end
def self.put_json_to_u... |
module HandleObjectNotFound
extend ActiveSupport::Concern
def ensure_found_all_from_params(finder_class, finder_value)
raise Errors::ObjectNotFoundError.new(finder_value) unless params[finder_value].is_a?(Array)
array_of_ids = params[finder_value].map { |elem| elem[:id] }
finder_class.where(id: array... |
shared_examples_for 'a relation' do
describe '#respond_to?' do
it 'resolves associations' do
is_expected.to respond_to(:author)
end
end
describe '#association' do
it 'builds a table from the associated class' do
expect(table.association(:author)).to be_a(BabySqueel::Table)
end
it... |
require 'formula'
HOMEBREW_CTRD_BRANCH='runu-darwin-master-190607'
HOMEBREW_CTRD_VERSION='beta'
class Containerd < Formula
homepage 'https://github.com/ukontainer/containerd'
url 'https://github.com/ukontainer/containerd.git', :branch => HOMEBREW_CTRD_BRANCH
version "#{HOMEBREW_CTRD_BRANCH}-#{HOMEBREW_CTRD_VERSI... |
# frozen_string_literal: true
module ApplicationHelper
def display_style(flag)
flag ? 'display: none' : 'display: block'
end
end
|
require "spec_helper"
describe "Distributed Systems Learning" do
describe "a reading list" do
class DistributedSystems < ReadingList
name "Distributed Systems"
url "https://github.com/xoebus/reading-lists/tree/master/distributed-systems"
read? false
end
let(:reading_list) { DistributedSy... |
require 'pr_cleaner/version'
require 'io/console'
require 'octokit'
require 'pry'
module PrCleaner
extend self
def clear(repo:, pr_number:, username:)
each_comment_of(repo, pr_number) do |comment|
next unless comment[:user][:login] == username
client.delete_pull_request_comment(repo, comment[:id])... |
class BroFulfillmentMailer < ApplicationMailer
default from: "Bro Caps <brocaps@#{ENV['app_url']}>"
def shipping(fulfillment)
@fulfillment = fulfillment
@bro_order = @fulfillment.bro_order
@shipping_address = @fulfillment.shipping_address
@line_items = @fulfillment.line_items
... |
# ActiveRecord
########################################################
# ActiveRecord::Base.configurations = YAML.load_file('database.yml')
# ActiveRecord::Base.establish_connection(:development)
ActiveRecord::Base.establish_connection(
adapter: "postgresql",
database: ENV['DB_NAME2'],
host: "",
username: ENV[... |
class Product < ActiveRecord::Base
validates_presence_of :name, :legacy_id
has_many :orders, through: :order_details
end
|
class Comment < ApplicationRecord
belongs_to :commenter, class_name: "User"
belongs_to :commentable, polymorphic: true
validates :comment_content, presence: true, length: { minimum: 1 }
end
|
class CreateMovies < ActiveRecord::Migration[5.1]
def change
create_table :movies do |t|
t.integer :site, null: false
t.string :name, null: false
t.date :open
t.string :code, null: false
t.references :artist, foreign_key: true, null: false
t.integer :total_view, default: 0
... |
require "puppet/provider/package"
Puppet::Type.type(:package).provide(:homebrew, :parent => Puppet::Provider::Package) do
desc "Package management using Homebrew."
commands :brew => "brew"
has_feature :installable, :uninstallable, :versionable
def self.installed
brew(:list, "-v").split("\n").map { |line... |
class CreateEndecaRecordChanges < ActiveRecord::Migration
def self.up
create_table :endeca_record_changes do |t|
t.column :review_id, :bigint
t.column :product_id, :bigint
t.column :change, :enum, EndecaRecordChange::CHANGE_DB_OPTS
t.column :status, :enum, EndecaRecordChange::STATUS_... |
require "spec_helper"
describe ORS::Commands::Update do
context "#run" do
before do
ORS.config.parse_options([])
ORS.config.parse_config_file
end
it "should update code, bundle install, and set up cron" do
ORS.config[:all_servers] = :all_servers
ORS.config[:ruby_servers] = :ruby... |
class CubesController < ApplicationController
def index
@cubes = Cube.all
end
def show
@cube = Cube.find_by_serial params[:id]
@rooms = @cube.rooms
respond_to do |format|
format.html { render }
format.json { render json: @cube }
end
end
end |
file = File.join(Rails.root, 'config', "sidekiq-#{Rails.env}.yml")
file = File.join(Rails.root, 'config', 'sidekiq.yml') unless File.exist?(file)
require File.join(Rails.root, 'lib', 'middleware_sidekiq_server_retry')
require "sidekiq"
require "sidekiq/cloudwatchmetrics"
Sidekiq::Extensions.enable_delay!
# Only enabl... |
require("minitest/autorun")
require("minitest/rg")
require_relative("../extension_solution")
class TestLibrary < MiniTest::Test
def setup
@book1 = {
title: "lord_of_the_rings",
rental_details: {
student_name: "Jeff",
date: "01/12/18"
}
}
@book2 = {
title: "Harry... |
module Wikify
# Methods that get included on models using wikify
module Methods
# The Wikify update operation
#
# Creates a new version, records the cached object and saves it as an update
def wikify_update
new_version = self.send(wikify_options[:assoc_name]).new
new_version.data = @wiki... |
require 'spec_helper'
describe Revent::Providers::RabbitMQ do
describe '#initialize' do
subject { described_class.new }
it 'creates mocked connection' do
expect(subject.conn.class).to eq BunnyMock::Session
expect(subject.channel.class).to eq BunnyMock::Channel
expect(subject.queue.class).t... |
# encoding: utf-8
# содержится: String, Walls, Creation, Matrix
# SizeM = rand(15 .. 20)
SizeM = 15
class String
def black; "\033[30m#{self}\033[0m" end
def red; "\033[31m#{self}\033[0m" end
def green; "\033[32m#{self}\033[0m" end
def brown; "\033[33m#{self}\033[0m" end
d... |
require 'httparty'
require 'shopware/api/client/articles'
require 'shopware/api/client/categories'
require 'shopware/api/client/property_groups'
require 'shopware/api/client/variants'
module Shopware
module API
class Client
include HTTParty
headers 'Content-Type' => 'application/json', 'charset' =>... |
# frozen_string_literal: true
class ChangeResearcherToGlobalGuest < ActiveRecord::Migration[5.1]
def up
execute <<~SQL.squish
UPDATE roles
SET name = 'global_guest'
WHERE name = 'researcher' AND resource_id IS NULL
SQL
end
def down
execute <<~SQL.squish
UPDATE roles
SET... |
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... |
class SessionsController < ApplicationController
skip_before_action :verify_authenticity_token
def new
redirect_to site_root_url and return if current_merchant.present?
end
def create
merchant = Merchant.find_by_email(params[:email])
if merchant && merchant.authenticate(params[:password])
se... |
class CreateKingdomCitizens < ActiveRecord::Migration
def change
create_table :kingdom_citizens do |kc|
kc.integer :kingdom_id
kc.integer :citizen_id
end
end
end
|
class BidsController < ApplicationController
before_action :set_round, only: [:index, :create]
before_action :set_player, only: [:create]
def create
bid = Bid.new(
round: @round,
player: @player,
pass: bid_params[:pass],
number_of_tricks: bid_params[:number_of_tricks],
suit: bi... |
Rails.application.routes.draw do
resources :emergencies, only: [:create, :index, :patch]
resources :responders, only: [:create, :index, :patch]
match '*unmatched_route', to: 'application#render_not_found', via: :all
end
|
Rails.application.routes.draw do
devise_for :users, module: :users
get 'home/index'
get 'home/root'
get 'touring_routes/archives'
root to: "home#root"
resources :comments
resources :touring_routes
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.