text stringlengths 10 2.61M |
|---|
require 'omf-web/tab/abstract_service'
require 'omf-web/widget/abstract_widget'
module OMF::Web::Tab::TwoColumn
class TwoColumnService < OMF::Web::Tab::AbstractService
def initialize(tab_id, opts)
super
debug "New TwoColumn Service: #{opts.inspect}"
@lwidgets = (opts[:left] || []).coll... |
require_relative "vehicle"
class Bus < Vehicle
def to_s
"The bus: #{model} - #{type} - #{number}"
end
def max_passengers
30
end
end
|
require './lib/item.rb'
class ShopItem
MIN_QUALITY = 0
MAX_QUALITY = 50
QUALITY_DELTA = 1
AGE_DELTA = 1
EXPIRY_DAY = 0
SELL_IN_DOUBLE_QUALITY_DELTA_BOUNDARY = 12
SELL_IN_TRIPLE_QUALITY_DELTA_BOUNDARY = 5
BRIE = "Aged Brie"
SULFURAS = "Sulfuras, Hand of Ragnaros"
BACKSTAGE_PASS = "Backstage passes... |
# Fix to ensure that the object is available in the migration
class BarcodeItem < ApplicationRecord; end
# Remove the global field -- we're no longer using this.
class RemoveGlobalFromBarcodeItem < ActiveRecord::Migration[5.2]
def up
remove_column :barcode_items, :global
end
def down
add_column :barcode... |
require 'pry'
helpers do
def domain
return request.host_with_port if Sinatra::Application.development? || Sinatra::Application.test?
request.host
end
def handle_post_request(url)
if url.save && request.xhr?
url.set_short_code
erb :'/urls/_url', locals: {url: url}, layout: false
elsif ... |
source 'https://rubygems.org'
ruby '2.1.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
gem 'rake'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
#gem 'mysql2'
gem 'pg'
# Allows the use of foreign keys used to protect data integrity (per Xavier Shay)
gem 'foreigner'
# ... |
module EITI
module Data
# access a nested property of the (assumed) Hash data:
#
# get({"a" => 1000}, "a") == 1000
# get({"2001" => 5}, 2001) === 5
def get(data, *keys)
# bail if there"s no data
return nil if data == nil
# coerce all of the keys to strings,
# and filter ... |
#
# Simple script to generate the error pages
#
require 'yaml'
require 'fileutils'
pages = YAML.load_file('pages.yml')
page_template = File.open('SKELETON.html', 'r').read
pages_dir = 'error'
FileUtils.rm_rf Dir.glob(pages_dir + '/*')
FileUtils.cp_r 'assets/.', pages_dir
puts "[i] Generating error pages"
pages.... |
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "lenticular_cms/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "lenticular_cms"
s.version = LenticularCms::VERSION
s.authors = ["Jonathan Greeley"]
s.email ... |
Pod::Spec.new do |s|
s.name = "TDOAuth"
s.version = "0.0.1"
s.summary = "A BSD-licensed single-header-single-source OAuth1 implementation."
s.description = <<-DESC
A BSD-licensed single-header-single-source OAuth1 implementation. Forked from Tweetdeck.
D... |
class CreateTableRecipeMenus < ActiveRecord::Migration
def up
create_table :menus_recipes do |t|
t.integer :recipe_id
t.integer :menu_id
end
end
def down
drop_table :menu_recipes
end
end
|
require 'rails_helper'
RSpec.describe "staff_permissions/new", type: :view do
before(:each) do
assign(:staff_permission, StaffPermission.new(
:manage_seat => false,
:manage_vouchers => false,
:manage_show_time => false,
:manage_tax_info => false,
:manage_price_per_day => false,
... |
class VotesController < ApplicationController
before_action :set_vote, only: [:show, :edit, :update, :destroy]
# GET /votes
# GET /votes.json
def index
@votes = Vote.all
end
# GET /votes/1
# GET /votes/1.json
def show
end
# GET /votes/new
def new
@vote = Vote.new
end
# GET /votes/1... |
#モジュール
module Thinkable
#メソッド
def think
puts "私は#{self.hobby}について考えています"
end
end
|
class Command
attr_accessor :vesselid, :action, :coordinate
end |
# Establishes the variable cars is equal to 100
cars = 100
# Establishes the variable space_in_a_car is equal to 4
space_in_a_car = 4
# Establishes the variable drivers is equal to 30
drivers = 30
# Establishes the variable passengers is equal to 90
passengers = 90
# Establishes the variable cars_not_driven is equal to... |
#require "./td_config.rb"
#$debug = true
class TdInitializer
def initialize(root)
@root ||= root
generate_pathes
load_config_and_test_data
load_app_pages_and_components
start_browser
end
def generate_pathes
puts "generate path in ENV" if $debu... |
name 'azurerm_experimental'
maintainer 'Stuart Preston'
maintainer_email 'stuart@chef.io'
license 'Apache-2.0'
description 'AzureRM-experimental'
long_description 'Installs/Configures the AzureRM experimental cookbook'
version '0.11.0'
chef_version '>= 12.8' if respond_to?(:chef_version)
issues_url 'https://github.com/... |
class AddBilirubinTotalToClinicalBloodRecords < ActiveRecord::Migration
def change
add_column :clinical_blood_records, :bilirubin_total, :float
end
end
|
require 'test_helper'
class KickspostsControllerTest < ActionDispatch::IntegrationTest
def setup
@kickspost = kicksposts(:orange)
end
test "should redirect create when no logged in" do
assert_no_difference 'Kickspost.count' do
post upload_path, params: { kickspost: { title: "Air jordan 1 bred",
... |
RSpec.describe "Admin Organization Management", type: :system, js: true do
context "While signed in as an Administrative User (super admin)" do
before :each do
sign_in(@super_admin)
end
it "filters by organizations by name in organizations index page" do
foo_org = FactoryBot.create(:organizat... |
require "spec_helper"
RSpec.describe "Day 3: Toboggan Trajectory" do
let(:runner) { Runner.new("2020/03") }
let(:input) do
<<~TXT
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
... |
class FriendshipsController < ApplicationController
# See Listing 10.46
before_action :signed_in_user, only: [:create, :destroy]
before_action :correct_user, only: :destroy
# http://railscasts.com/episodes/163-self-referential-association
def create
@friendship = current_user.friendships.build(:friend_id => params[:... |
require 'spec_helper'
describe 'tcpwrappers' do
context 'supported operating systems' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let (:facts) {
os_facts.merge({
:interfaces => 'eth0,lo',
})
}
it { is_expected.to create_class('tcp... |
require './lib/stock_report/version'
class StockReport::CLI
def call
menu
end
def menu
input = ""
while input != "exit"
puts "------------------------------------------"
puts "Welcome to stock report! What can I do for you?"
puts "------------------------------------------"
put... |
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
include Zheng
describe Zheng::Actions do
describe "action dispatching" do
before do
module Zheng; module Actions
module Test
module_function
def test(param1, param2);end
end
end;end
end
it "sh... |
class CommentsController < ApplicationController
before_filter :load_new_comment, :only => [:create]
protected
def load_new_comment
@comment = Comment.new(params[:comment])
end
public
def create
if @comment.save
flash[:notice] = "Comment was submitted successfully."
else
flash[:err... |
Dddd::Application.routes.draw do
root :to => 'registrations#new'
resources :registrations, :only => [:new, :create]
resources :talks, :only => [:index, :show]
resources :designers, :only => [:index]
resources :developers, :only => [:index]
resources :startups, :only => [:index, :show]
... |
class Personnel < ApplicationRecord
validates :name, presence: true
has_and_belongs_to_many :positions
has_many :resume, dependent: :destroy
after_validation do
self.name = name.titleize
end
def self.hitung_posisi(personnel)
Personnel.find(personnel).positions.count
end
end |
module TechnologyTypesHelper
def link_to_technology_type assay
uri = assay.technology_type_uri
label = assay.technology_type_label
if assay.valid_technology_type_uri?
link_to label,technology_types_path(:uri=>uri,:label=>label)
else
label
end
end
def parent_technology_types_list_... |
class Shop < ApplicationRecord
has_many :shop_items, :class_name => 'Shop::Item'
end
|
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :owner do
first_name "Bartleby"
last_name "Sterling"
email "bsterling@landedgentry.com"
company "Engulf & Devour"
end
end
|
# frozen_string_literal: true
require 'application_system_test_case'
module Courses
class DeleteTest < ApplicationSystemTestCase
driven_by :selenium, using: :headless_chrome
def setup
@teacher = teachers(:snape)
@course = courses(:potions)
sign_in @teacher
end
test 'guest user ca... |
require "gosu"
attr_reader :x , :y
class enemy
def initialize(badguy)
pink = Gosu::Image::load_tiles("media/.png", 25,25)
@image = enimes[rand(enimes.lenght)]
@x = rand *
end
def movement
@x += @vel_x
@y += @vel_y
@x %=640
@x %=480
@vel_y *=0.4
@vel_x *=0.4
end
end
|
require "fileutils"
BIN = File.join(File.dirname(__FILE__),"../bin/scribble")
# Run the app with the given input, return the output (stdout and stderr) as an array of lines
def run input
lines = `echo "#{input}" | #{BIN} 0 0 2>&1`
lines.split("\n")
end
describe "sexp validation" do
it "should reject an e... |
module Supersaas
class BaseApi
attr_accessor :client
INTEGER_REGEX = /\A[0-9]+\Z/
DATETIME_REGEX = /\A\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}\Z/
def initialize(client)
@client = client
end
protected
def validate_id(value)
if value.is_a?(Integer)
value
e... |
# -*- encoding : utf-8 -*-
class DateTools
# Returns a list of all regular working weekdays.
# 1 is monday, 7 is sunday (same as in Date::cwday)
def self.getWorkingDays()
result = Set::new
result.add(1) if Setting['plugin_redmine_workload']['general_workday_monday'] != ''
result.add(2) if Setting['p... |
hduser = node['single_node_hadoop_claster']['user']['name']
hdgroup = node['single_node_hadoop_claster']['user']['group']
# Create a user and a group ---------------------------------------------------
user hduser do
supports :manage_home => true
home "/home/#{hduser}"
shell "/bin/bash"
end
group hdgroup do
... |
require File.dirname(__FILE__) + '/base'
##
# Original Author: Hoang Nguyen Minh
#
# This class is used to create a chart with bars and lines
#
class Gruff::BarNLine < Gruff::Bar
attr_accessor :line_width
attr_accessor :dot_radius
attr_accessor :hide_dots
# Allow for reference lines ( which are like baseli... |
class AddToAddresses < ActiveRecord::Migration
def change
add_column :addresses, :country, :string
add_column :addresses, :notes, :text
end
end
|
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string not null
# password_digest :string not null
# session_token :string not null
# created_at ... |
class Article < ApplicationRecord
has_many :categories
has_one :user, required: false
end
|
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 1024
end
config.vm.synced_folder '..', '/home/vagrant/tinet', disabled: false
config.vm.provision "shell", inline: <<-SHELL
apt-get update
# Install Docker
... |
# Attributes
# user_id => integer - the user who scheduled this job - mongoid in the future
# experiment_id => the experiment which should be computed by this job
# created_at => time - when this job were scheduled
# time_limit => time - when this job should be stopped
# job_id => string - glite id of the job
# sm_uuid... |
require "spec_helper"
require "rspec_api_documentation/dsl"
resource "Creating and Managing Linx Projects" do
let(:user) { create(:user) }
let(:project) { create(:project, user: user) }
let(:parsed_response) { JSON.parse(response_body).with_indifferent_access }
post "/api/v1/projects" do
parameter :auth_t... |
#!/usr/bin/env ruby
require "sinatra"
require "json"
REP_FULL_NAME="enukane/c88-harvey-os-book"
ORIG_FILE="c88book.pdf"
STORE_PREFIX="~/public_html/c88-harvey-os-book"
FILE_PREFIX="c88-"
def generate_filename
return "#{FILE_PREFIX}#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf"
end
def do_job
# first do gitpull
res... |
require 'rails_helper'
RSpec.describe ImagesController, type: :controller do
describe "images#index action" do
it "should successfully show the page" do
get :index
expect(response).to have_http_status(:success)
end
end
describe "images#new action" do
it "should require users to be logged... |
Naptanapi.controllers :stops do
before { @mixpanel = Mixpanel::Tracker.new("409c3adff4a49c60d491d3d76d5516f7", request.env, true) }
get :index, :provides => [:html, :json] do
page_size = 100
if params[:page].to_i >0
page = params[:page].to_i
else
page = 1
end
case content_type
... |
#!/usr/bin/env ruby
# encoding: UTF-8
require File.join(File.dirname(__FILE__), "..", "spec_helper")
describe "Macro:" do
before do
create_project
Glyph.run! 'load:all'
end
after do
Glyph.lite_mode = false
reset_quiet
delete_project
end
it "anchor" do
interpret "this is a #[test|test]."
doc = @p.... |
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
class PastasPackagesRelationship < ApplicationRecord
validates :pasta_id, presence: true
validates :package_id, presence: true
belongs_to :pasta
belongs_to :package
end
|
#
# Retourne le code pour une vue introuvable
#
# @TODO: plus tard, il faudrait distinguer une vue d'une page. Pour le
# moment, même si c'est un « template » qui n'est pas trouvé, on utilise
# cette page 404
#
"Désolé, mais la vue « #{param(:unfound_view)} » est introuvable.".
as_div(:class => 'warning') |
#FizzBuzz
# Write a program that prints integers 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"
#
# Here's an example of what your output should look like:
#
# <img src="http://w... |
class ApplicationController < ActionController::Base
prepend_before_filter :get_auth_token
protect_from_forgery
MissingAuthenticationToken = Class.new(Exception)
InvalidAuthenticationToken = Class.new(Exception)
rescue_from InvalidAuthenticationToken, with: :invalid_authentication_token
rescue_from Missi... |
require 'rails_helper'
describe TournamentCreator do
let!(:player_1) { Player.create name: 'Player 1' }
let!(:player_2) { Player.create name: 'Player 2' }
let(:players_ids) { [player_1.id, player_2.id] }
let(:tournament_name) { 'Some Name' }
let(:end_date) { 1.week.from_now }
let(:type) { 'RoundRobin' }
... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe PuppetX::Cups::Queue do
describe '##attribute' do
end
end
RSpec.describe PuppetX::Cups::Queue::Attribute do
describe '#value' do
context 'when the query result is an array' do
it 'returns an empty string' do
attribute = descri... |
class RenameUserPreviusWorkoutGroupColumn < ActiveRecord::Migration[5.2]
def change
rename_column :user_previous_workouts, :workout_group_id, :workout_id
end
end
|
# frozen_string_literal: true
require 'file_storage/attached/one'
require 'file_storage/attached/many'
module FileStorage
module Attached::Macros
def has_one_file(name = nil, location: :system)
unless name
raise NameError, "Attachment name key is not allowed for nil" \
"M... |
class SignUpController < Formotion::FormController
def init
super.initWithForm(form)
end
def form
@form ||= Formotion::Form.new({
sections: [{
title: "User Information",
rows: [{
title: "Email",
auto_capitalization: :none,
auto_correction: :no,
... |
ActiveAdmin.register WooOrder, as: "Orders" do
includes :woo_acknowledgements, :woo_line_items, :woo_shipping_addresses, :woo_shipnotices
index do
selectable_column
column "WooID" do |order|
link_to order.number, admin_order_path(order)
end
column "PO" do |order|
link_to order.id, admin... |
#!/usr/bin/env ruby
# This script deletes all of the failed RTS runs from a table and re-labels
# the observations as "unqueued", such that running the daemon on the table
# will allow you to have another go at calibration.
require "optparse"
require "fileutils"
require "sqlite3"
$LOAD_PATH.unshift "#{File.dirname(_... |
class SavingsAccount < Owner::Account
BALANCE_MIN += 10
INTEREST_RATE = 0.0025
attr_accessor :interest_rate
def initialize
super()
end
def interest
super()
interest = @balance * INTEREST_RATE
total = @balance + (@balance * INTEREST_RATE)
@balance = total
puts ... |
FactoryGirl.define do
factory :company do
name "LinkedIn"
street_num 1234
street "LinkedIn Street"
city "San Francisco"
country "USA"
website_url "www.LinkedIn.com"
thumbnail_url "www.LinkedIn.com"
end
end |
module HasModerated
class Railtie < Rails::Railtie
initializer "has_moderated.include_in_activerecord" do
ActiveSupport.on_load :active_record do
include HasModerated::Common::InstanceMethods
extend HasModerated::UserHooks::ClassMethods
extend HasModerated::Associations::Base::ClassM... |
class Report < ActiveRecord::Base
validates :from_date, presence: true
validates :to_date, presence: true
validates :menu_item_cost, presence: true
end
|
require "rails_helper"
feature "user visits roster transactions page" do
scenario "and views a list of waiver claims in a league" do
fantasy_league = create(:fantasy_league,
id: FantasyLeague::DEFAULT_LEAGUE_ID)
fantasy_team = create(:fantasy_team, fantasy_league: fantasy_league)
... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
#session[:count] = nil
def after_sign_in_p... |
module FellowshipOne
include Enumerable
class Person < ApiObject
# Gender = {:male => 'Male', :female => 'Female'}
# PhoneType = {:home => 'Home', :work => 'Work', :mobile => 'Mobile'}
# MaritalStatus = {:never_married => 'Never Married', :engaged => 'Engaged',
# :married => 'Mar... |
class Machine < ActiveRecord::Base
extend ActiveSupport::Memoizable
RUNNING_TIMEOUT = 10 #分钟
GEM_PACKAGE_UPGRADE = "C:/gem_package_upgrade.bat"
HOST_ADD = "C:/WINDOWS/system32/drivers/etc/hosts"
GEM_LIST ="gem list "
TYPE = {:auto => 1, :perf=>10, :other => nil}
TYPE_TXT = {:auto => "TAM", :perf => "性能专用"... |
class UpgradeTo170A < ActiveRecord::Migration
def self.up
add_column :cms_pages, :force_ssl, :boolean, :default => false
end
def self.down
remove_column :cms_pages, :force_ssl
end
end
|
=begin
my attempt:
require 'prime' # This is a module. We'll cover these soon!
def first_n_primes(n)
n.is_a? Integer puts "n must be an integer." unless true
puts "n must be greater than 0." if n <= 0
return Prime.first n
end
first_n_primes(10)
=end
require 'prime' # This is a module. We'll cover these... |
require 'spec_helper'
describe "work_orders/edit" do
before(:each) do
@work_order = assign(:work_order, stub_model(WorkOrder))
end
it "renders the edit work_order form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form", :action =>... |
class Bag
class Node
attr_accessor :item, :next
def initialize(item)
@item = item
end
end
attr_accessor :head, :tail, :size
def initialize
@size = 0
end
def add(item)
node = Node.new(item)
if @size == 0
@head = node
@tail = node
else
@tail.next = node... |
# # encoding: utf-8
# Inspec test for recipe task1_jboss::default
# The Inspec reference, with examples and extensive documentation, can be
# found at http://inspec.io/docs/reference/resources/
describe service('wildfly') do
it { should be_enabled }
it { should be_running }
end
describe http('http://192.168.33... |
require 'hydra/derivatives'
module Hydra::Works
class PersistDerivative < Hydra::Derivatives::PersistOutputFileService
##
# Persists a derivative to a GenericFile
# This Service conforms to the signature of `Hydra::Derivatives::PersistOutputFileService`.
# The purpose of this Service is for use as... |
module Expression
class Expression < Treetop::Runtime::SyntaxNode
def self.operands_match(operand1, operand2)
operand1.class == operand2.class or
(operand1.class.to_s == 'Fixnum' and operand2.class.to_s == 'Float') or
(operand1.class.to_s == 'Float' and operand2.class.to_s == 'Fixnum')
... |
class Ingredient < ApplicationRecord
has_many :measurements
has_many :recipes, through: :measurements
has_many :categories, through: :recipes
accepts_nested_attributes_for :measurements, allow_destroy: true
validates :name, presence: true
end
|
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def self.text_search(query)
if query.present?
return search(query)
else
return []
end
end
end
|
class Route < ActiveRecord::Base
belongs_to :route_provider
belongs_to :origin_poi, :class_name => "Poi"
belongs_to :destination_poi, :class_name => "Poi"
end
|
class MassMailer < ApplicationMailer
include Roadie::Rails::Mailer
default from: "#{FurryMart::Application.config.site_name} <notification@#{ENV['DOMAIN'] || 'example.com'}>"
add_template_helper(ApplicationHelper)
def regular(mass_mail, recipient)
@mass_mail = mass_mail
@recipient = recipient
ro... |
require 'spec_helper'
describe Job do
describe "process" do
before :each do
@job = Job.new
end
it "should set the started_at and ended_at timestamps" do
@job.process
@job.started_at.should_not be_nil
@job.ended_at.should_not be_nil
end
it "should call the process_impl met... |
module IQ::Upload::Extensions::ActiveRecord
# Options:
# * <tt>:storage</tt> - (optional) storage adapter to use - defaults to :fs
# * <tt>:backgroundrb</tt> - (optional) process images using backgroundrb. defaults to false
# * <tt>:dir</tt> - (optional) path from RAILS_ROOT to store uploaded files. Defaults to... |
module FormsHelper
def bootstrap_form(record, options = {}, &block)
options.update(builder: BootstrapFormBuilder)
options[:html] ||= {role: 'form'}
options[:html][:class] ||= ''
options[:html][:class] << ' form-horizontal'
form_for(record, options, &block)
end
class BootstrapFormBuilder < A... |
RSpec.configure do |config|
config.before do
FakeTwitter.clear
end
end
|
# frozen_string_literal: true
require "uri"
require "net/http"
require "happymapper"
require_relative "ipgeobase/version"
require_relative "ipgeobase/ip_meta"
# Ipgeobase - allows you to get data by ip address
module Ipgeobase
class Error < StandardError; end
def self.lookup(ip_address)
api = "http://ip-api... |
class BatchAssignment < ActiveRecord::Base
belongs_to :batch
belongs_to :assignment
has_many :student_assignments
has_many :students, through: :student_assignments
end
|
class OptionGenerator < Rails::Generator::Base
def manifest
record do |m|
m.directory 'app/models'
m.file 'option.rb', 'app/models/option.rb'
m.migration_template "create_options.rb", "db/migrate"
end
end
def file_name
"create_options"
end
end
|
require 'spec_helper'
describe Hydra::AccessControls::Permission do
describe "an initialized instance" do
let(:permission) { described_class.new(type: 'person', name: 'bob', access: 'read') }
it "should set predicates" do
expect(permission.agent.first.rdf_subject).to eq ::RDF::URI.new('http://project... |
class GastospropiedadsController < ApplicationController
before_action :set_gastospropiedad, only: [:show, :edit, :update, :destroy]
# GET /gastospropiedads
# GET /gastospropiedads.json
def index
@gastospropiedads = Gastospropiedad.all
end
# GET /gastospropiedads/1
# GET /gastospropiedads/1.json
d... |
class Relationship < ActiveRecord::Base
before_save do
used_numbers = memorializer.relationships.map { |relationship| relationship.twilio_number }
self.twilio_number = (Rails.application.config.twilio_numbers - used_numbers).first
end
belongs_to :memorializer, class_name: "User"
belongs_to :memorializ... |
class EventInvitation < ActiveRecord::Base
belongs_to :sender, :class_name => 'User'
belongs_to :event
has_many :emails, :class_name => 'EventInvitationEmail'
has_many :recipients,
:through => :emails,
:class_name => 'User',
:foreign_key => 'user_id'
validates_presence_of :even... |
class Add < ActiveRecord::Migration
def change
add_column :evidences, :description, :text
add_column :evidences, :title, :string
end
end
|
Mitsumoritaro::Application.routes.draw do
resources :template_tasks do
member do
patch 'move_higher' => 'template_tasks#move_higher', as: :move_higher
patch 'move_lower' => 'template_tasks#move_lower', as: :move_lower
end
end
resources :projects do
collection do
get 'archived' => 'p... |
require "spec_helper"
describe ReadingsExporter do
let(:user_1) { create(:user) }
let(:user_2) { create(:user) }
let(:user_3) { create(:user) }
let!(:reading_1) do
create(:reading, temp: 50, created_at: 1.week.ago, user: user_1)
end
let!(:reading_2) do
create(:reading, temp: 55, created_at: 3.days.... |
module TestSupport
module Hooks
def configure_defaults
FluentECS.configure do |c|
c.cache_ttl = :none
c.cache_size = 1000
c.fields = ['docker_name']
end
end
def remove_cache
needed = FluentECS::Container.instance_variable_defined?(:@cache)
FluentECS::C... |
# encoding: utf-8
# Copyright 2007-2014 Greg Hurrell. All rights reserved.
# Licensed under the terms of the BSD 2-clause license.
require 'spec_helper'
describe Walrat::StringEnumerator do
it 'raises an ArgumentError if initialized with nil' do
expect do
Walrat::StringEnumerator.new nil
end.to raise_... |
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', "helper"))
module Nokogiri
module XML
module SAX
class TestParser < Nokogiri::SAX::TestCase
def setup
@parser = XML::SAX::Parser.new(Doc.new)
end
def test_bad_document_calls_error_handler
@pa... |
# auto_brute.rb
# Author: m-1-k-3 (Web: http://www.s3cur1ty.de / Twitter: @s3cur1ty_de)
# This Metasploit RC-File could be used to automate the brutef.rbe process
# the services are used from the already discovered service details of the database
# for this we need the service names in the db!
# VERBOSE is used from t... |
katz_deli = []
def line(line_array)
#check if line is empty
if line_array.size == 0
#output message if line is empty
puts "The line is currently empty."
else
#string to build upon for output
line_message = "The line is currently: "
#iterate over each item in the given array
... |
require 'yaml'
class ClocStatsGenerator
include HashInit
attr_accessor :spec, :source_download_location, :options, :output_location
def source_files
pathlist = Pod::Sandbox::PathList.new( Pathname.new(@source_download_location) )
[@spec, *@spec.recursive_subspecs].reduce([]) do |memo, internal_spec|
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.