text stringlengths 10 2.61M |
|---|
class CreateAdmissionsObservations < ActiveRecord::Migration[5.2]
def change
create_table :admissions_observations, id: false do |t|
t.belongs_to :admission, index: true
t.belongs_to :observation, index: true
end
end
end
|
require_relative 'base_page'
class MyGigsPage < BasePage
def title
"Mijn gigs"
end
set_url "#{Global.settings.base_url}/events/upcoming"
selector :new_gig_tab, "//a[contains(text(), 'Nieuwe gig')]"
selector :my_gigs_tab, "//a[contains(text(), 'Mijn gigs')]"
selector :profile_tab, "//a[contains(tex... |
# frozen_string_literal: true
RSpec.describe Paginatable do
let!(:user1) { create(:user) }
let!(:user2) { create(:user) }
let(:paginatable_class) do
Class.new do
include Paginatable
def call(scope, page)
apply_pagination(scope, page)
end
end
end
def find(page: {})
pag... |
require 'spec_helper'
describe ItaTaxonomyQuery do
let(:fixtures_dir) { "#{File.dirname(__FILE__)}/ita_taxonomy" }
describe '#generate_search_body' do
context 'when options is an empty hash' do
let(:query) { ItaTaxonomyQuery.new({}) }
it 'generates search body with default options' do
exp... |
class MessageRecipient < ActiveRecord::Base
validates_presence_of :recipient_id
xss_terminate
belongs_to :message
belongs_to :recipient, :class_name => 'User'
def thread
MessageThread.find thread_id unless thread_id.nil?
end
end
|
# frozen_string_literal: true
FactoryBot.define do
factory :member_applicant do
association :member_application
primary { false }
member_type { 'Active' }
first_name { 'John' }
middle_name { '' }
last_name { 'Doe' }
dob { '' }
gender { '' }
address_1 { '' }
address_2 { '' }
... |
class Person
attr_reader :name :age
def initialize(name, age)
@name = name
@age = age
end
def name=(name)
@name = name
end
end
john = Person.new("John")
john.name = "Jim"
puts john.name # => Jim |
# Victor Costan:
# dropped because it wasn't hooked up to the rest of the code
# preserved to move all the features into the new ca.rb / ecert.rb
#@author: Jorge de la Garza (MIT '08), mongoose08@alum.mit.edu
#The Cert module contains methods for digesting a X.509 certificate into a tag
#for the TEM and t... |
class Song
attr_accessor :name, :artist, :genre
@@count=0 #keeps track of num of songs
@@genres=[]
@@artists=[]
def initialize(name,artist,genre)
@name=name
@artist=artist
@genre=genre
@@count+=1
@@genres << @genre
@@artists << @artist
end
def self.count
@@count
end
d... |
require 'blacklight/catalog'
# This controller is used to get document assets (pdfs, jp2000s, tei xml, ect ) from the asset server.
# A solr q. has to be done first in order to determine if the asset is tagged as public or private. If the user
# is not logged in and the asset is private, the req. handler should not r... |
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'trends#index'
get 'trends/api'
get '/trends/:id' => 'trends#show'
end
|
require 'csv'
module Concerns::WebMonitor::Method
extend ActiveSupport::Concern
included do
paginates_per 10
status.keys.each do |s|
scope :"eq_#{s}", ->{
where(state: status[s])
}
end
before_save :crypt_password, if: :password_changed?
before_update :mark_edited, if: :au... |
# frozen_string_literal: true
module AccesstypeRazorpayDemo
class Client
attr_reader :config, :credentials
def initialize(config, credentials)
@config = config
@credentials = credentials
end
def create_subscription(plan_id, start_time, opts)
return AccesstypeRazorpayDemo::Response.new(success: fals... |
class Cart < ActiveRecord::Base
has_many :line_items, :dependent => :destroy #the existence of the line items is dependent on the existence of the cart
def add_product(product_id) #a method that accumulates the quantity of a product that has been added more than twice, using its id
current_item = line_items.whe... |
class Game
#should re initilize as a 2 dimensional array
def initialize(x, y)
@x = x
@y = y
@pieces = []
end
# create move method to ask game if move is possible
# find way to incorporate can_move? method from other classes into Game class
# check lectures
def move?(piece, dst_x, dst_y)
if piece.can_move?(d... |
class Api::SharesController < ApplicationController
before_action :authenticate
def create
share = Share.new(share_params)
if share.save
render json: share, status: 200
else
render json: share.errors, status: 422
end
end
def destroy
share = Share.find(params[:id])
share.destroy
render json: "s... |
require 'rails_helper'
describe Retrier do
it 'only retries on errors' do
counter = 0
described_class.new retries: 10, errors: [StandardError] do
counter += 1
raise StandardError unless counter > 3
end
expect(counter).to eq 4
end
context 'maximum retries' do
it 'takes a custom ... |
class Ip < ApplicationRecord
belongs_to :network
belongs_to :host
end
|
class AmbariClusterDiff::PropertyDifference
include Virtus.model
attribute :config_group, String
attribute :property_key, String
attribute :first_cluster_value, String
attribute :second_cluster_value, String
end
|
RSpec::Matchers.define :be_invalid_on do |attr_name|
match do |model|
model.send("#{attr_name}=", @value)
model.invalid? && model.errors[attr_name].size >= 1
end
chain :with do |value|
@value = value
end
failure_message do |model|
if model.valid?
"expect #{model.class} to be invalid bu... |
class StatisticBase
def initialize(client)
@client = client
end
def get_data(repository_name)
raise 'Method must be implemented in ancestors.'
end
def calculate(repository_name)
statistics = get_data(repository_name)
users_stats = { }
return users_stats unless statistics
statistics.... |
is_true = 2 != 3
is_false = 2 == 3
=begin
We’ve got two variables
in the editor: is_true and is_false.
Replace the __ with == or != to make
is_true evaluate to true and is_false
evaluate to false.
=end
|
class FontPostNoBillsJaffna < Formula
head "https://github.com/google/fonts.git", branch: "main", only_path: "ofl/postnobillsjaffna"
desc "Post No Bills Jaffna"
homepage "https://github.com/mooniak/post-no-bills-font"
def install
(share/"fonts").install "PostNoBillsJaffna-Bold.ttf"
(share/"fonts").insta... |
require 'fileutils'
namespace :ojo do
desc 'use ojo to compare two branches'
task :compare, [:branch_1, :branch_2] => :environment do |t, args|
branch_1 = args[:branch_1]
branch_2 = args[:branch_2]
Ojo::Manager.new.compare(branch_1, branch_2)
end
desc 'show ojo location setting'
task :location ... |
class AuthenticationController < ApplicationController
include SwaggerAuthenticationController
def sign_up
user = User.create sign_up_params
if user.persisted?
render json: { message: I18n.t("authentication.signed_up") }
else
render_error user.full_errors, :unprocessable_entity
end
e... |
module Fog
module AWS
class EC2
class Real
require 'fog/aws/parsers/ec2/describe_addresses'
# Describe all or specified IP addresses.
#
# ==== Parameters
# * public_ip<~Array> - List of ips to describe, defaults to all
#
# ==== Returns
# * re... |
class Changetodouble < ActiveRecord::Migration
def change
change_column :inventory_orders, :quantity, :decimal
change_column :inventories, :quantity, :decimal
end
end
|
class AddPlotToMovies < ActiveRecord::Migration
def change
add_column :movies, :plot, :text
add_column :movies, :director, :string
add_column :movies, :rating, :string
add_column :movies, :cast, :string
add_column :movies, :poster, :string
end
end
|
# frozen_string_literal: true
module Bolt
module Util
class << self
def read_yaml_hash(path, file_name)
require 'yaml'
logger = Logging.logger[self]
path = File.expand_path(path)
content = File.open(path, "r:UTF-8") { |f| YAML.safe_load(f.read) } || {}
unless conten... |
# 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).
#
image = Image.create(
file_name: 'me.jpg',
url: 'http://justindrew.net/imgs/me.jpg'
)
user = User.create(
pa... |
require 'jquery-rails'
require 'bootstrap-sass'
require 'kaminari'
require 'bootstrap-kaminari-views'
require 'haml-rails'
module Specmon
class Engine < ::Rails::Engine
isolate_namespace Specmon
initializer 'specmon' do |app|
%w(stylesheets images javascripts).each do |sub|
app.config.assets.pa... |
class DropHeroSelectionsTable < ActiveRecord::Migration
def up
drop_table :hero_selections
end
def down
create_table :hero_selections do |t|
t.references :player_match
t.references :hero
end
add_index :hero_selections, :player_match_id
add_index :hero_selections, :hero_id
end
e... |
class DadosSf36 < ActiveRecord::Base
belongs_to :laudo
validates :saude, :presence => true
validates :comparacao_saude, :presence => true
validates :atividades_vigorosas, :presence => true
validates :atividades_moderadas, :presence => tru... |
class User < ActiveRecord::Base
has_many :posts, :dependent => :destroy
has_many :reservations
#attr_accessible :username,:email,:password,:password_confirmation,:role,:position,:department,:leader
has_secure_password
before_save { |user| user.email = email.downcase }
before_save :create_remember_token
... |
class Question < ApplicationRecord
validates :question, :answer, :image_url, :subject, :topic, presence: true
validates :image_url, format: {with: /\.(png|jpg)\Z/i}
end
|
#==============================================================================
# ■ Configuration
#==============================================================================
module KRX
# Name of the token soundfile
AS_SOUNDFILE = '!ShakeMe'
# Basic shake properties (power, speed, duration)
AS_SETTINGS... |
require 'rails_helper'
RSpec.describe AuthController, type: :controller do
describe 'GET #callback' do
before do
OmniAuth.config.test_mode = false
OmniAuth.config.mock_auth[:dfe] = nil
request.env['omniauth.auth'] = {
'info' => {
'email' => 'dfe@example.com'
},
... |
# frozen_string_literal: true
RSpec.describe Dry::Logic::Operations::Attr do
subject(:operation) do
Dry::Logic::Operations::Attr.new(Dry::Logic::Rule::Predicate.build(str?), name: :name)
end
include_context "predicates"
let(:model) { Struct.new(:name) }
describe "#call" do
it "applies predicate to... |
require 'rubygems'
require 'bundler/setup'
root = File.join(File.dirname(__FILE__), '..')
$:.unshift File.join(root, 'lib')
require 'ostruct'
require 'yaml'
require 'gridsby/api'
require 'pp'
config = YAML.load_file(File.join(root, 'config/settings.yaml'))
api = GridsBy::API.new('http://heml.mta.ca/releases/Rdf/Hem... |
class AddRenewGroupAndDioceseToChurches < ActiveRecord::Migration
def change
add_column :churches, :renew_region_id, :integer
add_column :churches, :diocese_id, :integer
end
end
|
class Order < ActiveRecord::Base
belongs_to :user
has_many :order_products
has_many :products, through: :order_products
accepts_nested_attributes_for :order_products, allow_destroy: true
validates :buyer_id, presence: true
validates_inclusion_of :status, :within => ["pending","paid","complete","cancelled"]... |
class FavoritesController < ApplicationController
before_action :require_signin
before_action :load_movie
def create
@movie.fans << current_user
redirect_to @movie
end
def destroy
favorite = current_user.favorites.find(params[:id])
favorite.destroy
redirect_to @movie
end
priv... |
require_relative '../raindrops'
require 'minitest/autorun'
class RaindropsTest < Minitest::Test
def test_1
assert_equal '1', Raindrops.convert(1)
end
def test_3
assert_equal 'Pling', Raindrops.convert(3)
end
def test_5
assert_equal 'Plang', Raindrops.convert(5)
end
def test_vocabulary
voc... |
class Activity < ApplicationRecord
ACCOMPANIMENT_ELIGIBLE_EVENTS = ['master_calendar_hearing', 'individual_hearing', 'special_accompaniment', 'check_in', 'family_court', 'bond_hearing', 'fingerprinting']
NON_ACCOMPANIMENT_ELIGIBLE_EVENTS = ['filing_asylum_application', 'asylum_granted', 'filing_work_permit', 'detai... |
require_relative '../spec_helper'
RSpec.describe Parser::Log do
let(:parser) do
Parser::Log.new('/path')
end
context 'file validation' do
it "when file missing" do
expect {
parser
}.to raise_error(Parser::Log::FileMissing)
end
it "when file exist" do
allow(File).to re... |
class ArticleContent < ActiveRecord::Base
belongs_to :article
validates_presence_of :content
end
|
json.text "日報登録"
json.set! 'attachments' do
json.array!([1]) do
json.text "日付を選んでください"
json.fallback "選択してください!"
json.callback_id "choose_date"
json.color "#3AA3E3"
json.attachment_type "default"
json.set! 'actions' do
json.array!([1]) do |t|
json.name "date"
json.text "選択する"
json.type "se... |
module ConcurrentIterable
class Config
DEFAULT_CONCURRENCY = 10
attr_accessor :concurrency
def initialize(concurrency: DEFAULT_CONCURRENCY)
@concurrency = concurrency
end
end
end
|
# https://leetcode.com/problems/subsets-ii/
#
# Given a collection of integers that might contain duplicates, nums, return
# all possible subsets.
#
# Notes:
#
# + Elements in a subset must be in non-descending order.
# + The solution set must not contain duplicate subsets.
#
# For example:
#
# If nums = [1... |
class Line
attr_reader :name, :id
def initialize(attributes)
@name = attributes['name']
@id = attributes['id'].to_i
end
def save
result = DB.exec("INSERT INTO lines (name) VALUES ('#{@name}') RETURNING id;")
@id = result.first['id'].to_i
end
def self.stations_served_by_line(line_id)
s... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
# Get firstname
def chelfirstname(fullname)
fullname.split.first
end
#Get secondname
def chelsecondname(fullname... |
module API
class SubmissionFile < Base
has_many :submission_entries
belongs_to :submission
def self.resource_path
'files'
end
end
end
|
# -*- encoding : utf-8 -*-
class Network::NewCustomerTariff
VOLTAGE_220 = '220'
VOLTAGE_380 = '380'
VOLTAGE_610 = '6/10'
include Mongoid::Document
include Mongoid::Timestamps
field :voltage, type: String
field :power_from, type: Integer
field :power_to, type: Integer
field :days_to_complete, type... |
require 'rails_helper'
describe User do
describe '#authenticate' do
let!(:user) { create :user,
email: 'test@test.com',
password: 'password', password_confirmation: 'password' }
context 'when valid user credentials are supplied' do
let(:result) { User.... |
#IMPROVED PROGRAM LOGGER
$logger_depth = 0
def log desc, &block
prefix = " " * $logger_depth
puts prefix + 'Beginning "' + desc + '"...'
$logger_depth += 1
result = block.call
$logger_depth -= 1
puts prefix + 'Beginning "' + desc + '" finished, returning: ' + result.to_s
end
log "outer block" do
l... |
class CurrenciesController < ApplicationController
rescue_from ActiveRecord::RecordNotFound do |exception|
render :json => { :success => false }, :status => :not_found
end
# GET /currencies
# GET /currencies.ext_json
def index
@currencys =Currency.all
render :json => {:successful=>true, :total=>... |
class Tournaments::GamesController < ApplicationController
before_action :find_tournament_and_games
before_action :require_owner!
layout 'tournament_title', :only => [:index]
def index
end
def destroy
@games.find(params[:id]).destroy
redirect_to tournament_games_path(@tournament)
end
private... |
module ApplicationHelper
def link_to_add_fields(name, f, association, linkclass = '')
new_object = f.object.send(association).klass.new
id = new_object.object_id
fields = f.fields_for(association, new_object, child_index: id) do |builder|
render(association.to_s.singularize + "_fields", f: bu... |
# == Schema Information
#
# Table name: books
#
# id :integer not null, primary key
# name :string(255)
# publishing_house :string(255)
# pages :integer
# ISBN :string(255)
# content :text
# created_at :datetime not null
# updated_... |
require_relative '../lib/vote'
RSpec.describe Vote do
it 'has a voter and candidate' do
vote = Vote.new('Miyoshi', 'Alice')
expect(vote.voter).to eq 'Miyoshi'
expect(vote.candidate).to eq 'Alice'
end
end
|
require 'action_view'
require 'date'
class Cat < ApplicationRecord
include ActionView::Helpers::DateHelper
COLORS = %w(black white brown grey) #Cat::COLORS/ Cat.COLORS/
validates :bithdate, :color, :name, :sex, :description, presence: true
validates :color, inclusion: COLORS
validates :sex, i... |
class CreateAssessmentSchedules < ActiveRecord::Migration
def self.up
create_table :assessment_schedules do |t|
t.references :assessment_group
t.references :course
t.date :start_date
t.date :end_date
t.integer :no_of_exams_per_day, :default => 1
t.text :exam_timings
t.boo... |
class CreateCategories < ActiveRecord::Migration
def up
create_table :categories do |t|
t.string :title, :default => "", :null => false
t.integer :rank
t.timestamps null: false
end
add_index('categories', 'title')
end
def down
drop_table :categories
end
end
|
require 'test_helper'
# EDITOR ---------------
feature 'Editing a post as editor' do
scenario 'try to edit post' do
editor_sign_in
# Given a completed new post form
visit post_path(posts(:vi))
click_link 'Edit'
fill_in 'Title', with: posts(:bsh).title
fill_in 'Content', with: posts(:bsh).c... |
# encoding: UTF-8
# Add to rtesseract a image without manipulation
module NoneProcessor
def self.setup
end
def self.a_name?(name)
%w(none NoneProcessor).include?(name.to_s)
end
def self.image_to_tif(source, x = nil, y = nil, w = nil, h = nil)
tmp_file = Tempfile.new(['', '.tif'])
tmp_file.write(... |
module SupplyTeachers
class Journey::LookingFor
include Steppable
attribute :looking_for
validates :looking_for, inclusion: %w[
worker
managed_service_provider
calculate_temp_to_perm_fee
calculate_fta_to_perm_fee
all_suppliers
]
def next_step_class
case lookin... |
Pod::Spec.new do |s|
s.name = 'RNBackgrounder'
s.version = '0.0.5'
s.summary = 'Run function in a background thread'
s.description = <<-DESC
Run function in a background thread
DESC
s.homepage = "N/A"
s.license = "N/A"
s.author ... |
# frozen_string_literal: true
# For use in integration tests. Provides a mock OmniAuth hash
module OmniauthMacros
def mock_auth_hash(email = true)
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(data(email))
end
# rubocop:disable Metrics/MethodLength
def data(email = true)
{
provide... |
# encoding: UTF-8
RSpec.configure do |config|
config.before :suite do
config = File.expand_path("../purgeable_test.yml", __FILE__)
Purgeable.load_settings(config, "empty")
Purgeable.load_settings(config, "empty_http_cache")
Purgeable.load_settings(config, "test")
end
end
|
class User < ApplicationRecord
validates :name, presence: true
validates :email, presence: true,
format: { with: /\A[^@][\w.-]+@[\w.-]+[.][a-z]{2,4}\z/i }
has_many :products
end
|
require_relative './view_controller'
module Bluesky
# Bluesky::NavigationController
class NavigationController < ViewController
def initialize(root_view_controller)
raise 'NavigationController requires a root_view_controller' unless root_view_controller
super
add_child_view_controller(root_... |
class Article < ApplicationRecord
class IndexDrafts < Article::Index
policy ArticlePolicy, :new?
protected
def article_scope
Article.recent_drafts
end
end
end
|
class AddGameNameToPosts < ActiveRecord::Migration
def change
add_column :posts, :game_name, :string
end
end
|
class SetGoodTypeIdAncestry < ActiveRecord::Migration[5.2]
def self.up
add_column :good_types, :ancestry, :string
add_index :good_types, :ancestry
end
def self.down
remove_index :good_types, :ancestry
remove_column :good_types, :ancestry
end
end
|
class List
def initialize(list_name)
@name = list_name
@tasks = []
end
def name
@name
end
def add_task(task_to_add)
@tasks << task_to_add
end
def tasks
@tasks
end
end
|
# Fact: openvpn_<server>_<clientname>_ca,
# openvpn_<server>_<clientname>_crt,
# openvpn_<server>_<clientname>_key
#
# Purpose:
# Collect clients' OpenVPN generated keys (presumably for exported resources).
#
require 'etc'
require 'facter'
module Facter::OpenvpnKeys
def self.add_facts
if File.di... |
class Visit < ActiveRecord::Base
#Relations in db
belongs_to :employee
belongs_to :visitor
default_scope -> { order(:created_at) }
#Validations
validates :dal, presence: true, uniqueness: { scope: [:al, :visitor_id] }
validates :al, ... |
#! /usr/bin/env ruby
# Usage
# skypehist.rb "query term" dbfile
#
# where <dbfile> is main.db:
# find ~/Library/Application Support/Skype/ | grep main.db
require 'time'
require 'rubygems'
require 'sqlite3'
Message = Struct.new(:timestamp, :author, :message, :sendto) do
def self.from_sqlite(str)
timestamp, au... |
class CreateReviews < ActiveRecord::Migration
def change
create_table :reviews do |t|
t.string :yelp_id
t.string :body
t.datetime :time_created
t.string :user_id
t.string :user_name
t.string :user_photo_url
t.references :business, index: true, foreign_key: true
t.t... |
class ApplyJobsController < ApplicationController
load_and_authorize_resource :user
load_and_authorize_resource :applicant,:through=>:user,:singleton=>true
layout "applicants"
# show applied job-posts for applicants
def index
@user=current_user
@applicant=@user.applicant
@job_posts=@... |
require "rails_helper"
describe User do
context 'New User' do
it 'must have a name and a passowrd(login) ' do
user = User.create(login: '')
expect(user.errors.count).to eq(4)
end
it 'email has to be uniq' do
user = User.create(login: 'foo', email: 'foo@bar')
other_user = User.cr... |
# frozen_string_literal: true
class BadgeAwardService
def initialize(test_passage)
@test_passage = test_passage
@test = test_passage.test
@category = @test.category.title
@user = test_passage.user
@level = @test.level
@badges = Badge.all
end
def call
@badges.select do |badge|
s... |
class ManagedAccount < ActiveRecord::Base
belongs_to :user
validates :user_id, :account_id, :secret_key, :publishable_key, presence: true
end
|
class Snack < ApplicationRecord
has_many :machine_snacks
has_many :machines, through: :machine_snacks
def self.average_price
price = average(:price).to_f.round(2)
end
def self.snacks_count
Snack.all.count
end
end
|
class VehicleBroadcastJob < ApplicationJob
queue_as :default
def perform(vehicle)
ActionCable.server.broadcast 'vehicle_channel', vehicle
end
end
|
class AddUserIdToInviteCodes < ActiveRecord::Migration
def self.up
add_column :invite_codes, :user_id, :integer
add_column :users, :invite_codes_count, :integer,:default=>0
end
def self.down
end
end
|
class ExtendedSwitchData < BinData::Record
endian :big
uint32 :src_vlan
uint32 :src_priority
uint32 :dst_vlan
uint32 :dst_priority
end
|
class AddTimestampsToSteps < ActiveRecord::Migration
def change
add_column :steps, :started_at, :timestamp
add_column :steps, :finished_at, :timestamp
end
end
|
class TermNotepad < Term
def abstract
if content == nil
return ""
end
return content[0, 255]
end
end
|
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'riakcs/version'
Gem::Specification.new do |gem|
gem.name = "riakcs"
gem.version = RiakCS::VERSION
gem.authors = ["Hector Castro"]
gem.email = ["hect... |
module Bot::DiscordCommands
module Announce
extend Discordrb::Commands::CommandContainer
command(:announce, min_args: 1, required_permissions: [:manage_messages], usage: '^announce <text>') do |event, *text|
event.channel.send_embed do |embed|
event.message.delete
embed.author = Disco... |
require 'rails_helper'
RSpec.describe Comment, type: :model do
describe 'tests for Comment' do
before(:all) do
@javier = create(:user, username: 'Jhon', email: 'jhon@gmail.com')
@course = create(:course, teacher: @javier, link: 'zoom.com/1', content: 'Content 1')
@comment = create(:comment, use... |
class CreateAppConfigs < ActiveRecord::Migration
def change
create_table :app_configs do |t|
t.text :custom_css
t.text :custom_js
t.string :background_color
t.string :main_title
t.string :favicon
t.string :main_logo
t.timestamps null: false
end
end
end
|
class Book
attr_reader :title
def title=(title)
words = title.split(" ")
titled = []
articles = %w(a for and the an to of in)
words.each_with_index do |word, idx|
if idx == 0
titled << word.capitalize
elsif articles.include?(word)
titled << word
else
... |
class Leoric < Formula
desc "Project initialization from skeleton files"
homepage "http://code.mrtazz.com/leoric/"
url "https://github.com/mrtazz/leoric/archive/0.2.3.tar.gz"
sha256 "45ac0e326d29dcb9eecf0933e4eabc46e5b21c59bc75db4e351ffa5bf4f7d02c"
depends_on "pandoc"
def install
system "VERSION=0.2.3... |
SparkleFormation.new(:test, :provider => :aws) do
AWSTemplateFormatVersion '2010-09-09'
description 'Plivo Vpc With one private subnet and one public subnet'
parameters do
amiId do
type 'String'
default 'ami-6e165d0e'
description 'Enter WME AMI ID.'
end
instanceType do
type 'St... |
class Match < ActiveRecord::Base
belongs_to :home_team, class_name: "Team"
belongs_to :visitor_team, class_name: "Team"
belongs_to :toto_form
store_accessor :stats, :draw_votes, :home_team_votes, :visitor_team_votes
validates :draw_votes, :home_team_votes, :visitor_team_votes, numericality: true, allow_blank... |
require_relative 'test_helper'
describe 'tilt' do
_MockTemplate = Class.new do
attr_reader :args, :block
def initialize(*args, &block)
@args = args
@block = block
end
end
it "registering template implementation classes by file extension" do
Tilt.register(_MockTemplate, 'mock')
end
... |
# == Schema Information
# Schema version: 20110320012629
#
# Table name: brands
#
# id :integer(4) not null, primary key
# title :string(255)
# merchant_id :integer(4)
# created_at :datetime
# updated_at :datetime
# featured :string(0)
# instant :string(0)
# active :string(0)
#... |
module Admin
class MembershipsController < BaseController
def new
@team = Team.find_by(id: params[:team_id])
@membership = Membership.new
build_permissions_options
end
def create
@team = Team.find_by(id: params[:team_id])
result = Admins::CreateMembership::Service.cal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.