text stringlengths 10 2.61M |
|---|
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'jumpit' do
# Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
# Pods for jumpit
# Required by RNFirebase
pod 'Firebase/Core', '~> 6.3.0'
pod 'GoogleIDFASupport', '~> 3.14.... |
class BookAssignment < ApplicationRecord
belongs_to :user
belongs_to :book, polymorphic: true
has_many :feeds, dependent: :destroy
has_many :subscriptions, dependent: :destroy
has_many :delayed_job_for_emails, through: :feeds
has_many :delayed_job_for_webpushs, through: :feeds
scope :by_unpaid_users, -> ... |
# Copyright (c) 2015 - 2020 Ana-Cristina Turlea <turleaana@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS... |
require "colorize"
module Lib
class Scenario
class << self
#
# [ITERATION]
# $schd: omi schedule delete schedule=$
#
def get_pkey
key = ARGV.select{ |a| a.start_with?("pkey_") }.first
key
end
def get_skey
key = ARGV.select{ |a| a.s... |
class FavouritesController < ApplicationController
before_action :find_recipe, except: :user_favourites
before_action :authenticate_user!
def create
@favourite = Favourite.new(myrecipe: @myrecipe)
@favourite.user = current_user
if @favourite.save
redirect_to @myrecipe, notice: 'this recipe is... |
module WLang
class Parser
#
# Encapsulates all state information of a WLang parser
#
class State
# The attached parser
attr_accessor :parser
# The parent state
attr_accessor :parent
# The current hosted language
attr_accessor :hosted
... |
require 'bundler'
require 'pp'
require 'csv'
require_relative 'conf_loader/override_reconciliation.rb'
require_relative 'conf_loader/group_hash.rb'
class ConfLoader
attr_reader :overrides, :file_path
$overrides_count = Hash.new
$group_name = nil
GROUP_PATTERN = /^\[[^\]\r\n]+\](?:\r?\n(?:[^\[\r\n].*)?)*/
E... |
require 'spec_helper'
RSpec.describe "Rate", type: :feature, vcr: true do
context "find" do
it "is successful with existing items" do
VCR.use_cassette("rate_find") do
response = Shipwire::Rate.new.find(payload)
expect(response.ok?).to be_truthy
expect(response.body["resource"]["rat... |
# Read about factories at http://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :area_code do
sequence(:name) { |n| "AreaCode #{n}" }
sequence(:area_code) { |n| "#{n}" }
association :country
end
end |
require 'rake/testtask'
require 'rdoc/task'
require 'fileutils'
GEMSPEC = 'ivar_encapsulation.gemspec'
Rake::TestTask.new do |t|
t.pattern = 'test/test_*.rb'
end
Rake::RDocTask.new do |rd|
rd.rdoc_dir = 'doc/'
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
rd.title = 'ivar_encap... |
class ResourcesController < ApplicationController
before_filter :authorize, :except => [:list, :new, :create, :show]
layout "nosidebar"
def list
@title = "Indonesian Language Resources"
@resources = Resource.reviewed
render :layout => 'resource'
end
# GET /resources
# GET /resources.xml
... |
class AddColumnBreakToPractiAvail < ActiveRecord::Migration
def change
add_column :practi_avails, :all_break, :text
end
end
|
namespace :statuses do
desc "Tasks for pre-loading default status data."
# Colors taken from here http://www.bbc.co.uk/gel/guidelines/how-to-design-infographics
task seed: :environment do
#Danger!
Status.destroy_all
#now create
Status.create!([{
name: "Not started",
description: "We h... |
require 'rails_helper'
RSpec.describe Auth::Slack do
describe 'POST /api/v1/auth/slack' do
it 'returns an auth token' do
auth_double = instance_double(
SlackAuth,
user_info: {
'name' => 'John Doe',
'email' => 'foo@bar.com'
}
)
expect(SlackAuth).to re... |
#Create a class called Deli that has one instance variable: line.
#In our deli, we should be able to call "take a number" that takes a customer's name, appends their number to their name and #adds them to the line.
#The line could look like this: ["1. Ashley", "2. Steve", "3. Blake"]
#Additionally we should be a... |
class ApplicationController < ActionController::Base
add_flash_types :success, :warning, :danger, :info
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, alert: exception.message
end
end
|
FactoryGirl.define do
factory :comment do
sequence :description do |n|
"the contribution to the event test ##{n}"
end
end
end
|
module Crawlers
module Dia
class UpdateCrawler < Crawlers::ApplicationCrawler
DIA_PRODUCTS = Product.where(market_name: 'dia')
class << self
def execute
update_dia_products
end
private
def update_dia_products
DIA_PRODUCTS.each do |product_model|
... |
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.box_check_update = false
config.vm.provider 'virtualbox' do |box|
box.cpus = 1
box.memory = "512"
end
config.vm.provision :shell,
:preserve_order => true,
:inline => "ech... |
Given /^I am logged into the mobile website$/ do
visit(HomePage) do |page|
page.mainmenu_button
page.login_button
end
on(LoginPage) do |page|
page.login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
if page.text.include? "There is no user by the name "
puts ENV["MEDIAWIKI_USER"] + " does ... |
# frozen_string_literal: true
require_relative './spec_helper.rb'
describe 'Rubygems_call specifications' do
before do
VCR.insert_cassette RUBYGEMS_CASSETTE_FILE, record: :new_episodes
@object = ApiCall::RubyGemsCall.new(ENV['GEM_NAME'])
end
after do
VCR.eject_cassette
end
it 'should be able new... |
class WorkfileName
def self.resolve_name_for!(workfile)
if Workfile.exists?(:file_name => workfile.file_name, :workspace_id => workfile.workspace_id)
index = workfile.file_name.rindex(".")
length = workfile.file_name.length
base_file_name = workfile.file_name[0..(index - 1)]
extension = wo... |
require './src/tokenizer/lexer'
require './src/tokenizer/errors'
require './spec/contexts/lexer'
RSpec.describe Tokenizer::Lexer, 'error handling' do
include_context 'lexer'
describe '#next_token' do
it 'raises an error for declaring a variable with a reserved name' do
mock_reader(
"空は 10\n"
... |
class AddRankingToCompetitionRosters < ActiveRecord::Migration[4.2]
def change
add_column :competition_rosters, :ranking, :integer, null: true
end
end
|
class Part < ActiveRecord::Base
include UUIDRecord
attr_accessible :description, :name, :program_order, :program_uuid, :uuid
belongs_to :program, primary_key: 'uuid', foreign_key: 'program_uuid'
has_many :steps, primary_key: 'uuid', foreign_key: 'part_uuid'
validates :program_uuid, presence: true
# todo... |
class AddCompleteToMustdos < ActiveRecord::Migration
def change
add_column :mustdos, :complete, :boolean, default: false
end
end
|
s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fu... |
require 'pry'
class MP3Importer
attr_accessor :path
# @@all = []
def initialize(path)
@path = path
# @@all << self
end
def files
file_list = Dir.entries(@path)
file_list.select do |file|
file.chars.last(4).join == ".mp3"
end
# file... |
class InStorePromotersController < ApplicationController
layout 'admin'
before_action :confirm_logged_in
def index
@in_store_promoters = InStorePromoter.sorted
end
def show
@in_store_promoter = InStorePromoter.find(params[:id])
end
def new
@in_store_promoter = InStorePromoter.new({:firstn... |
require 'bitwrap/graph'
require 'bitwrap/matrix'
module Bitwrap
class StateVector
include Matrix
attr_accessor :transitions,
:places
def initialize(schema)
@graph = Graph.new
@places = []
@transitions = {}
nodes schema['nodes']
edges schema['edges']
... |
require "rails_helper"
RSpec.describe Booking, type: :model do
let!(:bill) {FactoryBot.create :bill}
let!(:booking){FactoryBot.create :booking, bill: bill}
let!(:booking2){FactoryBot.create :booking, bill: bill}
let!(:booking3){FactoryBot.create :booking}
let(:booking4){FactoryBot.build :booking, price: " "}
... |
require 'test_helper'
class ContactTest < ActiveSupport::TestCase
def setup
@contact = Contact.new(name: "Example User", email: "user@example.com",
message: "This is a message")
end
test "should be valid" do
assert @contact.valid?
end
test "email should be present" do
... |
require "test_helper"
describe OrdersController do
before do
@orders = Order.all
end
describe "index" do
it "sends a success response when there are many orders" do
@orders.count.must_be :>, 0
get orders_path
must_respond_with :success
end
it "sends a success response when the... |
require 'happymapper'
module DublinBikes
class ApiStation
include HappyMapper
tag 'station'
element :available, Integer
element :free, Integer
element :total, Integer
element :ticket, Integer
element :open, Integer
element :updated, Integer
element :connected, Integer
end
end
|
include Java
import java.awt.Color
import java.awt.BasicStroke
import java.awt.geom.GeneralPath
require 'scorched_earth/renders/trajectory'
module ScorchedEarth
module Renders
class Shot
attr_reader :shot
def initialize(shot)
@shot = shot
end
def call(graphics, *_args)
... |
class Api::SettingsController < ApplicationController
before_action :login_required
before_action :find_fluentd
before_action :set_config
before_action :set_target_element, only: [:show, :update, :destroy]
helper_method :element_id
def index
respond_to do |format|
format.json
end
end
def... |
# frozen_string_literal: true
class ChangeTeachQuideToTeachingGuideOnChapters < ActiveRecord::Migration[5.2]
def change
rename_column :exploding_dots_chapters, :teaching_quide, :teaching_guide
end
end
|
require "spec_helper"
describe Fuzzy::Finder do
let(:fuzzyfinder) { described_class }
before :all do
@collection = [
"django_migration.py",
"main_group.rb",
"api_user.rb",
"user_doc.rb",
"migration.rb",
"admin.rb",
"admin22.rb"
]
end
describe ".find" do
... |
# Install command-line tools using Homebrew
# Usage: `brew bundle Brewfile`
tap thoughtbot/formulae
install rcm
# Make sure we’re using the latest Homebrew
update
# Upgrade any already-installed formulae
upgrade
# Install GNU core utilities (those that come with OS X are outdated)
# Don’t forget to add `$(brew --pr... |
module Language
# Prepends an a/an to the beginning of the string if it starts with a vowel.
def a_an string
string.downcase.match(/^[aeiou]/) ? "an #{string}" : "a #{string}"
end
# Prepends an A/An to the beginning of the string if it starts with a vowel.
def cap_a_an string
string.downcase.match(/... |
FactoryGirl.define do
factory :event, :class => AuthForum::Event do |f|
f.sequence(:name) { |n| "Event #{n}"}
f.sequence(:title) { |n| "Product event #{n}"}
f.sequence(:description) { |n| "Sample event #{n} for test"}
association :product, factory: :product
end
end |
require 'test_helper'
class ImageTest < ActiveSupport::TestCase
def test_image__valid
image_valid = Image.new(imagelink: 'https://images.pexels.com/photos/33053/dog-young-dog-small-dog-maltese.jpg?cs=srgb&dl=animal-dog-maltese-33053.jpg&fm=jpg', tag_list: 'foo') # rubocop:disable Metrics/LineLength
assert_pr... |
# 汎用メソッド用クラス
class Utility
#----------------------------#
# self.error_message_replace #
#----------------------------#
# エラーメッセージ置換
def self.error_message_replace( args )
message = args[:message]
message = message.gsub( "errors prohibited this user from being saved", "エラー" )
message = message.gs... |
class Relationship < ApplicationRecord
#followモデルはこの場で作った架空のモデル
# belongs_to :followerだけだと、followモデルが見つからないというエラーになるので
# class_name:"User"と定義することで、Userテーブルのレコードを参照してくれる
belongs_to :follower, class_name:"User"
#followedモデルは存在しないので、userモデルにbelongs_to
belongs_to :followed, class_name:"User"
end
|
module Paperclip
class StringioAdapter < AbstractAdapter
def self.register
Paperclip.io_adapters.register self do |target|
StringIO === target
end
end
def initialize(target, options = {})
super
cache_current_values
end
attr_writer :content_type
private
d... |
class Piece
def initialize
end
def inspect
"P"
end
end
class NullPiece
def initialize
end
def inspect
" "
end
end
|
require 'spec_helper'
describe Turn do
before(:each) do
@player = Player.new(1)
end
describe "#start" do
it "scores 0 when a user eventually fails to roll any scoring dices" do
turn = Turn.new(@player)
turn.stub(:gets).and_return("roll")
turn.start
expect(turn.score()).to eq(0)
en... |
require 'test_helper'
class DummyNode < Node
end
class NodeTest < ActiveSupport::TestCase
test 'must have a type' do
node = Node.new
assert !node.save
assert node.errors[:type].present?
end
test 'must have name' do
node = DummyNode.new :name => nil
assert !node.save
assert node.errors[... |
require File.dirname(__FILE__) + '/../test_helper'
require 'line_items_controller'
# Re-raise errors caught by the controller.
class LineItemsController; def rescue_action(e) raise e end; end
class LineItemsControllerTest < Test::Unit::TestCase
fixtures :line_items, :orders, :products
def setup
@controller ... |
Rails.application.routes.draw do
devise_for :users, controllers: {registrations: "users/registrations", sessions: "users/sessions"}
# Static Page
# ===========
get "/private", to: "static_pages#private", as: "private_page"
get '/rejected', to: "static_pages#invalid_auth", as: "invalid_auth"
# System
# =... |
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :first_name, presence: true
validates :last_name, presence: true
validates :city, presence: true
validates :state, presence: true
validates :phone, presence: true
... |
# t.string :title
# t.string :slug
# t.attachment :cover
# t.text :short_description
# t.text :description
# t.boolean :published
# t.integer :position
# t.boolean :main
# t.date :start_date
# t.date :date_of
class Promotion < ActiveRecord::Base
# self.table_name = :promotions
attr_accessible *attribute_names
... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
# write routes, combination of method and paths
# VERB(method) + PATH => (which controllers and which action)
# get "/squeaks", to: "squeaks#index" #standard way of writing ... |
require 'rails_helper'
RSpec.describe "Artists API" do
let!(:user) { create(:user) }
let!(:member_source_type) { create(:member_source_type)}
let!(:member_type) { create(:member_type) }
let!(:account_status_type) { create(:account_status_type)}
let!(:member) { create(:member, member_source_type_id:member_sou... |
module Fog
module Hetznercloud
class Compute
class ServerType < Fog::Model
identity :id
attribute :name
attribute :description
attribute :cores
attribute :memory
attribute :disk
attribute :prices
attribute :storage_type
end
end
end... |
# Documentation
class Persona
attr_accessor :name, :lastname, :identificacion, :telefono, :productos
def initialize(name, lastname, identificacion, telefono)
@name = name
@lastname = lastname
@identificacion = identificacion
@telefono = telefono
@productos = []
end
end
|
child @items => "items" do
attributes :id , :name, :category_id, :category_name, :menu_id
node(:rating){|r| r.avg_rating}
child :item_photos => "item_images" do
node :image do
|v| v.photo.fullpath if v.photo
end
end
#child :item_keys => "item_keys" do
# attrib... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), %w(.. lib tenacious_g)))
location = GRATR.location
unless File.exist?(location)
puts "There are no graphs to delete. Exiting."
exit
end
puts "This will remove all graphs stored in #{location} \nAre you sure you want to do this? (... |
class AddPasswordDigestToUsers < ActiveRecord::Migration
#This adds the password HASH column to the database
def change
#adding a password column to the database migration
add_column :users, :password_digest, :string
end
end
|
# frozen_string_literal: true
module RakutenWebService
module StringSupport
refine String do
def to_snake
gsub(/([a-z]+)([A-Z]{1})/, '\1_\2').downcase
end
def to_camel
gsub(/([a-z]{1})_([a-z]{1})/) do |matched|
matched = matched.split('_')
matched[0] + match... |
module Shipwire
class ParamConverter
attr_reader :params
def initialize(params)
if params.is_a?(Array)
@params = params.each_with_object([]) do |item, hsh|
hsh << recursively_struct(item)
end
else
@params = recursively_struct(params)
end
end
def to... |
class DispatchLink < ActiveRecord::Base
# Relationships
belongs_to :dispatch, :foreign_key => :dispatch_id
has_many :clicks, :class_name => "DispatchLinkClick"
default_scope { order("clicks_count DESC") }
# Validations
# validates_presence_of :uri
# validates_presence_of :dispatch
# validates_uniquen... |
# require 'rspec'
# require_relative '../../libraries/chef_graphite_carbon_config_converter'
# describe ChefGraphite::CarbonConfigConverter do
# let(:config) { [] }
# let(:converter) { ChefGraphite::CarbonConfigConverter.new(config) }
# describe '#to_hash' do
# it 'takes a nil config has and returns an emp... |
require 'rails_helper'
describe 'Record type', type: :feature do
let(:record_type) { create(:record_type) }
before :each do
AuthHelper.new.login(record_type.user)
visit new_record_type_path
end
context 'creating' do
context 'with valid data' do
it 'creates a new record' do
fill_in 'N... |
class CreateStyles < ActiveRecord::Migration
def change
create_table :styles do |t|
t.string :name
t.text :description
t.timestamps
end
reversible do |dir|
dir.up do
["Weizen", "Lager", "Pale ale", "IPA", "Porter"].each do |style|
Style.create name: style, descriptio... |
class AddColumnToTransactionsProducts < ActiveRecord::Migration
def change
add_column :transaction_products, :product_id, :integer
add_column :transaction_products, :transaction_id, :integer
end
end
|
class Gate
def initialize
@parking = []
end
def available?
parking.empty?
end
def dock plane
raise 'This gate is already occupied' unless available?
parking << plane
end
def undock
raise 'This gate has no plane' if available?
parking.delete_at(0)
end
private
attr_accessor :parking
end |
require_relative 'test_helper'
require './lib/computer_player'
require './lib/game_board'
require './lib/coordinates'
class ComputerPlayerTest < Minitest::Test
def test_it_exists_and_initializes_with_game_board
board = GameBoard.new
ai_player = ComputerPlayer.new(board)
assert_instance_of ComputerPlaye... |
Rails.application.routes.draw do
get 'dashboard/index'
resources :departments
resources :stores
resources :staff_requests
namespace :api do
namespace :v1 do
namespace :statistics do
get :chart
get :summary
get :compared_sales
end
namespace :employees do
g... |
require 'omf_base/lobject'
require 'omf_base/exec_app'
require 'digest/sha1'
module OMF::JobService
module Scheduler
class SimpleScheduler < OMF::Base::LObject
POLL_PERIOD = 5 # period in second when the scheduler should wake up
SUPPORTED_RESOURCE_TYPES = [ :node, :resource ]
def initiali... |
require "accepts_nested_serialized_attributes/version"
module AcceptsNestedSerializedAttributes
module ActiveModel::Serialization
alias_method :original_serializable_hash, :serializable_hash
def serializable_hash(options = nil)
original_serializable_hash(options).tap do |hash|
hash.symbolize_k... |
# frozen_string_literal: true
class IconsController < ApplicationController
caches_page :inline, :notification_icon
def inline
width = params[:width].to_i
icon = ChunkyPNG::Image.from_file("#{Rails.root}/app/assets/images/rjjk_logo_notext.png")
data = icon.resample_bilinear(width, width).to_blob
s... |
require 'minitest/autorun'
require 'minitest/pride'
require './calculator'
class CalculatorTest < Minitest::Test
def test_it_adds
calc = Calculator.new
result = calc.add(5, 6)
assert_equal 11, result
end
def test_it_adds_with_a_negative
calc = Calculator.new
result = calc.add(5, -6)
as... |
require 'spec_helper'
describe Immutable::Vector do
describe '#each_index' do
let(:vector) { V[1,2,3,4] }
context 'with a block' do
it 'yields all the valid indices into the vector' do
result = []
vector.each_index { |i| result << i }
result.should eql([0,1,2,3])
end
... |
require "spec_helper"
describe Event do
let(:event_prototype) { build :event_prototype }
let(:event) { Event.new event_prototype:event_prototype }
it "has the event duration" do
event.duration.should == event_prototype.duration
end
it "has a duration of 0 when no duration is specified" do
datum = ... |
class List < ApplicationRecord
validates :name, presence: true
has_many :movie_lists
has_many :movies, through: :movie_lists
end
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe CatalogController, type: :controller do
describe 'index action customizations' do
context 'hierarchy view' do
it 'does not start a search_session' do
allow(controller).to receive(:search_results)
session[:history] = []
... |
#
# Cookbook Name:: tomcatinstallation
# Recipe:: default
#
# Copyright 2017, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
puts "Installing Tomacat7!!"
cookbook_file "/tmp/tomcat7.sh" do
source "tomcat7.sh"
owner "root"
group "root"
mode 0755
end
execute "tomcat7.sh... |
class VideoQueue < Formula
desc "Download, Split & Queue Videos on your computer. For productivity"
homepage "https://www.github.com/seyonv/video_queue"
url "https://www.github.com/seyonv/video_queue/archive/1.0.63.tar.gz"
sha256 "862d01132eecffe8e8fdca310a7d7d9d4ff99557825d33ad39b1967b5d2dd86c"
depends_on :... |
#!/usr/bin/env ruby
require './Graph'
# Random graph - Erdoes/Renyi G(n,p)
# n is the number of vertices; n_edges is the number of edges to be added
# at random. I have a lame condition not to connect a node to itself (the graph
# code does not worry about that).
# I find that for n = 30, for 60 edges, p = .26 or so, ... |
class Email < ActiveRecord::Base
validates :to, presence: true
end
|
class RemoveNationalityToUser < ActiveRecord::Migration[5.0]
def change
remove_column :users, :nationality
end
end
|
class Rate < ApplicationRecord
RATE_PARAMS = %w(room_id user_id score).freeze
belongs_to :user
belongs_to :room
validates :score, presence: true,
numericality: {only_integer: true, other_than: 0}
scope :by_room_id, ->(room_id){where room_id: room_id}
end
|
require "spec_helper"
describe Sro::Mock::ActiveRecordModel do
subject { Sro::Mock::ActiveRecordModel.new }
it "inherits from ActiveRecord::Base" do
klass = subject.class
ancestors = klass.ancestors
expect(ancestors).to include(ActiveRecord::Base)
end
context "#inject_getter" do
it "adds m... |
class V1::ProductsController < V1::ApiController
before_action :require_user, only: [:create, :update, :destroy]
before_action :require_vendor, only: [:create, :update, :destroy]
before_action :set_product, only: [:show, :edit, :update, :destroy]
# GET /products
# GET /products.json
def index
@products... |
require 'test_helper'
class EventTest < Test::Unit::TestCase
def new_event
@event = AASM::SupportingClasses::Event.new(@name, {:success => @success}) do
transitions :to => :closed, :from => [:open, :received]
end
end
context 'event' do
setup do
@name = :close_order
@success = :su... |
require 'spec_helper'
RSpec.describe Bouncer::Session do
let(:last_checked_at) { Time.now }
let(:session) { Fabricate(:session, checked_at: last_checked_at) }
context 'complete, current, recently verified sessions' do
it 'is current' do
expect(session.current?).to be_truthy
end
i... |
module Outputs
class ContactType < Types::BaseObject
implements Types::ActiveRecord
field :walter_id, Integer, null: true
field :first_name, String, null: true
field :last_name, String, null: true
field :full_name, String, null: true
field :phone_number, String, null: false
field :identit... |
Gem::Specification.new do |s|
s.name = 'myprecious_python'
s.version = '0.0.6'
s.date = '2019-02-13'
s.summary = "Your precious python dependencies!"
s.description = "A simple, markdown generated with information about your python dependencies"
s.authors = ["Balki Kodarapu"]
s.em... |
class ChangeDefaultsMovie < ActiveRecord::Migration[5.1]
def change
change_column :movies, :seen, :boolean, default: false
change_column :movies, :favorite, :boolean, default: false
end
end
|
Gem::Specification.new do |spec|
spec.name = "rake-contrib"
spec.version = "1.0.0"
spec.authors = ["SHIBATA Hiroshi"]
spec.email = ["hsbt@ruby-lang.org"]
spec.summary = %q{Additional libraries for Rake}
spec.description = %q{Additional libraries for Rake}
spec.homepag... |
# + - Addition, adds values on either side of the operator
# - - Subtraction, subtracts one side from the other
# % - Modulus Divides the left side by the right sife of it and returns the remainder
# ** - Exponent, peerforms exponential calculation on operators
# These are the more obscure operators, we will take n... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root 'posts#index', as: 'home'
get 'about' => 'pages#about', as: 'about'
get 'history' => 'pages#history', as: 'history'
get 'photos' => 'pages#photos', as: 'photos'
get 'pos... |
require 'spec_helper'
require 'rspec/expectations'
describe TicTacToeRZ::Core::Players::Minimax do
let(:ai) { new_ai }
def new_ai
TicTacToeRZ::Core::Players::Minimax.new.tap do |ai|
ai.set_marks(TicTacToeRZ::Core::Game::X,
TicTacToeRZ::Core::Game::O)
end
end
describe 'wins wh... |
class JsonApiFormFactory
InvalidPayload = Class.new(StandardError)
def self.build(form_klass, params)
form_klass.new(
ActiveModelSerializers::Deserialization.jsonapi_parse!(
params.with_indifferent_access
)
)
rescue ActiveModelSerializers::Adapter::JsonApi::Deserialization::InvalidDoc... |
class WelcomeMailer < ActionMailer::Base
add_template_helper(ApplicationHelper)
default from: "example@example.com"
def welcome_email(account)
@account = account
@user = account.users.first
mail(to: @user.email, subject: 'Welcome to Swapz')
end
end
|
# Stores the column information
class Redpear::Schema::Collection < Array
# @param [Class] klass
# @param [multiple] args the column definition.
# @see Redpear::Schema::Column#initialize
def store(klass, *args)
reset!
klass.new(*args).tap do |col|
self << col
end
end
# @return [Array] th... |
# frozen_string_literal: true
require './lib/proforma/html_renderer/version'
Gem::Specification.new do |s|
s.name = 'proforma-html-renderer'
s.version = Proforma::HtmlRenderer::VERSION
s.summary = 'Proforma renderer plugin for generating HTML.'
s.description = <<-DESCRIPTION
Proforma is a ... |
class User < ActiveRecord::Base
attr_accessible :first_name, :phone
validates :first_name, :presence => true
validates :phone, :presence => true
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.