text stringlengths 10 2.61M |
|---|
module IncludesIIDX
class DependenceSet
attr_accessor :deps
def initialize(combined)
@deps = {}
if combined.class.name != 'Array'
combined = [combined]
end
combined.each do |a|
case a.class.name
when 'Symbol'
@deps[a] = IncludesIIDX::DependenceSet.emp... |
#
# Cookbook Name:: composer
# Attributes:: default
#
# Copyright (c) 2016, David Joos
#
include_attribute 'php'
if node['platform'] == 'windows'
default['composer']['url'] = 'https://getcomposer.org/Composer-Setup.exe'
default['composer']['install_dir'] = 'C:\\ProgramData\\ComposerSetup'
default['composer']['b... |
class AddFieldsToSocialMediaPosts < ActiveRecord::Migration[5.2]
def change
add_column :social_media_posts, :posted_at, :date
add_column :social_media_posts, :uri, :string
end
end
|
require 'journey'
require 'station'
describe Journey do
context 'journey returns entry station ' do
it 'returns Baker Street when asked for entry station' do
subject.touch_in("Baker Street")
expect(subject.entry_station).to eq("Baker Street")
end
it 'returns Finsbury Park when asked for en... |
# range literal
letters = ('a'..'c')
# converting range to an array
puts(['a', 'b', 'c'] == letters.to_a)
# iterating over a range
('A'..'Z').each do |letter|
print letter
end
puts
god_bless_the_70s = 1970..1979
puts god_bless_the_70s.min
puts god_bless_the_70s.max
puts god_bless_the_70s.include?(1979)
puts god_... |
class User < ActiveRecord::Base
has_and_belongs_to_many :events
validates_presence_of :username
validates_uniqueness_of :username
validate :password_non_blank
def password
@password
end
def password=(pwd)
@password = pwd
return if pwd.blank?
create_new_salt
self.hashed_password =... |
class MembershipsController < ApplicationController
def create
@membership = current_user.memberships.build(:member_id => params[:member_id])
if @membership.save
flash[:notice] = "Successfully created membership."
redirect_to root_url
else
render :action => 'new'
end
end
def d... |
def oxford_comma(array)
result = ""
case array.size
when 0
result = ""
when 1
result = array.first
when 2
result = "#{array.first} and #{array.last}"
when 3
result = "#{array.first}, #{array[1]}, and #{array.last}"
else
arr_string = array.slice(0,array.size-1).join(", ")
result = "... |
class RemoveUnusedAttributesFromDiscounts < ActiveRecord::Migration[5.0]
def change
add_reference :discounts, :discount_type_period, index: true, null: false
add_foreign_key :discounts, :discount_type_periods
remove_column :discounts, :start_date, :datetime
remove_column :discounts, :end_date, :dateti... |
class RemoveCrossingFromAverage < ActiveRecord::Migration
def up
remove_column :averages, :location
remove_column :averages, :title
end
def down
add_column :averages, :title, :string
add_column :averages, :location, :string
end
end
|
require 'spec_helper'
describe 'iis::website' do
let :title do
'puppet.puppet.vm'
end
let :pre_condition do
'class { "iis": }'
end
context 'all defaults' do
let :facts do
{
kernel: 'windows',
os: { 'family' => 'windows' },
}
end
it do
is_expected.to ... |
require 'helper'
module CSSPool
module CSS
class TestSupportsRule < CSSPool::TestCase
def test_basic
doc = CSSPool.CSS <<-eocss
@supports ( display: flexbox ) {
body { display: flexbox; }
}
eocss
assert_equal 1, doc.supports_rules.size
assert... |
module Platforms
module Yammer
module Api
# Yammer's subscription (following) management
# @author Benjamin Elias
# @since 0.1.0
class Subscriptions < Base
# Check if the current user is subscribed to (following) another user
# @param id [#to_s] The ID of the User
... |
# Cached generated iCalendar entries, to speed up the feed generation
class IcalEntry < ActiveRecord::Base
belongs_to :task
belongs_to :work_log
end
|
# == Schema Information
#
# Table name: volunteers
#
# id :integer not null, primary key
# person_id :integer not null
# admission :date
# area_of_operation :string(255)
# created_at :datetime
# updated_at :datetime
#
class Volunteer < ApplicationRec... |
class ItemsController < ApplicationController
require 'payjp'
before_action :move_to_login, only: [:new, :edit]
before_action :items_list, only: [:sell_list,:buy_list]
before_action :set_item, only: [:edit, :update, :show, :purchase, :pay, :destroy]
before_action :set_likes_count, only: [:i... |
module Factory
class Vehicle
def turn_on
puts "Turn on the vehicle."
end
def move
puts "Moving..."
end
def stop
puts "Stopping."
end
end
end
car = Factory::Vehicle.new
car.turn_on
car.move
car.stop |
require './count_sentences'
describe String, "#count_sentences" do
it "should return the number of sentences in a string" do
"Hello! My name is Uzo, and it\'s a pleasure to meet you. What is your and where are you from????".count_sentences.should eq(3)
end
it "should return zero if there are no sentences ... |
Rails.application.routes.draw do
get 'password_reset/new'
get 'password_reset/edit'
get '/update_awards' => 'picks#update_awards', :as => 'update_awards'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contacts', to: 'contacts#new'
get '/signup', to: 'users... |
class Vote < ApplicationRecord
validates :user_id, :voteable_id, :voteable_type, presence: true
belongs_to :voteable, polymorphic: true, counter_cache: true
belongs_to :user
end
|
class Episode < ApplicationRecord
belongs_to :tv_show
has_many :episode_ratins, :dependent => :destroy
has_many :episode_comments, :dependent => :destroy
has_many :users, through: :episode_ratings
end
|
class Api::V1::Items::SearchController < ApplicationController
def show
item = if params[:name]
Item.find_item(params[:name])
elsif params[:min_price]
Item.min_price(params[:min_price])
elsif params[:max_price]
Item.max_price(params[:max_price])
elsif params[:min_price] && params[:ma... |
class Ingredient < ApplicationRecord
default_scope { order(created_at: :desc) }
has_many :inventories
belongs_to :ingredient_type
end
|
class ActivitySerializer < ActiveModel::Serializer
attributes :id, :name, :description
belongs_to :camp
end
|
class CreateAdminService
def call
user = User.find_or_initialize_by(email: Rails.application.secrets.admin_email)
user.password = Rails.application.secrets.admin_password
user.password_confirmation = Rails.application.secrets.admin_password
user.confirm unless user.confirmed?
user.add_to_role("adm... |
json.array!(@site_settings) do |site_setting|
json.extract! site_setting, :id, :name, :value, :description
json.url admin_site_setting_url(site_setting, format: :json)
end
|
desc "Remove unconfirmed subscriptions"
task :remove_unconfirmed => :environment do
Subscription.where(confirmed: false).where("created_at < ?", Date.today-3.days).destroy_all
end |
# frozen_string_literal: true
require 'fun/helpers'
require 'fun/just'
require 'fun/nothing'
module FUN
class Maybe
class << self
include Helpers
def from_nil
lambda { |value|
(is_defined?.call(value) ? Just : Nothing).of(value)
}
end
end
end
end
|
# Blocks
# Blocks, like parameters, can be passed into a method just like normal variables.
# The ampersand (&) in the method definition tells us that the argument is a block. You could name it anything you wanted. The block must always be the last parameter in the method definition. When we're ready to use the method,... |
require 'rails_helper'
RSpec.describe 'DogWalking End Without Errors Api', type: :request do
describe 'GET /dog_walking/:id/finish_walk' do
context "When start walk with a valid uuid" do
before do
Product.create({
name: 'Caminhada de 60 min',
duration: 60,
first_price... |
require_relative '../lib/card_deck'
require_relative '../lib/playing_card'
describe 'CardDeck' do
it 'stores a specified array of cards' do
cards = [PlayingCard.new, PlayingCard.new]
deck = CardDeck.new(cards)
expect(deck.cards).to match_array cards
end
it 'defaults to a standard 52 card deck' do
... |
class Preference < ActiveRecord::Base
belongs_to :user
belongs_to :user_with_default_attrs, :class_name => 'User', :foreign_key => 'user_id'
belongs_to :user_with_block, :class_name => 'User', :foreign_key => 'user_id'
auto_create :user
auto_create :user_with_default_attrs, {:username => 'defaulted'}
auto... |
class AddTrendyOnToTrends < ActiveRecord::Migration
def change
add_column :trends, :trendy_on, :date
end
end
|
#!/usr/bin/env ruby
# There is a problem here, as this is a hash it can't have the same source
# character twice so you can't ask it to replace i with 1 and i with l
replace_hash = {
"o" => "0",
"i" => "l",
"m" => "rn",
"aa" => "a",
"bb" => "b",
"cc" => "c",
"dd" => "d",
"ee" => "e",
... |
module Verify
class FinanceOtherController < ApplicationController
include IdvStepConcern
before_action :confirm_step_needed
before_action :confirm_step_allowed
def new
@view_model = view_model
analytics.track_event(Analytics::IDV_FINANCE_OTHER_VISIT)
end
private
def step_n... |
require 'pstore'
require 'forwardable'
module Medusa
module Storage
class PStore
extend Forwardable
def_delegators :@keys, :has_key?, :keys, :size
def initialize(file)
File.delete(file) if File.exists?(file)
@store = ::PStore.new(file)
@keys = {}
end
def [... |
require_relative 'deck'
require 'byebug'
class Hand
def initialize
@cards = []
end
def empty?
@cards.length == 0
end
def full?
@cards.length == 5
end
def add_card(card)
raise 'Argument is not a card' unless card.is_a?(Card)
raise 'Hand is fu... |
require "openssl"
module Celluloid
module IO
# SSLSocket with Celluloid::IO support
class SSLSocket < Stream
extend Forwardable
def_delegators :@socket,
:read_nonblock,
:write_nonblock,
:closed?,
:cert,
... |
module SocialPusher
module Postable
module Base
def self.included(base)
base.class_attribute :social_pusher_as
base.class_attribute :social_pusher_to
base.extend ClassMethods
end
module ClassMethods
def postable(*args)
options = args.extract_options!
... |
class EditFamilyMembers < ActiveRecord::Migration[5.0]
def change
remove_column :family_members, :relationship, :string
remove_column :family_members, :name, :string
remove_column :family_members, :age, :integer
remove_column :family_members, :living, :boolean
remove_column :family_members, :cause... |
# frozen_string_literal: true
set :local_repo_root, File.expand_path('../../../repos', __FILE__)
set :local_repo_path, File.join(fetch(:local_repo_root), fetch(:application))
# We want to build this locally and push the built version to the server,
# se we need to redefine the SCM tasks
# rubocop:disable Metrics/Blo... |
require 'test_helper'
class DivesitesControllerTest < ActionController::TestCase
setup do
@divesite = divesites(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:divesites)
end
test "should get new" do
get :new
assert_response :success
... |
module Packit
class Field
attr_accessor :name, :args
def initialize( name, args )
@name = Utils.cache_key_for name
@args = args
end
def size
0
end
def call
nil
end
end
class Record
def initialize
@fields = []
end
# TODO: test me
def ca... |
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ssh'
require 'yaml'
begin
config = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
Net::SSH.start(config[:host], config[:username]) do |ssh|
puts ssh.exec!("cd #{config[:dir]}; git pull; git submodule update")
end
rescue Errno::ENOENT
msg =... |
# encoding: utf-8
Redmine::Plugin.register :redmine_drawio do
name 'Redmine Drawio plugin'
author 'Michele Tessaro'
description 'Wiki macro plugin for inserting drawio diagrams into Wiki pages and Issues'
version '1.4.7'
url 'https://github.com/mikitex70/redmine_drawio'
author_url 'https://github.com/mikit... |
require 'goby'
module Goby
# Allows a player to buy and sell Items.
class Shop < Event
# Message for when the shop has nothing to sell.
NO_ITEMS_MESSAGE = "Sorry, we're out of stock right now!\n\n"
# Message for when the player has nothing to sell.
NOTHING_TO_SELL = "You have nothing to sell!\n\n... |
class AddTrackRefToEvents < ActiveRecord::Migration
def change
add_reference :events, :track, index: true
add_foreign_key :events, :tracks
end
end
|
class Admin::UsersController < Admin::AdminController
before_action :set_user, only: [:ban, :change_role]
def index
@search = User.ransack(params[:q])
@users = @search.result
end
def ban
@user.banned = @user.banned ? false : true
@user.save
redirect_to admin_use... |
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
def help
Helper.instance
end
def render_404
render :file => "#{Rails.root}/public/404.html", :status => 404
end
def redirect_with_delay(url, delay = 0)... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
before_create :update_access_token!
require 'securer... |
module API
module V1
class Devices < Grape::API
include API::V1::Defaults
resource :devices do
desc "create a device"
post do
Device.find_or_create_by(token: params[:token], platform: params[:platform])
end
end
end
end
end
|
class AddColumnToItemsController < ActiveRecord::Migration
def change
add_column :items, :counter, :integer, default: 0
end
end
|
class Admin::PeriodsController < ApplicationController
def index
@periods = policy_scope(Period)
end
def show
@period = Period.find(params[:id])
authorize(@period)
end
def new
@period = Period.new
authorize(@period)
end
def create
@period = ... |
class UsersController < ApplicationController
before_action :authenticate_user!
def new_profile
@user = current_user
end
def create_profile
@user = User.find(params[:user][:id])
if @user.update_attributes(user_params)
redirect_to dashboard_path, notice: 'Profile was successfully created.'
else... |
# (日次)overwatchブログ投稿バッチ処理
# Author:: himeno
# Date:: 2016/09/20
# Execute:: rails runner PostOverWatch.execute
class PopularOverWatch < PopularBatchBase
@@batch_description = 'OverWatchブログ 投稿'
@@blog_url = 'https://omnic.wordpress.com'
@@user = Rails.application.secrets.omnic_user
@@password = Rails.appli... |
require 'tb'
require 'test/unit'
class TestCustomCmp < Test::Unit::TestCase
def test_revcmp
cmp = lambda {|a, b| b <=> a }
v1 = Tb::CustomCmp.new(1, &cmp)
v2 = Tb::CustomCmp.new(2, &cmp)
v3 = Tb::CustomCmp.new(3, &cmp)
assert_equal(2 <=> 1, v1 <=> v2)
assert_equal(1 <=> 2, v2 <=> v1)
asse... |
require "esv"
describe ESV, ".generate and .parse" do
it "works" do
data = ESV.generate do |esv|
esv << [ "Dogs", "Cats" ]
esv << [ 1, 2 ]
end
output = ESV.parse(data)
expect(output).to eq [
[ "Dogs", "Cats" ],
[ 1, 2 ],
]
end
end
describe ESV, ".parse" do
it "raise... |
class InvestorsDatatable
delegate :params, :h, :link_to, to: :@view
include Rails.application.routes.url_helpers
include ActionView::Helpers::OutputSafetyHelper
def initialize(view)
@view = view
end
def as_json(options = {})
{
sEcho: params[:sEcho].to_i,
iTotalRecords: User.count,
... |
module Locomotive
module ActionController
module AgeGate
extend ActiveSupport::Concern
included do
before_filter :verify_age
end
module ClassMethods
def bypass_urls
@bypass_urls || []
end
def bypass_age_gate(*args)
@bypass_urls = args
... |
module Harvest
module Domain
class Fisherman
extend Realm::Domain::AggregateRoot
def initialize(attributes)
fire(:fisherman_registered, uuid: Harvest.uuid, name: attributes[:name])
end
def assign_user(uuid: required(:uuid))
fire(:user_assigned_to_fisherman, user_uuid: uui... |
class FieldsController < ApplicationController
before_action :require_user
before_action :current_user
before_action :user_expiration
def index
@field = Field.new
@fields = @current_user.fields.where(archived: false)
end
def create
@field = Field.new(field_params)
... |
Pod::Spec.new do |s|
s.name = "MoipSDK"
s.version = "1.0.5"
s.summary = "Cliente iOS para integração com as APIs v2 Moip, possibilita a criptografia de dados sensíveis de cartão de crédito."
s.description = <<-DESC
Cliente iOS para integração com as APIs v2 Moip, possibili... |
class User < ApplicationRecord
has_many :favorites, dependent: :destroy
has_many :reviews
has_many :social_profiles, dependent: :destroy
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerab... |
FactoryGirl.define do
factory :manufacturer do
name do
['Musashi Industrial and Starflight Concern', 'Drake Interplanetary',
'Roberts Space Industries', 'Anvil Aerospace'].sample
end
short do
name.split(' ')[0]
end
end
end |
require 'rails_helper'
RSpec.describe "PETS index page - A user", type: :feature do
before(:each) do
@shelter_1 = Shelter.create( name: "Henry Porter's Puppies",
address: "1315 Monaco Parkway",
city: "Denver",
state: ... |
class LineItem
attr_reader :quantity
def initialize(quantity, item)
@quantity = quantity
@item = item
end
def item_name; item.name end
def item_price; item.price end
def item_indication; item.indication end
def total
quantity * item_price
end
private
def item; @item end
end
|
class CreateUserContactGroups < ActiveRecord::Migration
def change
create_table :user_contact_groups do |t|
t.integer :user_id
t.integer :contact_group_id
t.integer :gg_contact_group_id
t.timestamps
end
end
end
|
class AddCastAndCrewToMovies < ActiveRecord::Migration[5.1]
def change
add_column :movies, :cast, :string
add_column :movies, :crew, :string
end
end
|
#!/usr/bin/env ruby
require_relative 'crypter.rb'
# Hauptprogramm
if (ARGV.length < 3)
puts "Too few arguments!"
puts "Usage: cracker HASH WORD-FILE TRANSFORM-FILE [-v]"
exit
end
hash = ARGV[0]
wordlist_file = ARGV[1]
transform_file = ARGV[2]
verbose = ARGV.length == 4 && ARGV[3] == "-v"
#... |
require 'test_helper'
class TrendsControllerTest < ActionDispatch::IntegrationTest
fixtures :seasons, :heroes
setup do
@past_season = seasons(:one)
@season = seasons(:two)
@future_season = create(:season, started_on: 2.months.from_now)
@user = create(:user)
@account = create(:account, user: @u... |
require 'csspool'
module CSSPoolSanitizer
private
def parse_and_sanitize(raw, sanitizer, allowed_selectors)
source_doc = CSSPool.CSS raw
dest_doc = ""
source_doc.rule_sets.each do |rs|
if rs.selectors.all? { |s| allowed_selectors.include?(s.to_s) }
sanitized = sanitizer.sanitize_css(rs.... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def current_user
if session[:user_id]
@current_user = User.find(session[:user_id])
else
@current_user = nil
end
end
def logged_in?
# this works
!!current... |
require 'spec_helper'
require 'jsonapi/schema'
RSpec.describe Jsonapi::Schema do
describe '#type' do
it 'raises if no type is defined' do
test_class = Class.new(described_class)
type_call = -> { test_class.new.type }
expect(type_call).to raise_error(Jsonapi::TypeMustBeDefined)
end
i... |
class Question < ApplicationRecord
has_many :answers, dependent: :destroy
validates :title, :contents, presence: true,
length: { minimum: 5 }
#validates :askedby, presence: true
def self.search(search)
where("title LIKE ?", "%#{search}%")
#where("contents LIKE ?", "%#{search}%")
en... |
require 'rubygems'
require 'rake'
require 'uglifier'
desc "Compile the JavaScript js/BoldFace.js into buld/BoldFace-mini.js"
task :compile_js => [:compile_html] do
html = File.read('build/BoldFace.html').gsub!('"', "'")
new_html = 'BoldFace.html = ' + '"' + html + '";'
new_bookmarklet_host = "BoldFace.bookmarkle... |
# $Id$
# $Id$
# Represents a generic mailing address. Addresses are expected to consist of the
# following fields:
# * +addressable+ - The record that owns the address
# * +street_1+ - The first line of the street address
# * +city+ - The name of the city
# * +postal_code+ - A value uniquely identifying the area in th... |
FactoryGirl.define do
factory :developer do
sequence(:name) { |n| "Cool Person #{n}" }
bio "This is a very nice person and stuff"
end
end
|
# encoding: UTF-8
class HouseMailer < ActionMailer::Base
RECIPIENT = ['hello@jerevedunemaison.com', 'tukan2can@gmail.com']
default from: "Je Rêve d’une Maison <contact@jerevedunemaison.com>"
helper :application # gives access to all helpers defined within `application_helper`.
def create_mail(house)
@house... |
class Trinary
def initialize(trinary_str)
@trinary_str = trinary_str
end
def to_decimal
return 0 if @trinary_str.match(/[^012]/)
@trinary_str.to_i.digits.map.with_index do |digit, idx|
digit * 3**idx
end.sum
end
end
# Hexadecimal challenge
# class Hexadecimal
# DIGITS = {
# '0' =... |
# frozen_string_literal: true
class Problem3
TITLE = 'Largest prime factor'
DESCRIPTION = 'The prime factors of 13195 are 5, 7, 13 and 29.'\
'What is the largest prime factor of the number 600851475143?'
def save_prime_factors # rubocop:disable Metrics/MethodLength
number = 600_851_475_143
... |
class Newsletter < ActiveRecord::Base
# Fetch all published news since last newsletter sending
def self.latest_news
last_sent = self.where(['sent_on IS NOT NULL']).last
last_sent ? start_date = last_sent.sent_on : start_date = '2010-01-01 00:00:00'.to_date
Post.where(['created_at > ?', start_date]).or... |
# frozen_string_literal: true
require 'get_process_mem'
module Dynflow
module Watchers
class MemoryConsumptionWatcher
attr_reader :memory_limit, :world
def initialize(world, memory_limit, options)
@memory_limit = memory_limit
@world = world
@polling_interval = options[:polli... |
require 'rails_helper'
RSpec.describe "customer relationships" do
before(:each) do
@customer = create(:customer)
@invoice = create(:invoice, customer_id: @customer.id)
@invoice_1 = create(:invoice, customer_id: @customer.id)
end
it "can load a collection of invoices associated with a customer" do
... |
class StringCalculator
MAXIMUM_NUMBER = 1000
def initialize(splitter)
@splitter = splitter
end
def add(numbers)
numbers = NumberCollection.new(@splitter.split(numbers))
negatives = numbers.negatives
raise Exception.new("Negatives not allowed: #{negatives.inspect}") if negatives.any?
small_enough(number... |
class Skill < ActiveRecord::Base
has_many :abilities
has_many :gigs, through: :abilities
end |
class CreateTickets < ActiveRecord::Migration
def change
create_table :tickets do |t|
t.string :name, null: false
t.float :price, null: false
t.integer :scenic_id, null: false
t.string :picture
t.text :description
t.integer :ticket_type, null: false
t.integer :status, default: 0... |
require 'date'
module WithingsSDK
module Utils
def self.normalize_date_params(options)
opts = hash_with_string_date_keys(options)
convert_epoch_date_params!(opts)
convert_ymd_date_params!(opts)
if opts.has_key? 'startdateymd' and !opts.has_key? 'startdate'
opts['startdate'] = t... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class CreateVideos < ActiveRecord::Migration
def up
create_table :videos do |t|
t.integer :newsitem_id
t.string :video_title
t.string :video_link
t.string :video_type
t.timestamps
end
end
def down
drop_table :videos
end
end
|
=begin
Test word_count method - Text
Recall that in the last exercise we only had to test
one method of our Text class.
One of the useful facets of the setup and teardown
methods is that they are automatically run before and
after each test respectively. To show this we'll be
adding one more method to our Text cl... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# vagrant plugin install vagrant-disksize
#
Vagrant.configure(2) do |config|
# config.vm.box = "ubuntu/xenial64"
config.disksize.size = "20GB"
#---------------------------------------
# config.vm.box = "deadbok/debian-stretch-xfce-amd64"
# config.vm.box_version = "9.2... |
# frozen_string_literal: true
FactoryBot.define do
factory :game do
player { 'Mutuba' }
after(:build) do |game|
game.board ||= FactoryGirl.build(:board, game: game)
end
end
end
|
# After this if you don't hate kinesis, I'd be super shocked.
require 'aws-sdk'
require 'slack-notifier'
require 'json'
# Read the configuration file. See kinesis-asg-config.json.
$config = JSON.parse(
File.read('./kinesis-asg-config.json')
)
if $config['postToSlack']
$notifier = Slack::Notifier.new $config['slack... |
# frozen_string_literal: true
#
# Copyright (C) 2017-2918 Harald Sitter <sitter@kde.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your... |
class RenamechargeidfromWorkerContract < ActiveRecord::Migration
def change
rename_column(:worker_contracts, :charge_id, :article_id)
end
end
|
# frozen_string_literal: true
class PassangerTrain < Train
attr_reader :number
attr_accessor :wagons, :current_route, :current_station, :type
def initialize(number)
@number = number
validate!
@wagons = []
@current_route = []
@current_station = []
@type = 'Пассажирский'
end
end
|
class Implementation < ActiveRecord::Base
self.table_name = 'RL'
attr_accessible :S, :N, :DAT, :DN, :KOD, :NAIM, :SUM, :SUMM, :SUMY, :P, :AWT, :s, :n, :dat, :dn, :kod, :naim, :sum, :summ, :sumy, :p, :awt
#field :KOD
#field :NAIM
#field :SUM
#field :SUMM
#field :SUMY
#field :DAT
after_update :sum_cor
... |
class AppointmentsController < ApplicationController
# GET /appointments
# GET /appointments.xml
def index
@search = default_search(Appointment)
@appointments = @search.relation.includes(:visit, :series => [:series_metainfo, {:series_log_items => :series_scenario}]).page(params[:page])
respond_to do ... |
require 'spec_helper'
describe PagesController do
render_views
before(:each) do
@base_title = "Ruby on Rails Tutorial Sample App"
end
describe "GET 'home'" do
it "should have the title 'Home'" do
visit '/'
page.should have_selector("title", :contents => "#{@base_title} | Home")
en... |
#encoding: utf-8
require 'spec_helper'
describe "Bancos" do
before do
@user = Factory(:user)
integration_sign_in(@user)
@etiqueta = "Banco Galicia"
end
it "link de acceso" do
visit home_path
response.should have_selector("a", :href => bancos_path, :content => "Bancos")
click_link "Banco... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.