text stringlengths 10 2.61M |
|---|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :dogs
resources :owners
# or specify your own routes
get "/doggytreats", to: "doggytreats#showmytreat"
end
|
# frozen_string_literal: true
class Household < ApplicationRecord
validates :first, :last, :UIN, :family, :email, :phonenumber, :classification, :major,
presence: true
validates :UIN, length: { minimum: 9 }
validates :UIN, length: { maximum: 9 }
validates :phonenumber, length: { minimum: 10 }
val... |
RSpec.describe CondLike, type: :model do
it { should belong_to :event }
it { should validate_presence_of :url }
it { should validate_presence_of :event_id }
it 'should be valid' do
cond_like = create :cond_like
expect(cond_like).to be_valid
end
end
|
class Post < ActiveRecord::Base
belongs_to :user
has_and_belongs_to_many :tags
has_many :comments
validates :title, :content, :tags, presence: true
end
|
require 'rails_helper'
RSpec.describe CreateTicket do
include ModelHelper
after do
Ticket.destroy_all
end
it 'Create Customer interactor exists' do
expect(class_exists?(CreateTicket)).to eq(true)
end
it 'customer successfully create' do
result = CreateTicket.call(response: {authenticated: tru... |
class ChangeLengthToTimeOnEvents < ActiveRecord::Migration[5.0]
def up
change_column :events, :length, :time
end
def down
change_column :events, :length, :datetime
end
end
|
#
# Cookbook Name:: cooking-with-jenkins
# Recipe:: configure-jenkins
#
# Adds plugins and common configuration we'll rely on in our Jenkins
# job definitions.
#
# Copyright (C) 2013 Zachary Stevens
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wit... |
require 'pty'
require 'fileutils'
require 'io/console'
require './node.rb'
class OVSSwitch < Node
"OVSBridge is an OVSSwitch in standalone/bridge mode"
@@portBase = 1
def initialize(name, parent, path, cidr = '192.168.10.0/24', *args)
super( name, parent, path, args )
@cidr = cidr
end
def cr... |
# frozen_string_literal: true
module StringCheese
module Helpers
# Provides methods for manipulating Hash objects
module Hash
module_function
def ensure_hash(object)
raise ArgumentError, 'Param [object] does not respond_to? #to_h' \
unless object.respond_to?(:to_h)
obj... |
#!/usr/bin/env ruby
#
# Copyright (c) 2017 joshua stein <jcs@jcs.org>
#
# 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... |
class Vendor < ActiveRecord::Base
include Naming
include Attachments
include Scopes
include Approval
has_many :products
has_many :transactions
has_many :users, through: :transactions
scope :locked, -> { Vendor.not(:unlocked) }
devise :database_authenticatable, :registerable, :async, :confirmable, :loc... |
class Job < ActiveRecord::Base
include Bootsy::Container
belongs_to :category
validates_presence_of :company_name, :title, :description, :required_experience, :how_to_apply, :contact_email
has_attached_file :avatar, styles: {
thumb: '100x100>',
square: '200x200#',
medium: '300x300>'
}, :s3_host_name... |
class RenameTransactionDateInRosterTransactions < ActiveRecord::Migration
def change
change_table :roster_transactions do |t|
t.rename :transaction_date, :roster_transaction_on
end
end
end
|
module ApplicationHelper
def sort_categories_by_name!(categories)
categories.sort!{|x,y| x.name <=> y.name}
end
def welformatted_url(url)
url.starts_with?('http://','https://') ? url : "http://#{url}"
end
def formatted_datetime(datetime)
datetime.in_time_zone(timezone_to_use).strftime("on %e %... |
require 'spec_helper'
describe OwnerConfirmationsController do
include Devise::TestHelpers
before :each do
@owner = Factory.create(:owner)
end
describe "show" do
it "should confirm site owner" do
get :show, :confirmation_token => @owner.confirmation_token
@owner.reload.confirmed?.should ... |
class Account
attr_reader :name
attr_accessor :balance, :pin
def initialize (name, balance, pin)
@name = name
@balance = balance
@pin = pin
end
def greeting
puts "Hello, #{@name} welcome to the bank."
end
def pin_check
puts 'Please enter your pin.'
input = gets.chomp.to_i
if in... |
class Blog < ActiveRecord::Base
attr_accessible :description, :name, :user_id, :photo
validates :description, :length => { :maximum => 140 }
belongs_to :user
has_attached_file :photo,
:styles => {
:small => "100x100>" },
:url => "/assets/photos/:i... |
class CreateNics < ActiveRecord::Migration[6.0]
create_table :nics do |t|
t.macaddr :mac
t.integer :nic_type, null: false, required: true
t.references :item, null: false, foreign_key: { to_table: :assets }
t.timestamps
end
end
|
# get_middle_char.rb
# Write a method that takes a non-empty string argument, and returns the middle
# character or characters of the argument. If the argument has an odd length,
# you should return exactly one character. If the argument has an even length,
# you should return exactly two characters.
# Pseudo-code:
#... |
class EmpresasController < ApplicationController
before_filter :autoriza_admin_empresa
# GET /empresa/edit
def edit
end
# PUT /empresas/1
def update
if @empresa.update_attributes(params[:empresa])
flash[:notice] = 'Empresa was successfully updated.'
redirect_to :action => :edit
else
... |
require_relative 'questions_database'
require 'byebug'
class QuestionLike
def self.find_by_id(id)
data = QuestionsDatabase.instance.execute(<<-SQL, id)
SELECT
*
FROM
question_likes
WHERE
id = ?
SQL
question_like = QuestionLike.new(data[0])
end
def self.li... |
require 'rails_helper'
RSpec.describe "Weather Service" do
it "Can return forecast data for a geolocation" do
lat = 39.74
lon = -104.98
weather = WeatherService.get_weather(lat, lon)
expect(weather).to be_a(Hash)
expect(weather[:current]).to be_a(Hash)
expect(weather[:daily]).to be_an(Array... |
class ItemsController < ApplicationController
before_action :set_item, only: [:update, :destroy]
before_action :set_list, only: :new
def new
@item = Item.new
end
def create
@item = Item.new(item_params)
if @item.save
redirect_to root_path
else
render :new
end
end
def up... |
# -*- coding: utf-8 -*-
class DriversController < InheritedResources::Base
before_filter :authenticate_user!
before_filter :authenticate_owner, :only => [:show, :edit, :update, :destroy]
# GET /drivers
# GET /drivers.json
def index
@title += " | #{t('activerecord.models.driver')}#{t('link.index')}"
i... |
class Api::V1::NlpController < Api::V1::ApplicationController
before_action :validate_owner_and_agent
def interpret
nlp = Nlp::Interpret.new(interpret_parameters)
nlp.language = request.headers["Accept-Language"] if nlp.language.blank?
respond_to do |format|
format.json {
if !validate_to... |
# Cookbook Name:: oracle-instantclient
# Mixin:: alien_converter
# Author:: David Kinzer <dtkinzer@gmail.com>
#
# Copyright (C) 2014 David Kinzer
#
# 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 ... |
class AddArtistIdToLyrics < ActiveRecord::Migration
def change
add_column :lyrics, :artist_id, :integer
add_index :lyrics, :artist_id
end
end
|
require "test_helper"
feature "As a user, I would like to comment on other user's memories" do
before do
# given a logged in user and a memory
@user = users :user_1
sign_in @user
@memory = memories :user2_memory
@comment = comments :new_comment
end
scenario "comment form shows on memories" d... |
class Api::V1::TagSerializer < Api::V1::BaseSerializer
serializes "ActsAsTaggableOn::Tag"
# Don't provide meta data
configure :meta, :active => false
# Attributes
def serialize_collection
object.pluck(:name)
end
end |
require 'test_helper'
class HownersControllerTest < ActionController::TestCase
setup do
@howner = howners(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:howners)
end
test "should get new" do
get :new
assert_response :success
end
... |
class Menu
attr_reader :menu_list, :read_menu
MENU_LIST = {
"Caesar salad" => 4,
"Gazpacho" => 3,
"Tartiflette" => 6,
"Butternut Squash Risotto" => 6,
"Roasted Vegetables" => 6,
"Pumpkin Pie" => 2,
"Eclair" => 2 }
def initialize
@menu_list = MENU_LIST
end
# def read_menu
# @menu_list.eac... |
class GroupMembership < ActiveRecord::Base
belongs_to :faculty
belongs_to :group
end
|
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# start :datetime
# stop :datetime
# description :string
# coach_id :integer
# area_id :integer
# order_id :integer
# user_... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VM_MEMORY = 1024
VM_CPUS = 1
# this is the password you will set for your splunk admin user
SPLUNK_PASS = "changeme1"
# Splunk home directory
SPLUNK_HOME = "/opt/splunk"
Vagrant.configure("2") do |config|
config.vm.define "indexer" do |indexer|
config.vm.box = "... |
class SocialsController < ApplicationController
before_action :authenticate_user!
before_action :set_social, only: [:edit, :update, :destroy]
respond_to :html
def new
@social = Social.new
@id=params[:id]
respond_with(@social)
end
def edit
@id=@social.user_id
end
def create
@socia... |
class SentenciaCase
def initialize()
end
def definirEtapaVida()
# se define la variable
edad = 2
# es en la variable respuesta se
# almacenara lo que se encuentre
# despues de then
respuesta = case edad
# when condition
# se pueden tener rangos de valores
# como condicion
when 0..3 the... |
@data = [
1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,9,1,19,1,19,5,23,1,23,6,27,2,9,27,31,1,5,31,35,1,35,10,39,1,39,10,43,2,43,9,47,1,6,47,51,2,51,6,55,1,5,55,59,2,59,10,63,1,9,63,67,1,9,67,71,2,71,6,75,1,5,75,79,1,5,79,83,1,9,83,87,2,87,10,91,2,10,91,95,1,95,9,99,2,99,9,103,2,10,103,107,2,9,107,111,1,111,5,115,1,115,2,119,1,11... |
module LevenshteinSearcher
# my iosifovich port was broken, stole this from stackoverflow isntead
# https://stackoverflow.com/a/46410685
def self.distance a, b
a, b = b, a if b.length < a.length
v0 = (0..b.length).to_a
v1 = []
a.each_char.with_index do |a_ch, i|
v1[0] = i + 1
b.each_char.with_index ... |
#!/usr/bin/env ruby
# This file is part of LiferayScan
# https://github.com/bcoles/LiferayScan
require 'LiferayScan'
require 'optparse'
require 'terminal-table'
require 'resolv'
def banner
puts "
_ _ __ _____
| | (_)/ _| / ___|
| ... |
class CreateStadiumServices < ActiveRecord::Migration
def change
create_table :stadium_services do |t|
t.belongs_to :stadium, index: true, foreign_key: true
t.belongs_to :service, index: true, foreign_key: true
t.float :price
t.boolean :periodic, default: false
t.timestamps null: fa... |
class AddTimeZoneOffsetToAirports < ActiveRecord::Migration[5.2]
def change
add_column :departure_airports, :timezone_offset, :decimal
add_column :arrival_airports, :timezone_offset, :decimal
end
end
|
class CategoryForm
include ActiveModel::Model
attr_accessor :name
validates :name, presence: true
validates_length_of :name,
maximum: 100,
message: 'Name is too long'
end
|
class Tone
attr_reader :emotion_tone, :language_tone, :social_tone, :channel
def initialize(tone_analysis, channel)
@emotion_tone = tone_analysis["document_tone"]["tone_categories"][0]["tones"]
@language_tone = tone_analysis["document_tone"]["tone_categories"][1]["tones"]
@social_tone = tone_analysis[... |
require "./lib/Lesson 15 Caterpillar Method/CountTriangles/count_triangles"
describe 'CountTriangles' do
describe 'Example Test' do
it 'Example, Positive Answer, Length=6' do
expect(count_triangles([10,2,5,1,8,12])).to eq 4
end
end
describe 'Correctness Tests' do
context 'Extreme_empty' do
... |
Gretel::Crumbs.layout do
crumb :custom_reports_index do
link I18n.t('custom_reports'), {:controller=>"custom_reports",:action=>"index"}
end
crumb :custom_reports_generate do
link I18n.t('generate'), {:controller=>"custom_reports",:action=>"generate"}
parent :custom_reports_index
end
crumb :cus... |
# frozen_string_literal: true
class Toxiproxy
class Toxic
attr_reader :name, :type, :stream, :proxy
attr_accessor :attributes, :toxicity
def initialize(attrs)
raise "Toxic type is required" unless attrs[:type]
@type = attrs[:type]
@stream = attrs[:stream] || "downstream"
@name =... |
# :nodoc:
require 'net/http'
require 'net/https'
require 'resolv-replace'
module ApplicationHelper
def http_post(url, body, token)
logger.debug url
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.read_timeout = 10000
if token != nil
http.use_ssl = true
http.verify_m... |
class SessionsController < ApplicationController
skip_before_filter :session_check, :only => [:new, :create]
def new
end
def create
handle = params[:session][:handle].downcase
user = User.where("lower(handle) = ? OR lower(email) = ?", handle, handle).first
if user && user.authenticate(params[:session][:pas... |
require 'rspec'
describe Campaign do
describe 'validations' do
describe 'name' do
it { should_not accept_values_for(:name, nil) }
it { should_not accept_values_for(:name, '') }
it { should_not accept_values_for(:name, 'a' * 101) }
it { should accept_values_for(:name, 'a') }
it { sh... |
require 'spec_helper'
require 'ldap-relations/relation_manager'
module Ldap::Relations
describe RelationManager do
let(:relation_manager) { RelationManager.new }
let(:relation) { stub 'Relation', to_filter: '(objectCategory=person)' }
let(:or_relation) { stub 'Or', to_filter: '(|(sAMAccountName=test)(mai... |
class Settings::MembershipPolicy < ApplicationPolicy
def create?
!record.organization.private? and not user.in?(record.organization.users)
end
def destroy?
record.user == user or Pundit.policy!(user, record.organization).update? and record.role != 'Admin'
end
end |
class Task < ActiveRecord::Base
attr_accessible :deadline, :description, :name, :project_id, :status, :user_id, :user
belongs_to :project
belongs_to :user
has_one :group, :through => :project
validates_presence_of :name
validates_presence_of :description
def owner
self.user.user_name
end
def g... |
module Custom
module AssertionMacros
def empty?
length == 0 || fail("expected an empty collection, but got a #{actual.class.name} with #{actual.length rescue 0} items")
end
def any?
length > 0 || fail("expected an array of items")
end
def length
actual.respond_to?(:length) && a... |
require 'transaction.rb'
describe Transaction do
subject(:transaction) { Transaction.new(2500) }
it "can records a deposit" do
subject.deposit(500)
expect(get_current_balance).to eq 3000
end
it "can records a withdrawal" do
subject.withdraw(250)
expect(get_current_balance).to eq 2250
end
... |
# Supplier.destroy_all
# Supplier.create([
# {
# name: "Bob's Novelty Emporium",
# email: "big_bob@emporium.co",
# phone: "312-995-5566"
# },{
# name: "Sue's House of Nerdy Toys",
# email: "s.anderson@gmail.com",
# phone: "212-999-5556"
# },{
# name: "Tony's Truck"... |
require 'bubble_sort'
describe '#bubble_sort' do
let(:array) { [1, 2, 3, 4, 5].shuffle }
it 'works with an empty array' do
expect([].bubble_sort).to eq []
end
it 'works with an array of one item' do
expect([1].bubble_sort).to eq [1]
end
it 'sorts numbers' do
expect(array.bubble_sort).to eq a... |
class AddUsuarioToLetra < ActiveRecord::Migration[5.0]
def change
add_column :letras, :usuario_id, :integer, null: false
end
end
|
require 'spec_helper'
describe Meme, type: :model do
after do
remove_uploaded_file
end
it "has correct association with user" do
should belong_to :user
end
it "should validate presence of raw_image_url" do
meme = Meme.create(raw_image_url: "")
expect(meme.valid?).to eq false
end
it "should r... |
class EstimateMailer < ActionMailer::Base
default from: "no-reply@accountimize.com"
def first_estimate_email(estimate, user, new_pw)
@estimate = estimate
@user = user
@new_pw = new_pw
mail to: user.email, subject: "#{estimate.client.account.name} just sent you an estimate via Accountimize"
end
end
|
require 'spec_helper'
describe "home/index.html.erb" do
before(:each) do
Factory.create(:update, :brief_message => "Brief Message1", :details => "MyText")
Factory.create(:update, :brief_message => "Brief Message2", :details => "MyText")
end
it "renders appropriate text on first time logging in" do
a... |
class Program < ApplicationRecord
has_many :cycles, :class_name => "ProgramCycle"
has_many :roles, :class_name => "ProgramRole"
end
|
SorceryApp::Application.routes.draw do
get "logout" => "sessions#destroy", as: "logout"
get "login" => "sessions#new", as: "login"
get "signup" => "staffs#new", as: "signup"
resources :staffs
resources :sessions
get "secret" => "home#secret", as: "secret"
root "home#index"
end
|
# frozen_string_literal: true
module Brigitte
module Commands
module Pile
#
# Command that evaluates and adds cards on pile
class AddCards
class << self
def process(player, cards, pile, removed_cards = [])
return false unless valid?(player, cards, pile)
... |
module Elements
class ElementArray
UNASSIGNABLE_KEYS = %w( id _destroy )
instance_methods.each { |m| undef_method m unless m.to_s =~ /^(?:send|object_id)$|^__/ }
attr_reader :element, :property, :property_id, :association_name, :sortable
def initialize(element, property, options={})
@element... |
class UsersController < ApplicationController
before_filter :require_current_user!, :only => [:show]
before_filter :require_no_current_user!, :only => [:create, :new]
def create
begin
@user = User.new(params[:user])
@info = Info.new(params[:info])
ActiveRecord::Base.transaction do
... |
# http://matteomelani.wordpress.com/2011/10/17/authentication-for-mobile-devices/
# https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# GET
# http://localhost:3000/courses.json?auth_token=<put your token here>
#
#
# POST
# http://localhost:3000/api/sessions.json
# Content-Type:a... |
require 'rails_helper'
describe AdminUser do
let(:test_admin_user) { FactoryGirl.create :admin_user }
it 'has email' do
expect(test_admin_user.email).to be_truthy
end
it 'has password' do
expect(test_admin_user.password).to be_truthy
end
end
|
namespace :tag_task do
desc 'initialize tags'
task init: :environment do
Preference.destroy_all
Tag.destroy_all
Tag.create(name: 'R-18G')
Tag.create(name: 'スカトロ')
Tag.where(censored_by_default: true).each do |tag|
puts "censoring #{tag.name}..."
User.find_each do |user|
pri... |
require 'test_helper'
class DepartmentsStoreTest < ActiveSupport::TestCase
test "the truth" do
assert true
end
test "should not save without store_id" do
d = DepartmentsStore.new
assert !d.save
end
test "should not save user without department_id" do
d = DepartmentsStore.new
assert !d.save
end
... |
# frozen_string_literal: true
class SessionController < ApplicationController
skip_before_action :should_authenticate?, only: [:create]
skip_before_action :fetch_subscriptions, :init_empty_subscription
skip_before_action :verify_authenticity_token,
only: [:create], if: -> { Rails.env.develo... |
class Project < ApplicationRecord
belongs_to :manager
has_many :tasks, :dependent => :destroy
validates :name, presence: true
end
|
require 'rails_helper'
RSpec.describe "syndromes/new", type: :view do
before(:each) do
assign(:syndrome, Syndrome.new(
:name => "MyString",
:description => "MyText",
:position => 1
))
end
it "renders new syndrome form" do
render
assert_select "form[action=?][method=?]", syndro... |
require 'spec_helper'
describe "User Pages" do
subject { page }
describe "index" do
before(:all) { 5.times { FactoryGirl.create(:user) } }
after(:all) { User.delete_all }
let(:users) { User.all }
before(:each) {visit users_path}
it { source.should have_selector('title', text: 'Users') }
... |
require 'constraint/basic_constraint'
class SessionConstraint < BasicConstraint
cattr_reader :PAGE_TITLE, :LABEL_SIGN_IN_BUTTON, :USER_AUTHENTICATION_TOKEN
@@USER_AUTHENTICATION_TOKEN = :user_authentication_token
@@PAGE_TITLE = "Sign In"
@@LABEL_SIGN_IN_BUTTON = "Log In"
end |
class RsvpController < ApplicationController
def new
@event = Event.find_by_id(params[:id])
if !@event || @event.start_time < DateTime.now
redirect_to root_path
end
end
def new_with_new_member
@email_id = session[:email]
@first_name = session[:first_name]
@last_name = session[:l... |
class CreateWalkers < ActiveRecord::Migration
def change
create_table :walkers do |t|
t.string :first_name, :last_name, :pledge_type
t.decimal :amount_owed, :amount_paid, :amount_remaining
t.boolean :walk_up, :default => false
t.integer :team_id
t.timestamps
end
end
end
|
Mailjet.configure do |config|
config.api_key = Settings.mailjet.client_id
config.secret_key = Settings.mailjet.client_secret
config.domain= 'nicolasgrenie.com'
config.default_from = "me@nicolasgrenie.com"
end |
require 'checkout'
class FundraisersController < ApplicationController
#include Checkout
before_action :set_fundraiser, only: [:show, :edit, :update, :destroy]
before_action :authorize, only: [:new, :edit, :create, :update, :destroy]
def index
@fundraisers = Fundraiser.all
end
def show
end
def ... |
require "rails_helper"
RSpec.feature "user can see featured items on homepage" do
scenario "when a user lands on the homepage, they see some featured items" do
create(:item)
visit root_path
within(find_by_id("title")) do
expect(page.text).to have_content(/Item Title \d/)
end
within(find_... |
class CreateBettingTickets < ActiveRecord::Migration[5.2]
def change
create_table :betting_tickets do |t|
t.integer :user_id
t.integer :racecourse
t.integer :year
t.integer :month
t.integer :date
t.integer :kaisai1
t.integer :kaisai2
t.integer :race_number
t.... |
require 'spec_helper'
describe 'template_tasks/edit', :type => :view do
before(:each) do
@template_task = assign(:template_task, stub_model(TemplateTask,
:name => 'MyString',
:price_per_day => 50000
))
end
it 'renders the edit template_task form' do
render
# Run the generator again ... |
class CommentsController < ApplicationController
def create
# comment_params is like a short-hand for the params hash for all attributes the comment has
@comment = Comment.new(comment_params)
@comment.article_id = params[:article_id]
@comment.save
# we dont create a new html page here, but we si... |
class CreateGeneratedCertificates < ActiveRecord::Migration
def self.up
create_table :generated_certificates do |t|
t.text :certificate_html
t.references :issued_for, :polymorphic => true
t.date :issued_on
t.string :manual_serial_no
t.integer :serial_no, :limit => 8
t.reference... |
class AddCmpinfoToCodebooks < ActiveRecord::Migration
def change
add_column :codebooks, :cmpinfo, :text
end
end
|
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = 'rbpay'
s.version = '0.0.0'
s.author = 'Yuri Chandra | yurichandra'
s.summary = 'Rbpay is Indonesia payment gateway wrapper. Support Xendit.'
s.description = 'Rbpay is Indonesia payment gateway wrapper. Support Xendit.'
s.required_ruby_ve... |
require 'spec_helper'
describe(Stylist) do
describe('#name') do
it("returns the stylist's name") do
stylist = Stylist.new({:name => "Gene", :id => nil})
expect(stylist.name).to(eq("Gene"))
end
end
describe("#id") do
it("sets the stylist's id") do
stylist = Stylist.new({:name => "G... |
module Shoperb module Theme module Editor
class Configuration < HashWithIndifferentAccess
OPTIONS = {
"oauth-site" => "Your shoperb shop domain",
"oauth-redirect-uri" => "Url shoperb will redirect to after granting access",
"verbose" => "Enable verbose mode",
"port" => "Port you want your... |
# This file was generated by GoReleaser. DO NOT EDIT.
class GolangSeed < Formula
desc "Golang project starter"
homepage "https://github.com/dohr-michael/golang-seed"
url "https://github.com/dohr-michael/golang-seed/releases/download/v1.0.0/golang-seed_1.0.0_Darwin_x86_64.tar.gz"
version "1.0.0"
sha256 "66434a... |
# encoding: utf-8
require 'spec_helper'
describe Project, "when providing ruby version" do
let(:project) { provide_project }
context "when not configured" do
before do
provide_bucket_group_config nil
end
it "has no ruby version for the bucket groups" do
expect(project.ruby_version('defaul... |
# == Schema Information
#
# Table name: brackets
#
# id :integer not null, primary key
# tournament_id :integer
# matchup_id :integer
# bye :boolean default(FALSE)
# bracket_type :string
# winner_child :integer
# loser_child ... |
=begin
Write a method fib() that a takes an integer nn and returns the nnth Fibonacci ↴ number.
=end
def fib(n)
return 0 if n == 0
return 1 if n == 1
arr = [0,1]
(2..n).each { |i|
val = arr.last + arr[-2]
arr.push(val)
}
return arr.last
end
puts fib(6)
|
feature "Equipment#create" do
background do
visit '/'
within('#sign-up') do
fill_in "Email", with: "pirate@gmail.com"
click_button "Submit"
end
open_email "pirate@gmail.com"
current_email.click_link 'activate'
expect(current_path).to have_content('activate')
fill_in "Username"... |
class CopyProductPriceIntoLineItem < ActiveRecord::Migration[5.0]
def up
add_column :line_items, :product_price, :decimal, precision: 8, scale: 2
# copy the product price into the line item
LineItem.all.each do |item|
item.product_price = item.product.price
item.save!
end
end
def do... |
#
# Be sure to run `pod lib lint QHLiveSDK.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'QHLiveSDK... |
require 'spec_helper'
describe Supervisor do
let(:supervisor) { FactoryGirl.create(:supervisor) }
subject { supervisor }
it { should respond_to(:staff_number)}
it { should respond_to(:bbusername)}
it { should respond_to(:research_centre_name) }
it { should respond_to(:research_centre_code)}
it { should... |
require 'erb'
module Coco
# I format the index.html
#
class HtmlIndexFormatter
# uncovered - An Array list of uncovered files.
# result - CoverageResult.
# threshold - Fixnum.
#
def initialize(uncovered, result, threshold = 100)
@uncovered = uncovered
@result = result
@... |
class ResponsesController < ApplicationController
def update
@response = Response.find(params[:id])
if @response.update(response_params)
respond_to do |format|
format.html
format.js
end
else
redirect_to :back
end
end
private
def response_params
params.req... |
#====== texte à afficher par champ donné
class TexteAfficher
attr_accessor :gTexteAfficher
attr_accessor :renvoie
#création du texte à afficher
# @param unTexte //le texte du champ à remplir
# @param unAffichage //le remplissage du champ
# @return void //ne renvoie rien
def TexteAfficher.creer(u... |
module OpenXml
module Docx
module Elements
class Element
include AttributeBuilder
class << self
attr_reader :property_name
attr_reader :namespace
def tag(*args)
@tag = args.first if args.any?
@tag
end
def name(*args... |
class StudentsController < ApplicationController
before_action :set_student, only: %i[show edit update destroy]
def index
@search = Student.where(user: current_user).ransack(params[:q])
@students = @search.result
authorize(@students)
end
def show; end
def new
@student = current_user.student... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.