text stringlengths 10 2.61M |
|---|
# require_relative 'item'
class ItemParser
def make_item(file, sales_engine=nil)
contents = CSV.open(file, headers: true, header_converters: :symbol)
parse(contents, sales_engine)
end
private
def parse(contents, sales_engine=nil)
contents.map { |row| Item.new({
:id => row[:id],
... |
#:nodoc:
module RackReverseProxy
VERSION = "0.11.1".freeze
end
|
require 'test/unit'
require 'pathname'
require 'rubygems'
gem 'shoulda', '>= 2.10.1'
gem 'jnunemaker-matchy', '0.4.0'
gem 'mocha', '0.9.4'
gem 'fakeweb', '>= 1.2.5'
require 'shoulda'
require 'matchy'
require 'mocha'
require 'fakeweb'
FakeWeb.allow_net_connect = false
dir = (Pathname(__FILE__).dirname + '../lib').ex... |
#!/usr/bin/env ruby
require 'shellwords'
require_relative '../etc/git-helper/git_helper'
# Create a pull request from the current branch
# Usage:
# $ git-pullrequest-create
# $ git-pullrequest-create {remote}
# $ git-pullrequest-create {branch}
# $ git-pullrequest-create {remote} {branch}
# $ git-pullrequest-create {br... |
class ReviewsController < ApplicationController
def index
respond_to do |format|
format.html do
@anime = Anime.find(params[:anime_id])
preload_to_ember! @anime, serializer: FullAnimeSerializer, root: "full_anime"
render "anime/show", layout: "redesign"
end
format.json do
... |
require 'spec_helper'
describe ZipFips do
zip = 12345
fips = 36093
invalid_zip = -1
predicted_fips = 36749
it "should return the proper FIPS code for a ZIP code" do
expect(zip.to_fips).to eq(fips)
end
it "should return the proper ZIP code for a FIPS code" do
expect(fips.to_zip).to eq(zip)
en... |
require 'fileutils'
require 'haml'
require 'parser/current'
require_relative "analyst/parser"
require_relative "analyst/processor"
require_relative "analyst/version"
require_relative "analyst/entities/mixins/has_methods"
require_relative "analyst/entities/entity"
require_relative "analyst/entities/root"
require_relati... |
# frozen_string_literal: true
FactoryBot.define do
factory :receipt do
trait :with_lines do
transient do
lines_count { 3 }
quantity_present { 10 }
end
after(:create) do |receipt, evaluator|
create_list(
:inventory_line_with_product,
evaluator.lines_c... |
class AddConektaAttrsToEventPayments < ActiveRecord::Migration
def change
add_column :event_payments, :barcode_url, :string
end
end
|
# Definition for a Node.
# class Node
# attr_accessor :val, :children
# def initialize(val)
# @val = val
# @children = []
# end
# end
# @param {Node} root
# @return {List[int]}
def postorder(root)
result = []
return result if root == nil
stack1 = [] << root
stack2 = []
while(!st... |
# frozen_string_literal: true
# Copyright (c) 2019, Battelle Memorial Institute
# All rights reserved.
#
# See LICENSE.txt and WARRANTY.txt for details.
module PNNL
module BuildingId
# A UBID code area.
class CodeArea
attr_reader :centroid_code_area, :centroid_code_length, :north_latitude, :south_lati... |
require 'rails_helper'
RSpec.describe Exam, type: :model do
subject(:exam) { create(:exam) }
context 'valid exam' do
it { is_expected.to be_valid }
end
context 'when no name is specified' do
let(:invalid_exam) { build(:exam, attributes_for(:exam, :no_name)) }
it 'is invalid' do
expect(inva... |
require 'logger'
require 'http'
module LogDNA
class RubyLogger < ::Logger
include LogDNA
attr_reader :open
attr_accessor :api_key, :host, :default_app, :ip, :mac
def initialize(api_key, hostname, options = {})
@conn = HTTP.persistent LogDNA::INGESTER_DOMAIN
opts = fill_opts_with_default... |
require 'spec_helper'
describe EssaySearchRow do
subject { described_class.new(essay)}
let(:essay) { double(Essay, id: 1, title: 'title', author: "author", friendly_id: 'fid', issue: issue, essay_style: essay_style, cover_image: double(Image, url: 'url'), thumbnail_image: double(Image, url: 'thumbnail') )}
let(... |
require "minitest/autorun"
require "minitest/emoji"
require_relative "program"
class ProgramTest < Minitest::Test
def test_it_exists
program = Program.new
assert_instance_of Program, program
end
def test_program_can_return_sock_count
skip
program = Program.new
n = 3
ar = [10,20,20]
a... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
end
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requ... |
module EasyBudgetsheet
module TimeEntryPatch
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
before_save :check_easy_is_billable
safe_attributes 'easy_is_billable', 'easy_billed'
def easy_is_billable
... |
Pod::Spec.new do |s|
s.name = "BugfenderLive"
s.version = "0.1.3"
s.summary = "Screen sharing to debug your mobile app"
s.description = <<-DESC
Bugfender Live lets customer support representatives see the screen of their users in real time.
DESC
s.home... |
require 'rails_helper'
RSpec.describe Wiki, type: :model do
let(:user) { create(:user) }
let(:wiki) { create(:wiki, user: user) }
it { should belong_to(:user) }
it { should have_many(:users).through(:collaborators) }
it { should validate_presence_of(:title) }
it { should validate_presence_of(:body) }
... |
Shipwire.configure do |config|
# Note there is a difference between an account registered from
# https://www.shipwire.com/ and one registered from https://beta.shipwire.com/
#
# If you create an account from https://www.shipwire.com/ and then request
# data from the beta URL, the API will throw errors about a... |
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let!(:user){create(:user)}
describe 'PATCH #update' do
context 'User is trying to update username' do
it 'assigns the requested user to @user' do
patch :update, id: user, user: attributes_for(:user), format: :json
... |
require_relative 'digit'
class Account
attr_reader :digits, :account_number
def initialize(digits)
@digits = digits
@account_number = digits_to_account_number
end
def checksum
checksum_total = 0
@account_number.reverse.each_char.with_index(1) do |digit, index|
checksum_total +... |
class UserSkillsController < ApplicationController
before_action :set_user_skill, only: [:destroy, :update]
before_action :user_skill_params, only: [:user_skills, :update]
before_action :authenticate_user!, only: [:user_skills,:destroy,:update]
before_action :check_user, only: [:user_skills]
befo... |
class Account < ApplicationRecord
validates :holder_name, presence: true
validates :balance, numericality: { greater_than_or_equal_to: 0 }
paginates_per 50
def hold(amount)
return false if balance < amount
self.balance -= amount
end
def top_up(amount)
self.balance += amount
end
end
|
require 'test/unit'
require File.join(File.dirname(__FILE__), '..', 'lib', 'board') # require './../lib/board'
class BoardTest < Test::Unit::TestCase
def setup
@board = Board.new
end
def test_board_to_s
str = @board.to_s
expected = <<-BOARD
---
---
---
BOARD
assert_equal str, expected
end... |
class RemoveLanguageReferenceFromGroupMemberships < ActiveRecord::Migration[6.0]
def change
remove_column :group_memberships, :language_id
change_column_default :group_memberships, :points, 0
end
end
|
require 'wechat_pay/signature'
require 'wechat_app'
module WechatPay
module Shipping
def ship options={}
instance = @order.instance
default_options = {
appid: instance.app_id,
openid: @order.customer.openid,
transid: @order.transid,
ou... |
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user, :client
include ApplicationHelper
def connect
if is_logged?
self.current_user = find_verified_user
else
self.client = find_verified_client
end
end
private
... |
RailsOnForum::Application.routes.draw do
#devise_for :user
namespace :api, defaults: {format: :json} do
resources :users,:topics,:forums,:sessions
#devise_for :users, controller: { sessions: 'api/sessions' }
end
get '/login', to: 'sessions#new', as: :login
delete '/logout', to: 'sessions#destroy', as... |
class ReservationsRoomDate < ApplicationRecord
belongs_to :reservation
belongs_to :room_date
enum check: [:check_in, :check_out]
end |
class Webinar < ActiveRecord::Base
belongs_to :user
has_many :votes
has_many :stars
validates :user_id, :title, :description, :planned_date, presence: true
validates :youtube_url, :language, presence: true, if: :webinar_aired?
validate :language_option_is_valid, if: :webinar_aired?
validate :youtube_url... |
# encoding: UTF-8
PryParsecom::Commands.create_command "show-credentials" do
group 'Parse.com'
description 'Show credentials for parse.com'
def options opt
opt.banner unindent <<-EOS
Usage: show-credentials
Show parse.com credentials: application_id, rest_api_key and master_key.
EOS
end
... |
module Api
class CampaignsController < ApplicationController
protect_from_forgery with: :null_session
#the index function corresponds to the HTTP GET request. No parameters needed for this
def index
#get all the campaigns
@campaigns = Campaign.first(200)
if(@campaigns!= nil)
... |
require "rails_helper"
RSpec.describe TransferParticipantToUser, type: :model do
describe "#call" do
it "updates a participant to a user" do
fake_adapter = spy
call = create(:incoming_call)
participant = create(:participant, call: call)
user = create(:user_with_number)
result = des... |
class Clippson < Formula
desc "Helper library of clipp, command-line parser for C++"
homepage "https://github.com/heavywatal/clippson"
url "https://github.com/heavywatal/clippson/archive/v0.8.3.tar.gz"
sha256 "c1a659a1fffa716a53ade9618a3ae8a3c7a0f7c9b8238b7e26c7e3e11f5590ce"
head "https://github.com/heavywata... |
FactoryGirl.define do
factory :customer do
name "MyString"
address "MyString"
city "MyString"
state "MyString"
zipcode "MyString"
end
end
|
module Moon
class Input
# @return [Hash<Symbol, Array<String>>]
KEY_TO_HUMAN = {
space: %w[Spacebar],
apostrophe: %w[' "],
comma: %w[, <],
minus: %w[- _],
period: %w[. >],
slash: %w[/ ?],
n0: %w[0 )],
n1: %w[1 !],
n2: %w[2 @],
n3: %w[3 #],
n4: ... |
class AddTeamIdToResults < ActiveRecord::Migration
def change
add_column :results, :team_id, :integer
add_index :results, :team_id
add_index :results, :league_id
end
end
|
class BabyInfantFeedingsController < ApplicationController
before_action :authenticate_user!
before_action :set_baby, :initialize_data
def new
@baby_infant_feeding = @baby.baby_infant_feedings.build
end
def create
if @baby.update(baby_infant_feeding_params)
flash[:success] = "created successfu... |
require 'rails_helper'
RSpec.describe "Api::V1::Teams", Type: :request do
describe "get /teams/:team_id/schedule" do
it "returns the team and the teams's games" do
sport = Sport.create(
name: "Football"
)
sub_sport = SubSport.create(
name: "NFL",
sport_id: sport.id,
... |
class Bpromotion < ActiveRecord::Base
belongs_to :brecord, :foreign_key => 'bobjid'
def promdate
self[:bpromdate].to_s(:db)
end
end
# == Schema Information
#
# Table name: bpromotions
#
# bobjid :integer(10)
# bpromdate :datetime
# brelproc :string(16)
# blevelid :integer(5)
# ble... |
=begin
#Location API
#Geolocation, Geocoding and Maps
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 3.3.4
=end
require 'spec_helper'
require 'json'
# Unit tests for unwiredClient::REVERSEApi
# Automatically generated by openapi-generator (https://openapi-gener... |
Rails.application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
root :to => "stocks#index"
# Routes for the Downvote resource:
# CREATE
get("/downvotes/new", { :controller => "downvotes", :action => "new_form" })
post("/create_downvote", { :controller => "dow... |
class Message < ActiveResource::Base
belongs_to :discussion
belongs_to :user
self.element_name = 'message'
self.collection_name = 'messages'
end
|
class Task
attr_reader :id, :description
attr_accessor :done, :deadline, :date
def initialize(id, description, done, deadline)
@id = id
@description = description
@done = done
@deadline = deadline
@date = Time.now.strftime("%Y-%m-%d").to_s
end
def done? #car done est le seul qui change
... |
class AddPredictorFormToFixtures < ActiveRecord::Migration
def change
add_column :fixtures, :phform, :integer
add_column :fixtures, :phgames, :integer
add_column :fixtures, :paform, :integer
add_column :fixtures, :pagames, :integer
end
end
|
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable,
:registerable,
:recoverable,
:rememberable,
:trackable,
:validatable,
... |
require 'codewars'
describe Codewars do
let(:codewars) { Codewars.new }
it "should return a negative value #1" do
actual = codewars.make_negative(1)
expected = -1
expect(actual).to eq(expected)
end
it "should return a negative value #2" do
actual = codewars.make_negative(-5)
expected = -... |
require 'rails_helper'
RSpec.describe MemorialsController, :type => :controller do
before do
@user = User.create(name: "Jon", email_address: "jon@example.com", password: "123456", password_confirmation: "123456")
@memorial = Memorial.create(moderator: @user, deceased_name: "Father")
end
describe 'GET #i... |
# :nodoc:
class Train
include Producer, Validation # , Valid
# NUMBER = /^([a-z]{3}|\d{3})-([a-z]{2}|\d{2})$/i
NUMBER = /^\d{3}$/
attr_accessor :speed
attr_reader :type, :number, :cars
@trains = []
def initialize(number, type)
@number = number
@type = type
validate!
@speed = 0
@car... |
class FoodsController < ApplicationController
before_action :authenticate_user!, only: [:index, :new, :create, :destroy, :edit, :update]
def index
@foods = Food.order(:comida)
@food = Food.new
end
def new
@food = Food.new
end
def create
@food = Food.create(food_params)
if @food.... |
class QuotesController < ApplicationController
def index
@quotes = Quote.all
end
def new
@quote = Quote.new
end
def create
@quote = Quote.new(params[:quote])
if @quote.save
redirect_to quotes_path
else
render :new
end
end
def edit
@quote = Quote.find(params[:id])... |
require 'spec_helper'
describe TransactionCancellationsController do
include Devise::TestHelpers
it "should authenticate the other Antorcha by oauth or other means."
it <<-TEXT
The user action should be moved to the message controller.
It needs authentication from this object in order to cancel th... |
require 'spec_helper'
describe('the chef path') do
describe('home page', {:type => :feature}) do
it('allows you to add a new recipe and display a form to edit that recipe.') do
visit('/')
fill_in('name', with: "Austin's wedding cake")
click_button('+')
expect(page).to have_content("Austin... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'omniauth-northwestern-medicine/version'
Gem::Specification.new do |spec|
spec.name = 'omniauth-northwestern-medicine'
spec.version = OmniAuth::NorthwesternMedicine::VERSION
s... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe User, type: :model do
let(:user) { User.new(email: 'test@test.com') }
it 'nameが入っていないと無効' do
expect(user).to_not be_valid
end
let(:user) { User.new(name: 'test') }
it 'emailが入っていないと無効' do
expect(user).to_not be_valid
end
end
|
require "aethyr/core/actions/commands/command_action"
module Aethyr
module Core
module Actions
module Deleteme
class DeletemeCommand < Aethyr::Extend::CommandAction
def initialize(actor, **data)
super(actor, **data)
end
def action
event = @data... |
require "dalli"
def cache(timeout, cache_key)
mc = Dalli::Client.new(ENV['MEMCACHE_SERVERS'],
:username => ENV['MEMCACHE_USERNAME'],
:password => ENV['MEMCACHE_PASSWORD'],
:expires_in => 300)
rv = mc.get(cache_key)
return rv if rv
rv = yield
mc.set(cache_key, rv, ti... |
FactoryGirl.define do
sequence(:name) { |n| "#{Faker::Lorem.word} #{n}" }
sequence(:email) { |n| "#{Faker::Internet.email}#{n}" }
sequence(:color) do |n|
["#27ae60", "#2980b9", "#d35400", "#f39c12", "#8e44ad"][(n % 5)]
end
sequence(:title) do |n|
"#{Faker::Lorem.word} #{n}"
#["Work", "Personal", ... |
#!/usr/bin/env ruby
#
# Pandigital multiples
# http://projecteuler.net/problem=38
#
# Take the number 192 and multiply it by each of 1, 2, and 3:
#
# 192 × 1 = 192
# 192 × 2 = 384
# 192 × 3 = 576
#
# By concatenating each product we get the 1 to 9 pandigital, 192384576. We will
# call 192384576 the concatenated p... |
Fabricator(:owner) do
name { Faker::Pokemon.name }
end
|
Pod::Spec.new do |s|
s.name = 'CardSlider'
s.version = '0.1.0'
s.summary = 'UI control from Ramotion'
s.description = 'Custom UICollectionView with transition'
s.homepage = 'https://github.com/ramotion/cardslider'
s.license = 'MIT'
s.author... |
if defined?(ActionMailer)
class CapFormMailer < Devise::Mailer
include Devise::Controllers::UrlHelpers
include Devise::Mailers::Helpers
def cap_form_submission(cap_params)
orgname = cap_params[:orgname]
address = cap_params[:street_address]
city = cap_params[:city]
state = cap_pa... |
Gem::Specification.new do |s|
s.name = 'pServer'
s.version = '0.0.0'
s.executables << 'pserver'
s.date = '2017-08-23'
s.summary = "a simple HTTP server"
s.description = "a simple HTTP server"
s.authors = ["Ellis W.R. Sutko"]
s.email = 'esutko@gmail.com'
s.files = ... |
class Section < ApplicationRecord
has_many :enrollments
has_many :students, through: :enrollments
belongs_to :course
end
|
class CreatePhotos < ActiveRecord::Migration
def self.up
create_table :photos do |t|
t.integer :post_id
t.integer :album_id
t.string :file_name
t.string :file_type, :limit => 4
t.string :caption
t.integer :is_active, :def... |
class SmoochWorker
include Sidekiq::Worker
include Sidekiq::Benchmark::Worker
sidekiq_options queue: 'smooch', retry: 3
sidekiq_retry_in { |_count, _exception| 20 }
def perform(json_message, type, app_id, request_type, annotated)
annotated = YAML.load(annotated)
User.current = BotUser.smooch_user
... |
require 'rails_helper'
RSpec.describe Attribution::Report, :type => :model do
before(:all) { Holiday.reseed! }
describe 'when calculating reports' do
before(:each) { @date = Date.civil(2015, 2, 4) }
let(:report) do
@date = Date.civil(2015, 2, 4)
report = Attribution::Report.new :start_date... |
class AddStatusToListings < ActiveRecord::Migration
def change
remove_column :listings, :status
add_column :listings, :status_id, :integer
end
end
|
class AddCreateUserRefToApp < ActiveRecord::Migration
def change
add_reference :apps, :create_user, index: true
end
end
|
require 'rubspot/representers/contact_representation'
module Rubspot
class Contact < Rubspot::Base
attr_accessor :vid, :email, :firstname
def initialize(opts = {})
opts.each do |opt|
instance_variable_set("@#{opt[0]}", opt[1])
end
end
def self.find_by_email(email)
respons... |
require 'digest/sha1'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class AuthorizeNetCimGateway < Gateway
# The following methods are for compatibility with
# other stored-value gateways
# Create a payment profile
def store(creditcard, options = {})
profile = {
... |
require 'spec_helper'
describe PostMailer do
describe 'send_to_all' do
let(:post) { create(:post, items: [create(:item, title: '"Winning"',description: 'Like this & like "that"')]) }
let(:mail) { PostMailer.send_to_all(post) }
it 'sets the title to be the posts title' do
mail.subject.should == pos... |
class Passenger < ApplicationRecord
# Basic regular expression to check for legit emails
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :name, presence: true
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }
has_many :passenger_bookings
has_many :bookings, through: :pas... |
require 'rails_helper'
describe Comment do
let(:comment){ create(:comment) }
#should this be build or create?
#Check Validations
it 'has valid attributes' do
expect(user).to be_valid
end
it 'is not valid if body is empty' do
new_user = build(:user, body: "")
expect(new_user).not_... |
require "./lib/mixpanel_test"
require "./lib/mixpanel_test/service"
require "uri"
require "net/http"
require "rspec"
TEST_PORT = 3004
describe MixpanelTest::Service do
before(:all) do
lambda {
Net::HTTP.get(URI("http://localhost:#{TEST_PORT}"))
}.should raise_error Errno::ECONNREFUSED
@service ... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Brcobranca::Remessa::Cnab240::Ailos do
let(:pagamento) do
Brcobranca::Remessa::Pagamento.new(valor: 199.9,
data_vencimento: Date.current,
nosso_numero: 123,
... |
require_relative '../lib/calculate_views.rb'
describe CalculateViews do
let(:webpages) { ['/home', '/contact/', '/home', '/contact/', '/index', '/about', '/products/3', '/about', 'products/1', '/products/2'] }
let(:results) { [["/home", 2], ["/contact/", 2], ["/about", 2], ["/index", 1], ["/products/2", 1], ["pro... |
FactoryGirl.define do
factory :user do
email 'foo@bar.com'
login 'Test foo'
password 'bar'
password_confirmation 'bar'
end
end
|
class UsersController < ApplicationController
def index
@stamps = Stamp.all
end
def new
@page_title = 'Add New Stamp'
@stamp = Stamp.new
end
def create
@stamp = Stamp.new(stamp_params)
@stamp.user_id = params[:id]
if @stamp.save
flash[:notice] = "Stamp created!"
redirect_... |
FactoryBot.define do
factory :api_key do
association :client, strategy: :build
sequence(:name) { |n| "User #{n}"}
trait :admin do
client { nil }
end
end
end
|
class Booking < ApplicationRecord
belongs_to :session
# belongs_to :parent, class_name: "User", foreign_key: :user_id, polymorphic: true
belongs_to :user
# has_one :activity, through: :sessions
# has_one :instructor, through: :sessions
def parent
User.find(self.user_id)
end
def parent=(new_parent)... |
class RoundController < ApplicationController
get '/rounds' do
Round.all.to_json
end
get '/rounds/:id' do |id|
round = Round.first(:id => id)
halt(404, { message:'Round Not Found'}.to_json) unless round
round.to_json
end
post '/rounds' do
@round = Round.new(json_para... |
require 'dotenv'
Dotenv.load
require './lib/shorturl'
namespace :db do
desc "migrate database"
task :migrate do
print 'migrating database... '
require 'dm-migrations'
DataMapper.auto_upgrade!
puts 'done.'
end
end
namespace :server do
desc "start server"
task :start do
system "shotgun"... |
class CityDistance < ApplicationRecord
belongs_to :origin, class_name: 'City'
belongs_to :destination, class_name: 'City'
end
|
class RemovePendingSyncFromUsers < ActiveRecord::Migration
def change
remove_column :users, :pending_vaults_sync
end
end
|
FactoryGirl.define do
factory :user do
first_name "foo"
last_name "bar"
email "foo@bar.com"
password "foo_bar"
# Validation failed: Property can't be blank, Closing subject loan can't be blank, Current subject loan can't be blank... |
require "minitest/autorun"
require_relative "rocket"
class RocketTest < Minitest::Test
# Write your( tests here!
def test_initalize_default_value_change_name
rocket = Rocket.new(name: "Bob")
vaild = rocket.name
assert_equal(vaild, "Bob" )
end
def test_initalize_default_value_change_colour
rock... |
class CreateBuilds < ActiveRecord::Migration
def self.up
create_table :builds do |t|
t.integer "project_id"
t.string "label", :null => false
t.integer "build_number"
# t.string "status"
t.datetime "start_time"
t.datetime "finish_time"
t.integer "num_total"
t.integer... |
class RecentItem < ActiveRecord::Base
belongs_to :visitor, class_name: 'User'
belongs_to :recentable, polymorphic: true
scope :latest, -> { order( created_at: :desc ).limit(13) }
scope :full_history, -> { order( created_at: :desc ) }
before_create :check_dupe
def human_recentable
if recentable.class ... |
class CreateLandingPageInfos < ActiveRecord::Migration
def self.up
create_table :landing_page_infos do |t|
t.column :landing_page_id, :int
t.column :created_at, :datetime
t.column :updated_at, :datetime
t.column :seo_text, :text
t.column :meta_description, :string, :length =... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) not null
# facebook_id :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
# firstname :string(255)
# lastname :strin... |
class CreateReturns < ActiveRecord::Migration
def change
create_table :returns do |t|
t.integer :product_id
t.timestamp
end
end
end
|
class ReceiveSnsEmailDeliveryService < CivilService::Service
def self.kms_client
@kms_client ||= Aws::KMS::Client.new
end
def self.s3_client
@s3_client ||= Aws::S3::Encryption::Client.new(
kms_key_id: 'alias/aws/ses',
kms_client: kms_client
)
end
def self.ses_client
@ses_client |... |
#
# Cookbook Name:: JQueryFileUploadSandbox
# Recipe:: default
#
# Copyright 2012, Mylen
#
# All rights reserved - Do Not Redistribute
#
# Platform-specific configuration
case node["platform"]
when "centos", "redhat", "fedora"
include_recipe "rpmforge"
include_recipe "selinux::disabled"
when "debian", "ubuntu"
# ... |
require 'easy_extensions/easy_xml_data/importables/importable'
module EasyXmlData
class AttachmentImportable < Importable
def initialize(data)
@klass = Attachment
super
end
def mappable?
false
end
def create_record(xml, map)
attachment = super
attachment.... |
FactoryBot.define do
factory :game, class: Game do
association :round, factory: :round
after :build do |game|
home_team = FactoryBot.create(:team, tournament: game.round.tournament)
guest_team = FactoryBot.create(:team, tournament: game.round.tournament)
game.home_team = home_team
gam... |
require 'logging'
module WsdlMapper
module Parsing
module Logging
class LogMsg
def initialize(node, source, msg = '')
@node = node
@source = source
@node_name = node && node.name
@msg = msg
end
def to_s
"#{@msg}: #{@node} - #{@sour... |
# 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... |
require "study_client/version"
require "json_api_client"
module StudyClient
class Base < JsonApiClient::Resource
self.site = ENV['STUDY_URL']
end
class Node < Base
def cost_code
attributes['cost-code']
end
end
class Collection < Base
# This 'collection... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.