text stringlengths 10 2.61M |
|---|
#{{{ Marathon Fixture
require 'default'
#}}} Marathon Fixture
require 'common/on_main_window_as'
require 'common/wait_table'
require 'manual/on_inspector_for'
#傷病名登録 エディタから発行
def test
java_recorded_version = '1.6.0_20'
on_main_window_as('MarathonDolphin', 'dolphin') do |name|
on_inspector_for('00038', name)... |
require 'rails_helper'
RSpec.feature "user can remove an item from the cart" do
scenario "user can remove an item from the cart" do
item = FactoryGirl.create(:item)
visit item_path(item)
click_link "Add to Cart"
visit '/cart'
click_link "Remove"
expect(page).to have_content("Successfully rem... |
class JobCache
def self.find(id)
store[id]
end
def self.create(attrs)
store[attrs[:id]] = attrs
end
private
def self.store
@store ||= {}
end
end |
require "rails_helper"
RSpec.describe Api::V1::RandomTransactionController, type: :controller do
describe "GET #show.json" do
let(:json_response) { JSON.parse(response.body) }
it "responds with successful 200 HTTP status code" do
get :show, format: :json
expect(response).to be_success
exp... |
#
# Hood/Neighborhood
#
class Hood
include Mongoid::Document
include Geopolitocracy
field :rank, type: Integer
belongs_to :city
validates :city, presence: true
validates :name, uniqueness: { scope: :city_id }
def ensure_slug
return unless city
self.slug ||= "#{city.slug}-#{name}"
end
def... |
describe 'Send a POST with some text' do
before(:all) { @text = '_long_text_' * 250 }
let(:post_text){ post '', { text: @text } }
it 'Returned error should be a [405]' do
post_text
expect_status(405)
end
end |
require 'spec_helper'
describe "UserPages" do
subject { page }
describe "Signup Page" do
before { visit signup_path }
it { should have_selector('title', text: 'GrebeCalendarApp: Create New Account') }
it { should have_selector('h1', text: 'Create Account') }
end
describe ... |
=begin
You will be given an array of objects representing data about developers who have signed up to attend the next coding meetup that you are organising.
write a function that returns the array sorted alphabetically by the programming language. In case there are some developers that code in the same language, s... |
# == Schema Information
#
# Table name: leads
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# source :string(255) default("manual")
# next_contact_date :date
# next_contact_... |
source 'https://rubygems.org'
ruby '2.3.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript a... |
FactoryBot.define do
factory :organisation do
name { 'Org One' }
end
end
|
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :username, :string, :limit => 25
t.column :friendly_name, :string, :limit => 50
t.column :doctor_id, :integer
t.column :email, ... |
class CreateDayPrices < ActiveRecord::Migration
def change
create_table :day_prices do |t|
t.references :StockTicker, index: true
t.date :date
t.decimal :price, precision: 12, scale: 4
t.index [:StockTicker_id, :date], unique: true
end
end
end
|
require File.join(File.dirname(__FILE__), '..', 'isa_def')
require File.join(File.dirname(__FILE__), 'assembly_file_parser')
class ConsoleSimulator
def initialize(isa)
@isa = isa
@mem = MemoryStore.new
#@simulator = Simulator.new @isa, @mem
end
def simulate_file(filename, verbose = false)
result... |
json.note do
json.id @note.id
json.content @note.content
json.permission permission(@note)
end |
class Rover
orientation - {
"N" => {
"R" => "E",
"L" => "W"
},
"E" => {
"R" => "S",
"L" => "N"
},
"W" => {
"R" => "N",
"L" => "S"
},
"S" => {
"R" => "W",
"L" => "E"
}
}
attr_accessor :name, :x_co, :y_co, :facing
def initialize(data={})
@name =data[:name]
... |
#
# Cookbook Name:: localdev
# Recipe:: default
#
# Copyright (c) 2016 iamota, All Rights Reserved.
# Update apt package database before installing any new packages
# execute "update-upgrade" do
# command "apt-get update && apt-get upgrade -y"
# action :run
# end
# Disabled due to conflict with new NFS mounting ... |
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
git = "\"#{ENV['PROGRAMFILES(X86)']}\\Git\\bin\\git\""
tests_directory = '\infrastructure_tests'
execute 'Removing previous clone' do
command "rd /s /q #{tests_directory}"
cwd '/'
only_if { File.exist?(tests_directory) }
end
execute 'Downloading tests' do
command "#{git} clone git://github.com/ugf/infrastruct... |
gem 'listen'
# we apply a monkey patch to rb-inotify to avoid polluting the logs when calling
# fd on a closed handler
begin
require 'rb-inotify'
::INotify::Notifier.prepend Module.new {
def fd
super
rescue IOError, Errno::EBADF
end
}
rescue LoadError # ignore
end
require_relative '../lib/au... |
class NSString
def present?
!blank?
end
end |
require 'rails_helper'
RSpec.describe "theater_seats/index", type: :view do
before(:each) do
assign(:theater_seats, [
TheaterSeat.create!(
:theater_screen => nil,
:seat_type => "Seat Type",
:row_count => 1,
:column_count => 2,
:price_multiple_factor => "",
:p... |
class AddDescriptionToPlanes < ActiveRecord::Migration[5.0]
def change
add_column :planes, :description, :text
end
end
|
require '~/Desktop/makers/dev/boris-bikes/lib/garage'
describe Garage do
def fill_garage(garage)
20.times {garage.dock(Bike.new)}
end
let(:bike) {Bike.new}
let(:garage) {Garage.new}
it 'should accept a bike' do
garage.dock(bike)
expect(garage.bike_count).to eq(1)
end
it 'should know when it is full'... |
class ChangeMobileDataType < ActiveRecord::Migration
def up
change_column :chef_requests, :mobile_number, :string
end
end
|
class ComparisonResult < ApplicationRecord
belongs_to :response
belongs_to :rule
def color
line_score >= 0 ? "success" : "danger"
end
def display_line
line.split('|||')
end
end
|
# Author:: Couchbase <info@couchbase.com>
# Copyright:: 2018 Couchbase, Inc.
# License:: Apache License, Version 2.0
#
# 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.... |
#!/usr/local/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
Dir[File.join(File.dirname(__FILE__), "lib", "cloudformation", "*.rb")].sort.each{|f| require f}
type CloudformationMapper::Template
name 'ExampleCloudformationMapper'
description 'Example Cloudformation configuration using Cloudformation M... |
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "fog_tracker/version"
Gem::Specification.new do |s|
s.name = "fog_tracker"
s.version = FogTracker::VERSION
s.authors = ["Benton Roberts"]
s.email = ["benton@bentonroberts.com"]
s.homepage = "http://github.c... |
class RemoveInstructorIdFromSections < ActiveRecord::Migration
def change
remove_column :sections, :instructor_id
end
end
|
class Game < ApplicationRecord
belongs_to :user
has_many :scenarios, dependent: :destroy
has_many :attempts, dependent: :destroy
has_many :questions, through: :scenarios
has_many :answers, through: :attempts
validates :user_id, :title, :presence => true
end
|
class Sedan
attr_accessor :wheels
def initialize()
@wheels = 4
end
end
|
class AddNameAndCardIdIndexToCardData < ActiveRecord::Migration[6.0]
def change
add_index :card_data, [:name, :card_id], :unique => false, :name => 'name_and_cardid'
end
end
|
module GoldPoints
module V1
class AuthenticationsAPI < Grape::API
desc 'Authenticate user'
route_setting :auth, public: true
params do
requires :credentials, type: Hash do
requires :email, type: String
requires :password, type: String
end
end
post... |
class AddAnswerFollowupIdToQuestionJoinTable < ActiveRecord::Migration
def change
create_join_table :answer_followups, :questions, column_options: {null: true}
end
end
|
# frozen_string_literal: true
require 'jiji/test/test_configuration'
require 'jiji/test/data_builder'
describe Jiji::Model::Trading::Rate do
include_context 'use data_builder'
it 'tickから作成できる' do
rate1 = Jiji::Model::Trading::Rate.create_from_tick(:EURJPY,
data_builder.new_tick(1, Time.new(2014, 1, 1... |
module NesTools
module Command
class NsdCommand
def initialize(args)
@args = args
@opt = Hash.new
op = OptionParser.new("Convert NSD (NES Sound Driver) mml file to binary." +
"Play by 'nsd.fc'.\n" +
"Usage: nes_tools ns... |
# frozen_string_literal: true
require 'bundler/setup'
require_relative 'app/application'
def validate_env_preconditions
value = ENV['GAME_CODE']
raise 'GAME_CODE env var not found' if value.nil?
raise 'GAME_CODE env var could not be parsed into an integer' unless value.respond_to?(:to_i)
end
validate_env_preco... |
class PlexHomeTheater < Cask
url 'http://downloads.plexapp.com/plex-home-theater/1.0.7.169-303ab8cc/PlexHomeTheater-1.0.7.169-303ab8cc-macosx-i386.zip'
homepage 'http://plexapp.com'
version '1.0.7.169'
sha1 '1926d76623c5bb4205db7421042d4b5fdb671bfd'
link 'Plex Home Theater.app'
end
|
# frozen_string_literal: true
RSpec.shared_examples :translatable do
let(:operation) { described_class.new(params, account) }
let(:params) { { nested: data } }
let(:account) { build(:account) }
let(:data) { described_class::Translations::PARAMS }
describe '#translated_params' do
subject { operation.tra... |
RSpec::Matchers.define :have_heading do |message|
match do |page|
page.heading.should == message
end
failure_message_for_should do |page|
"expected: #{message} got #{page.heading}"
end
end |
class User < ApplicationRecord
attr_accessor :remember_token, :activation_token, :reset_token
before_save :downcase_email
before_create :create_activation_digest
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: {... |
require "capistrano/dsl/paths"
module Capistrano
module DSL
module Paths
def symfony_app_path
release_path.join(fetch(:app_path))
end
def symfony_web_path
release_path.join(fetch(:web_path))
end
def symfony_log_path
release_path.join(fetch(:log_path)... |
class AddRelationshipToPlantation < ActiveRecord::Migration
def change
add_column :vegetables, :plantation_id, :integer
end
end
|
require "yahoo_finance_scraper/version"
require "yahoo_finance_scraper/columns"
require 'csv'
require 'net/http'
require 'nokogiri'
module YahooFinance
module Scraper
class Company
attr_reader :symbol
attr_accessor :getter
def initialize symbol, options = {}
@symbol = symbol
@g... |
require 'rails_helper'
RSpec.describe Event, type: :model do
it "is valid" do
expect(create(:event)).to be_valid
end
end
|
require 'test_helper'
class BugTrackersControllerTest < ActionController::TestCase
setup do
@bug_tracker = bug_trackers(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:bug_trackers)
end
test "should get new" do
get :new
assert_respons... |
require 'rails_helper'
describe 'User sees a list of all jobs by category' do
describe 'User clicks on a category' do
scenario 'user sees list of all jobs by category' do
company = Company.create!(name: 'Google')
category = Category.create!(name: 'Developer')
job1 = company.jobs.create!(title: ... |
require 'matrix'
module Sads
# Security Parameter
attr_reader :k
# q
attr_accessor :q
# loq_q
attr_reader :log_q_ceil
# Stores digest of root
attr_accessor :root_digest
# Size of Universe
attr_reader :universe_size_m
# Left and Right vectors for algebraic hash function
attr_accessor :L, :R
# Public... |
# This custom delivery method was created because of the way the AWS client
# libraries share credentials. Instead of inheriting the Aws.config hash, we
# explicitly set the Aws::SES::Client's credentials here to avoid collision
# with the Paperclip gem's AWS configuration.
#
#
# taken from aws-sdk-rails gem's original... |
require 'test_helper'
class Resolvers::CreateUserTest < ActiveSupport::TestCase
def perform(args = {})
Resolvers::CreateUser.new.call(nil, args, {})
end
test 'creating new link' do
user = perform(
name: 'John Doe',
authProvider: {
email: {
email: 'john@example.com',
... |
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "Le Rat Curieux"
end
test "should get root" do
get root_url
assert_response :success
end
test "should get home" do
get static_pages_home_url
assert_response :success
a... |
# Using the following code, determine the lookup path used when invoking cat1.color. Only list the classes and modules that Ruby will check when searching for the #color method.
class Animal
end
class Cat < Animal
end
class Bird < Animal
end
cat1 = Cat.new
cat1.color
# answer => Cat, Animal, Object, Kernel, BasicO... |
#!/usr/bin/env ruby
require 'curses'
require './database'
require './commands'
require './parser'
class Screen
@commandBuilder = nil
def initialize()
@database = Database.new
@parser = Parser.new(@database)
end
def getStr
outstr = ""
loop do
inchar = Curses.getch
if inchar == 10 || inchar == 459#Break... |
class PacksController < ApplicationController
def index
@packs = Pack.all
end
def show
@pack = Pack.find(params[:id])
end
def new
@pack = Pack.new
end
def create
@pack = Pack.new(params[:pack])
if @pack.save
flash[:notice] = "Successfully created pack."
redirect_to... |
class RevisiondisputesController < ApplicationController
before_action :authenticate_user!, only: [:new, :create, :edit, :update]
before_action :ensure_trailblazer!, only: [:show, :destroy]
before_action :ensure_admin!, only: :index
before_action :set_revisiondispute, only: [:show, :edit, :update, :destroy]
... |
ActiveAdmin.register BankAccount do
menu false
scope("Personal") { |scope| scope.personal_accounts }
scope("Group") { |scope| scope.group_accounts }
csv force_quotes: true do
column("Owner Name", humanize_name: false) { |ba| ba.name }
column("Bank Account Balance", humanize_name: false) { |ba| ba.bala... |
class Django < DebianFormula
url 'http://www.djangoproject.com/download/1.3/tarball/', :as => 'Django-1.3.tar.gz'
md5 '1b8f76e91c27564708649671f329551f'
name 'django'
version '1.3'
section 'python'
description 'high-level Python Web framework that encourages rapid development and clean, pragmatic design'
... |
class EditReservationDate < ActiveRecord::Migration
def change
remove_column :reservations, :start
remove_column :reservations, :end
add_column :reservations, :start_book, :date
add_column :reservations, :end_book, :date
end
end
|
class Budget < ApplicationRecord
has_many :categories
has_many :spendings
belongs_to :user
before_create :set_remaining_budget
private
def set_remaining_budget
self.remaining = self.total
end
end
|
class AppearerSearchesController < ApplicationController
before_action :set_act
def new
@search = AppearerSearch.new
end
def create
@search = AppearerSearch.create(search_params)
redirect_to @search
end
def show
@search = AppearerSearch.find(params[:id])
end
private
def search_pa... |
class Api::V1::MovieCatalogsController < ApplicationController
before_action :set_movie_catalog, only: [:update, :destroy]
before_action :authenticate_user!, only: [:create, :update, :destroy]
before_action :validate_admin, only: [:create, :update, :destroy]
# List Movie Catalog
def index
@movie_catalogs... |
class RenamePriceToPrizeForChallenges < ActiveRecord::Migration[5.0]
def up
rename_column :challenges, :price, :prize
end
def down
rename_column :challenges, :prize, :price
end
end
|
module Badgeable
module Adapters
module MongoidAdapter
def self.included(receiver)
receiver.class_eval do
embeds_many :badgings
end
::Badging.class_eval %Q{
embedded_in :#{receiver.to_s.underscore}, :inverse_of => :badgings
def receiver
... |
require "rubygems"
require_relative "lib/account"
require_relative "lib/account_manager"
require_relative "lib/command_interpreter"
require_relative "lib/luhnacy"
require_relative "lib/transaction"
class CCProcessingClient
def initialize
@account_manager = AccountManager.new account: Account, validator: Luh... |
module Turing
class Machine
# A Turing Machine Configuration is what in modern terms we would call a
# state. A configuration has a label, the symbol it accepts, the action to
# be performed, and an identifier for the next state to transition into.
#
# Actions are represented as an array of tuples... |
# this is designed to trigger dialogs for kidsruby for ask and alert compatible with hackety hack
def init_interface
@interface_helper = InterfaceHelper.new
@interface_helper.connect!
@iface = @interface_helper.get_interface
end
def ask(text)
init_interface
if @iface.valid?
message = @iface.call("ask", ... |
class ArticlesController < ApplicationController
before_action :set_article, only: [:show, :edit, :update, :destroy]
before_action only:[:edit, :update, :destroy] do
require_same_user(@article.user)
end
skip_before_action :authenticate_user!, only:[:index, :show, :search]
# GET /articles
# GET /articl... |
Deface::Override.new(:virtual_path => "spree/layouts/admin",
:name => "blog_admin_tabs",
:insert_bottom => "#main-sidebar",
:partial => 'spree/admin/shared/blog_sidebar_menu',
:disabled => false)
|
require 'wx_order'
require 'weixin_api'
class Bless < ActiveRecord::Base
include WxOrder
mount_uploader :wechat_native_qrcode, ImageUploader
scope :paid, -> { where(paid: true) }
scope :free_hearts, -> { where("virtual_present_infor @> ?", Bless.free_hearts_hash.to_json) }
scope :charged, -> { where.not("... |
# This migration comes from forem (originally 20120222000227)
class AddForemTopicsLastPostAt < ActiveRecord::Migration
def up
add_column :forem_topics, :last_post_at, :datetime
Forem::Topic.reset_column_information
Forem::Topic.includes(:posts).find_each do |t|
post = t.posts.last
t.update_att... |
#!/usr/bin/env ruby
#
# Author: rasan@nyu.edu
require 'fiscali'
require 'optparse'
require 'yaml'
class ReportConfig
def self.get_config
config = {
:output_dir => Dir.home,
}
conf_dir = File.dirname(File.expand_path(__FILE__))
yml = YAML.load_file(File.join(conf_dir, 'config.yaml'))
c... |
# frozen_string_literal: true
# :reek:UtilityFunction
class ReleaseReservationJob < ApplicationJob
queue_as :default
def perform(reservation_id)
reservation = Reservation.find_by(id: reservation_id)
return if reservation.paid?
cancel_reservation(reservation)
end
private
def cancel_reservation(... |
# frozen_string_literal: true
module LunaPark
module Errors
class Processing < StandardError; end
class AbstractMethod < RuntimeError; end
class Unwrapable < ArgumentError; end
class NotConfigured < StandardError; end
end
end
|
class FollowingsController < ApplicationController
# load_and_authorize_resource
def create
@project = Project.find(params[:project_id])
@following = @project.followings.build(:user_id => current_user.id)
@following.save
redirect_to @project, :notice => "You are now following #{@project.title}."
end
def d... |
module Asaas
class Payment < Model
BillingTypes = Types::Strict::String.enum('BOLETO', 'CREDIT_CARD', 'UNDEFINED', 'TRANSFER', 'DEPOSIT', 'PIX')
Status = Types::Strict::String.enum('PENDING', 'RECEIVED', 'CONFIRMED', 'OVERDUE', 'REFUNDED', 'RECEIVED_IN_CASH', 'REFUND_REQUESTED', 'CHARGEBACK_DISPUTE', 'AWAITIN... |
class CreditCard < ActiveRecord::Base
belongs_to :customer, inverse_of: :credit_cards
attr_writer :token
validates :customer, presence: true
before_create :add_to_stripe
before_update :update_on_stripe
before_destroy :remove_from_stripe
after_rollback :remove_from_stripe
def number=(value)
@num... |
class ItemPurchase
include ActiveModel::Model
attr_accessor :post_code, :prefecture_id, :city,:house_number,:building_name,:tell, :price,:item_id,:user_id,:token,:purchase_id
with_options presence: true do
validates :city,:house_number
validates :post_code, format: {with: /\A[0-9]{3}-[0-9]{4}\z/, messag... |
class BotSendUserStatementJob < ApplicationJob
queue_as :bot
rescue_from(StandardError) do |exception|
send_error_statement(arguments[0], I18n.t('errors.bots.unknown_request_failure'))
end
rescue_from(Errno::ECONNREFUSED) do |exception|
send_error_statement(arguments[0], I18n.t('errors.bots.communicat... |
module Types
class QuizType < Types::BaseObject
field :id, ID, null: false
field :title, String, null: false
field :description, String, null: false
field :shuffle, Boolean, null: false
field :questions, [Types::QuestionType], null: true
field :course, Types::CourseType, null: fa... |
class StoragefilesController < ApplicationController
before_filter :require_authentication, :only=>[:index,:new,:show,:show_all,:show_public]
def new
@user = User.find(params[:user_id])
end
def uploadFile
@user = User.find(params[:user_id])
name = params[:upload]['datafile'].original_filename
f... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes ... |
FactoryGirl.define do
factory :hdseminar do
firstname Faker::Name.first_name
lastname Faker::Name.last_name
language ['Deutsch', 'English'].sample
end
end
|
require 'spec_helper'
describe "31179047 has_sage_flow_transitions throws an exception if the states referenced arent in the has_sage_flow_states lists" do |variable|
it "Throws an Exception when any states not in has_sage_flow_states" do
expect do
class Foo < Sample
has_sage_flow_states :new, :edi... |
class NotificationController < ApplicationController
def index
end
def get_vapid_keys
abort "really?".inspect
# save the keys in env file
require 'webpush'
vapid_key = Webpush.generate_key
hash = {
public_key: vapid_key.public_key,
private_key: vapid_key.private_key
}
... |
class FileSyncer
include Sidekiq::Worker
def perform (*files)
files.each do |file|
new_path = File.join( JoyFarm::API.settings.dist_folder , Pathname.new( file ).relative_path_from(
Pathname.new( JoyFarm::API.settings.public_folder )
) )
FileUtils::mkdir_p( File.dirname( new_path ... |
class RecipeImagesController < ApplicationController
before_action :set_recipe_image, only: [:show, :edit, :update, :destroy]
# GET /recipe_images
# GET /recipe_images.json
def index
@recipe_images = RecipeImage.all
end
# GET /recipe_images/1
# GET /recipe_images/1.json
def show
end
# GET /re... |
require_relative 'spec_helper.rb'
describe RPS::Invite do
it 'exists' do
expect(RPS::Invite).to be_a(Class)
end
describe '.initialize' do
it "generates a unique id for each invite" do
RPS::Invite.class_variable_set :@@counter, 0
expect(RPS::Invite.new(1,2).id).to eq(1)
expect(RPS::Invi... |
FactoryGirl.define do
factory :comment do
body "MyString"
association :user
association :request
end
factory :question do
title "Yo ho"
end
factory :image do
caption "MyString"
body ""
imageable nil
end
factory :request do
association :user
association :house
mes... |
# User : I want to update a bookmark
# ----setup---
# Visit the 'update bookmark' form for a particular bookmark.
# Fill in the form with new data – say, a new title – and submit it.
# ----test
# See the homepage, with the updated bookmark title (and the old one is gone).
feature 'Updating a bookmark' do
scenario ... |
class Course < ApplicationRecord
validates :course_name, presence: true
has_many :users
has_many :coursecontents
end
|
class CompleteChunkJob < ApplicationJob
queue_as :default
def perform(chunk)
chunk.completed_at = DateTime.now
chunk.save
ChunkFeedChannel.broadcast_to(chunk.chunk_feed, chunk)
puts "CHUNK #{chunk.title} HAS BEEN COMPLETED"
end
end
|
class Bookmark < ActiveRecord::Base
belongs_to :user
belongs_to :topic
has_many :likes, dependent: :destroy
after_create :set_embedly_attrs
validates :url, presence: true
scope :by_likes, -> { order('likes_count DESC') }
def set_embedly_attrs
embedly_api = Embedly::API.new(key: ENV['EMBEDLY_API_KE... |
class AddUserIdToBecarios < ActiveRecord::Migration
def change
add_reference :becarios, :user, index: true
end
end
|
class Vlan < ActiveRecord::Base
has_many :hosts
has_many :switch_ports
validates :name, :gateway, :netMask, :tag, :presence => true
validates :netMask, :gateway, :length => { :maximum => 15 }
validates :tag ,:length => { :maximum => 3}
end
|
# Log errors with Sentry.
require 'raven'
Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
config.environments = %w[ production staging ]
end
|
class AddArchiveToAsset < ActiveRecord::Migration
def change
add_column :assets, :archive_id, :string, :after => :source_asset_id
end
end
|
require 'vigil/task'
class Vigil
class StartVMTask < Task
private
def post_initialize(args)
@vagrant = args.fetch(:vagrant)
end
def name; 'start_VM'; end
def commands
r = @session.revision
[
@vagrant.add_box(r.complete_box_name, r.complete_box_path),
@vagrant... |
class CreateMovies < ActiveRecord::Migration
def self.up
create_table :movies do |t|
t.string :name
t.string :year
t.string :imdb_id
t.string :imdb_url
t.integer :imdb_grade
t.string :dn_url
t.integer :dn_grade
t.timestamps
end
end
def self.down
drop_t... |
require 'spec_helper'
describe "Static pages" do
subject { page }
describe "Home page" do
before { visit root_path }
it { should have_selector('h1', text: 'Welcome to GamePlaydate!') }
describe "for signed in users" do
let(:user) { FactoryGirl.create(:user, :with_events) } ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.