text stringlengths 10 2.61M |
|---|
class Sulten::ReservationType < ActiveRecord::Base
has_many :reservations
has_many :tables, through: :table_reservation_types
def to_s
name
end
end
|
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
def chromatic_scale
render "chapters/_c_chromatic_scale"
end
end
|
class Idea < ApplicationRecord
validates :name, :description, presence: true
belongs_to :user
belongs_to :category
has_many :idea_images, dependent: :destroy
has_many :images, through: :idea_images
end
|
class AddFkToSubCutoff < ActiveRecord::Migration
def up
add_foreign_key "sub_cutoffs", "main_subjects", name: "sub_cutoff_fK_to_main_subjects"
end
def down
remove_foreign_key "sub_cutoffs", name: "sub_cutoff_fK_to_main_subjects"
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'edit event', type: :feature do
scenario 'success' do
event = Event.create!(name: 'Test Event', description: 'Test description', location: 'Houston',
time: '3:30 PM', points: '10', date: '20 June 1996', link: 'http://t... |
require 'rubygems'
spec = Gem::Specification.new do |gem|
gem.authors = 'Christopher Whiteley'
gem.email = 'hello@openzis.org'
gem.homepage = %q{http://github.com/cwhiteley/openagent}
gem.name = 'OpenAgent'
gem.version = '0.5.3'
gem.date = %q{2010-08-16}
gem.summary = 'OpenAgent is a SIF Agent Developmen... |
require 'open3'
require 'uri'
require 'rugged'
require_relative 'global.rb'
require_relative 'exceptions.rb'
module Utils
@@curl_prog = nil
@@tar_prog = nil
@@crew_md5sum_prog = 'md5sum'
@@crew_ar_prog = File.join(Global::TOOLS_DIR, 'bin', "ar#{Global::EXE_EXT}")
@@crew_tar_prog = File.join(Global:... |
class Customer
attr_reader :name, :age, :wallet, :stomach, :drunkness
def initialize(name, age, wallet)
@name = name
@age = age
@wallet = wallet
@stomach = []
@drunkness = 0
end
def buy_drink(drink_price)
if @age >= 18
@wallet -= drink_price
elsif @age < 18 && drink_price ==... |
class Post < ApplicationRecord
#-----DO NOT CHANGE THE RELATIONS!!!---#
#This is the set up for a many to may model---#
belongs_to :user
has_many :likes
has_many :user_likes, through: :likes, source: :user
# ----- validations ----
#On create
validates :content, presence: true, allow_blank: false
validat... |
require 'test_helper'
class ReportsControllerTest < ActionController::TestCase
setup do
# authenticate
activate_authlogic
UserSession.create(users(:testuser1))
end
it "should respond to csv format" do
params = { :format => :csv,
"planted_on_from" => "",
"planted_on_to" => "",
"... |
class UsersController < ApplicationController
def index
@users = User.all
@locations = Location.all
end
# Show One User Page
def show
@user = User.find(params[:id])
end
def edit
user_id = params[:id]
@user = User.find_by_id(user_id)
end
# Updates Information ... |
#{{{ Marathon Fixture
require 'default'
#}}} Marathon Fixture
require 'assertions/assert_settings'
require 'settings/on_setting_window'
def test
java_recorded_version = '1.6.0_20'
original_send_mml = expected_send_mml = get_setting('SendMML')
original_mml_version = ... |
=begin
#==============================================================================
** Resource Checker
Author: Hime
Date: May 5, 2013
------------------------------------------------------------------------------
** Change log
Feb 11, 2015
- added support for listing unused resources
May 5, 2013
- added... |
# -*-ruby-*-
require 'rake'
require 'rake/clean'
require 'rake/testtask'
gem 'rdoc'
require 'rdoc/task'
require 'securerandom'
require 'yaml'
require_relative 'doc/rakefile'
require_relative 'lib/ciphermyurl/options'
require_relative 'lib/ciphermyurl/db'
DB_APIKEYS = 'db/apikeys.yaml'
DB_PSTORE = 'db/data.marshall'
... |
class AmsTitlesController < ApplicationController
before_action :authenticate_user!, only: [:show, :edit, :update, :destroy, :create, :new]
before_action :set_ams_title, only: [:show, :edit, :update, :destroy]
before_action :set_paper_trail_whodunnit
load_and_authorize_resource
include ApplicationHelper
# ... |
require 'jsonpath'
require 'cgi'
module Utils
def self.unindent(s)
s = s.gsub(/\t/, ' ').chomp
min = ((s.split("\n").find {|l| l !~ /^\s*$/ })[/^\s+/, 0] || "").length
if min > 0
s.gsub(/^#{" " * min}/, "")
else
s
end
end
def self.pretty_print(struct, indent = true)
output =... |
class PicturesController< ApplicationController
before_action :set_picture, only: [:show, :edit, :update, :destroy]
# before_action :authenticate
#skip_before_action :require_login?
def index
@pictures =Picture.all
end
def show
# @picture=@team.picture
end
def new
@picture = Picture.... |
class Review < ActiveRecord::Base
belongs_to :facility
validates :name, presence: true
validates :email, presence: true
validates_format_of :email, with: /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/
validates :content, length: { minimum: 11}
end
|
module NewsTags
include Radiant::Taggable
desc %{
Gets scrolltext with active news.
*Usage:*
<r:news:marquee [behavior="scroll"] [direction="left"] [loop="true"] [scrollamount="1"] [scrolldelay="2"] />
}
tag 'newsMarquee' do |tag|
html = ''
currentnews.each do |news|
html += '<b>' ... |
require 'multi_json'
module Response
# This returns an instance of a Link that can be used for hypermedia envelopes.
#
# @example
# link = Response::Link.new('Accounts', 'http://example.com/accounts', 'accounts')
# link.to_hash
# => {:name=>"Accounts", :href=>"http://example.com/accounts", :rel=>"acc... |
ActiveAdmin.register Song do
permit_params :artist_name, :title
actions :all
form do |f|
inputs 'Song' do
f.input :artist
f.input :title
end
f.semantic_errors
f.actions
end
end
|
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
require 'uri'
require 'cgi'
require 'date'
require 'json'
require 'base64'
require 'erb'
require 'securerandom'
require 'time'
require 'timeliness'
require ... |
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'rdf/spec/enumerable'
describe RDF::Graph do
describe ".load" do
it "creates an unnamed graph" do
expect(described_class).to receive(:new).with(:base_uri => "http://example/")
described_class.load("http://example/", :base_uri => "http:/... |
class StudentSerializer < ActiveModel::Serializer
attributes :id, :name, :address, :phone
has_many :payments
belongs_to :course
end
|
class ApplicationMailer < ActionMailer::Base
layout "mailer"
default from: "no-reply@poster-base.herokuapp.com",
admin: "aidar.mingazov@flatstack.com"
def contact(message, email)
@message = message
@email = email
mail(to: :admin)
end
end
|
require 'hutch/logging'
module Hutch
# Signal-handling class.
#
# Currently, the signal USR2 performs a thread dump,
# while QUIT, TERM and INT all perform a graceful shutdown.
class Waiter
include Logging
class ContinueProcessingSignals < RuntimeError
end
def self.supported_signals_of(list... |
require 'rails_helper'
RSpec.feature 'UserDashboards' do
scenario 'show dashboard upon signing in' do
user = sign_in
owned_animal = FactoryGirl.create(:male_animal, owner: user)
bred_animal = FactoryGirl.create(:female_animal, breeder: user)
visit root_path
expect(page).to have_content user.name
... |
json.array!(@parts) do |part|
json.extract! part, :id, :project_id, :name, :purchase_url, :average_cost
json.url part_url(part, format: :json)
end
|
class Admin::UsersController < ApplicationController
before_action :authenticate_admin!
def index
@users = User.all
end
def edit
@user = User.find(params[:id])
end
def show
@user = User.find(params[:id])
@orders = @user.orders
end
def update
@user = User.find(params[:id])
if @user.update(us... |
require "rexml/document"
require 'open-uri'
class Foursquare
@@attr_names = ["title", "description", "link", "geo_lat", "geo_long"]
attr_accessor *@@attr_names
def initialize(username, password)
doc = REXML::Document.new(open("http://api.foursquare.com/v1/user", :http_basic_authentication=>["sthorpe@gmail.... |
class AlterTableIssuesAddColumnErviceRequest < ActiveRecord::Migration
def self.up
add_column :issues, :service_request, :string, :null => "false"
end
def self.down
remove_column :issues, :service_request
end
end
|
# (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 Cms::PartyOrdersController < Cms::ContentBlockController
skip_before_filter :login_required, :cms_access_required, :only => [:party_orders, :create_party_orders]
def party_orders
@party_order = PartyOrder.new
respond_to do |format|
format.html {render :layout => 'application'}
end
end
... |
require 'controller'
describe Controller do
subject(:controller) { described_class.new}
let(:mars_rover) { MarsRover.new }
let(:plateau) { Plateau.new }
describe 'checking and changing the #online state of an object' do
it 'can question if an object is #online?' do
expect(controller).to respon... |
module Lolita
# This module provides functionality for extension machinery in Lolita. It loads proxies on demand.
module Extensions
EXTENSIONS = []
def method_missing method_name, *args, &block
if method_name[/_proxy$/]
type = method_name.to_s.sub(/_proxy$/,"")
self.class_eval <<-... |
require 'spec_helper'
describe Hypertension, '.configure' do
it { should respond_to(:configure) }
specify { expect { |b| described_class.configure(&b) }.to yield_with_args(Hypertension::Configuration) }
its(:configure) { should be_a(Hypertension::Configuration) }
end
describe Hypertension::Configuration do
... |
class Job < ActiveRecord::Base
belongs_to :user
validates :user, presence: true
validates :title, presence: true
validates :company, presence: true
validates :description, presence: true
validates :url, presence: true, uniqueness: true
end
|
# PasswordStrengthValidator
module PasswordStrengthValidator
def self.included(base)
base.send :extend, ClassMethods
end
module ClassMethods
def acts_as_strengthful
send :include, InstanceMethods
validate :is_strengthful?
# def validate_password_strength
# validat... |
Pod::Spec.new do |s|
s.name = 'CoderChenPlayOGG'
s.version = '1.0.4'
s.summary = 'A short description of CoderChenPlayOGG.'
s.description = "播放OGG格式音频"
s.homepage = 'https://github.com/ChenJiPan/CoderChenPlayOGG'
s.license = { :type => 'MIT', :file => 'LI... |
lane :test do
jira_issue_link(
ticket_id: "IOS-123", #Jira ticket key
global_id: "system=http://www.mycompany.com/support&id=1", #unique link identifier
relationship: "causes",
application: {
type: "com.acme.tracker",
name: "My Acme Tracker"
},
object: {
url: "http://www.myco... |
class Collectionship < ActiveRecord::Base
belongs_to :user
belongs_to :product
validates :user_id, :product_id, presence: true
end
|
# encoding: utf-8
# Copyright 2013 Cerner Corp.
#
# 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 appli... |
class AddPagesTable < ActiveRecord::Migration
def change
create_table :pages do |t|
t.string :name
t.timestamps
end
create_table :advertisements_pages do |t|
t.integer :advertisement_id
t.integer :page_id
t.timestamps
end
end
end
|
require "spec_helper"
RSpec.describe "HTTP Private Api" do
before do
BitflyerApi.configure do |config|
config.key = "dummy_key"
config.secret = "dummy_secret"
end
@client = BitflyerApi.client
end
it "GET my_balance" do
VCR.use_cassette("get_my_balance") do
response = @clien... |
# Bower asset paths
Rails.root.join('vendor', 'assets', 'bower_components').to_s.tap do |bower_path|
Rails.application.config.sass.load_paths << bower_path
Rails.application.config.assets.paths << bower_path
end
# Precompile Bootstrap fonts
Rails.application.config.assets.precompile << %r(bootstrap-sass/assets/fon... |
require 'dockingstation'
describe DockingStation do
it {is_expected.to respond_to(:release_bike)}
it {is_expected.to respond_to(:return_bike)}
describe '#initialize' do
it 'can change DEFAULT_CAPACITY' do
dockingstation = DockingStation.new(30)
expect(dockingstation.amount_of_bikes).to eq(30)
end
end
d... |
class RenameGameOpenQuestionsToBaseOpenQuestions < ActiveRecord::Migration
def change
rename_table :game_open_questions, :base_open_questions
add_column :base_open_questions, :type, :string, index: true
end
end
|
class Tag
attr_reader :id
attr_accessor :body
def initialize(options={})
@id, @body = options.values_at('id', 'body')
end
def most_popular_questions(n)
questions = []
query = <<-SQL
SELECT
questions.id, questions.author_id, questions.title, questions.body
FROM
questions
... |
require 'docker'
require 'optparse'
module BuildSpecRunner
class CLI
# Run the CLI object, according to the parsed options.
#
# @see CLI.optparse
def run
source_provider = get_source_provider
image = get_image
raise OptionParser::InvalidOption, "Cannot specify both :prof... |
class SettingsPage < Calabash::IBase
def trait; "view id:'logout button'" end
def logout
case login_page.login_language
when "Englsih"
touch("button marked:'Logout'")
when "简体中文"
touch("button marked:'退出'")
end
end
def change_language(language)
touch("view:'EFSettingsCell' index:1") # index:0 u... |
class ReservedSeatWagon < Wagon
validates :up_places,
:lower_places,
:side_up_places,
:side_lower_places,
presence: true,
numericality: { only_integer: true }
end
|
require 'base'
class Rubinius < Ruby
homepage 'http://rubini.us/'
url 'http://asset.rubini.us/rubinius-1.2.3-20110315.tar.gz', :as => 'rubinius-1.2.3.tar.gz'
md5 '9782dab18c2dd440af6b76e8eb5bc0f0'
name 'ruby-rbx'
section 'interpreters'
version '1.2.3'
description 'The Rubinius Ruby virtual machine'
d... |
class Api::MeetingsController < ApplicationController
def index
@meetings = Meeting.all
render 'index.json.jbuilder'
end
def show
the_id = params[:id]
@meeting = Meeting.find_by(id: the_id)
render "show.json.jbuilder"
end
def create
@meeting = Meeting.new(
title: params[:title],
... |
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
#override redirect page after sign in
def after_sign_in_path_for(resource)
# will redirect user to the recommen... |
# => Contient la classe FenetreCharger
#
# => Author:: Valentin, DanAurea
# => Version:: 0.1
# => Copyright:: © 2016
# => License:: Distributes under the same terms as Ruby
##
## classe FenetreCharger
##
class FenetreCharger < View
##
## Initialize
##
##
def initialize()
require Core::ROOT +... |
# leap_years2.rb
# A continuation of the previous exercise.
# The British Empire adopted the Gregorian Calendar in 1752, which was a leap
# year. Prior to 1752, the Julian Calendar was used. Under the Julian Calendar,
# leap years occur in any year that is evenly divisble by 4.
# Using this information, update the m... |
module Roglew
module GL
LIBRARY = "C:\\Windows\\System32\\opengl32.dll".freeze
def self.platform_module
WGL
end
end
end |
desc 'This rake task compares the raw print data from SalorHospitality with the actual database. A second host must be set up to read raw data sent via RS232 and save it in a text file. This rake task downloads the raw printing data from this second host, parses it, and compares it with the database. This helper is esc... |
class Events::EventsGetterService
def initialize(user:)
@user = user
@calendar_service = GoogleCalendarService.new(user: user)
@events_creator = Events::CreateOrUpdateService.new
@events = []
end
def synchronize_calendar(full_sync: false)
if @user.sync_token.nil? || full_sync
sync_event... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class Following
attr_reader :html_url, :login, :avatar_url
def initialize(attrs = {})
@html_url = attrs[:html_url]
@login = attrs[:login]
@avatar_url = attrs[:avatar_url]
end
def self.following(current_user)
GithubService.new(current_user).get_following.map do |repo|
Following.new(repo)
... |
class CreateDataExports < ActiveRecord::Migration
def self.up
create_table :data_exports do |t|
t.references :export_structure
t.string :file_format
t.string :status
t.string :export_file_file_name
t.string :export_file_content_type
t.integer :export_file_file_size
... |
class BalancesController < ApplicationController
def index
@balances = Balance.all
end
end
|
class CreateAnnouncements < ActiveRecord::Migration
def change
create_table :announcements do |t|
t.string :url
t.boolean :page
t.string :image
t.datetime :date
t.datetime :end_date
t.text :shortdesc
t.text :description
t.text :seo_description
... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryBot.define do
factory :report_card do
association :evaluation
association :entry
grades { [4, 4, 4] }
end
end
|
# encoding: utf-8
require 'tunemygc/spies'
require 'tunemygc/network'
module TuneMyGc
class Interposer
attr_reader :spies
attr_accessor :installed
def initialize(spies = TuneMyGc.spies)
reset
@spies = spies.map{|s| TuneMyGc::Spies.const_get(s).new }
end
def spy
@spies.first
... |
require 'rest-client'
require 'json'
require 'pry'
# Api_communicator pulls data from thecocktaildb.com to create and save drinks and populate the database tables with information
# get_category_urls - parses the names of each category in the api and saves the url to access all the drinks in each category
def get_cat... |
FactoryGirl.define do
factory :hash_tag do
title
social_network { HashTag.social_network.values.sample }
state { HashTag.state_machines[:state].states.map(&:name).first.to_s }
end
end
|
class TestSession < ActiveRecord::Base
belongs_to :exam
has_many :answers, :dependent => :destroy
belongs_to :user
accepts_nested_attributes_for :answers
before_validation :update_status
private
def update_status
self.status = self.answers.status('empty').count == 0 ? 'completed' : 'no-... |
require 'rails_helper'
RSpec.describe Content, type: :model do
before do
@content = FactoryBot.build(:content)
end
describe 'コンテンツ投稿機能' do
context 'コンテンツ投稿がうまくいくとき' do
it "項目が全て埋まっている時" do
expect(@content).to be_valid
end
end
context 'コンテンツ投稿がうまくいかない時' do
it "titleが空の時" ... |
class BlogPostsController < ApplicationController
include Mixins::SetsPageName
include Mixins::LoadsBlog
before_filter :load_blog_post
before_filter :blog_writer_or_redirect, :only => [:new, :edit, :create, :update, :destroy]
before_filter :verify_blog_visible
def index
scoper = BlogPostScoper.new(@blog)... |
require_relative "../lib/calculadora"
RSpec.describe Calculadora do
#cabecera para iniciar las pruebas, puede ir describe solo. Poner lo que esta en azul es una buena practica
context "sumar numeros" do
it "cuando son iguales" do
#configuracion
calc = Calculadora.new
#Ej... |
require_relative "contact"
require_relative "rolodex"
class CRM
attr_accessor :note, :first_name, :last_name, :email, :id
def self.run
crm = CRM.new
crm.main_menu
end
def initialize
@rolodex = Rolodex.new
# @name = name_being_passed_in
end
def print_main_menu
puts "[1] Add a new contact"
puts "[2] Modi... |
class CreateCategoriesPickups < ActiveRecord::Migration
def change
create_table :categories_pick_ups, :id => false do |t|
t.integer :category_id
t.integer :pick_up_id
end
add_index :categories_pick_ups, :category_id
add_index :categories_pick_ups, :pick_up_id
end
end
|
class FirstTables < ActiveRecord::Migration
def change
change_table :users do |t|
t.string :name, null: false
t.boolean :is_admin, null: false, default: false
t.datetime :deleted_at
end
create_table :companies do |t|
t.string :name, null: false
t.datetime :deleted_at
... |
require 'json'
require 'net/http'
require 'net/https'
require 'uri'
require 'csv'
require 'nexpose_ticketing/nx_logger'
# Serves as the ServiceNow interface for creating/updating issues from
# vulnelrabilities found in Nexpose.
class ServiceNowHelper
attr_accessor :servicenow_data, :options, :log
def i... |
# 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... |
# encoding: UTF-8
class AdMailer < ActionMailer::Base
default from: "from@example.com"
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.ad_mailer.ad_token.subject
#
def ad_token(ad)
@ad = ad
mail :to => ad.email, :subject => "token"
end
de... |
require 'sinatra'
require 'haml'
require 'kaminari/sinatra'
require 'json'
require 'aws-sdk'
helpers do
def protected!
unless authorized?
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
throw(:halt, [401, "Not authorized\n"])
end
end
def authorized?
@auth ||= Rack::Auth::... |
class CreateAssignments < ActiveRecord::Migration
def change
create_table :assignments do |t|
t.integer "job_id"
t.integer "worker_id"
t.integer "status", :default => 0, :null => false
t.string "type"
t.datetime "created_at"
t.datetime "updated_at"
... |
require_relative '../effects/critical_strike.rb'
class KnifeTemplate
PERKS = {
attack: 1
}
EFFECTS = [
CriticalStrike.new(2, 30)
]
def apply_perks
return PERKS
end
def apply_effects
return EFFECTS
end
def name
return 'Knife'
end
end |
class AddReferenceToCompany < ActiveRecord::Migration[5.1]
def change
add_reference :company_employees, :company, index: true
end
end
|
# InSpec test for recipe nexus::default
# The InSpec reference, with examples and extensive documentation, can be
# found at https://www.inspec.io/docs/reference/resources/
# install JDK
describe package('java-1.8.0-openjdk-headless') do
it { should be_installed }
end
# installation folder exist
describe directory... |
class BulkUpdateController < ApplicationController
include Worthwhile::ThemedLayoutController
include ApplicationHelper
with_themed_layout '1_column'
authorize_resource class: false
def update
end
# Get the PIDs for a specified search
def get_pids(query)
response = remote_solr.get('select', param... |
require 'docking_station'
describe DockingStation do
let(:bike) { Bike.new }
=begin
it 'station has a default capacity' do
expect(subject.capacity).to eq described_class::DEFAULT_CAPACITY
end
=end
describe 'initialization' do
it "defaults capacity" do
described_class::DEFAULT_CAPACITY.times do
... |
class AppController < ApplicationController
def index
@people = Person.all
end
end
|
require 'rails_helper'
RSpec.describe FacilitiesManagement::Supplier::HomeController, type: :controller do
describe '#index' do
subject(:index) { get :index }
context 'when signed in' do
login_fm_supplier
it 'redirects to supplier dashboard' do
expect(index).to redirect_to(facilities_ma... |
# Problem 262: Mountain Range.
# http://projecteuler.net/problem=262
# The following equation represents the continuous topography of a mountainous region, giving the elevation h at any point (x,y):
#
#
# http://projecteuler.net/project/images/p_262_formula1.gif
#
# A mosquito intends to fly from A(200,200) to B(1... |
require 'open-uri'
require 'rss'
require 'nokogiri'
class BaseParser
def parse(uri)
sync_result = process_sync uri
threads = []
async_result = []
sync_result.each do |x|
threads << Thread.new(x) { |x| async_result << process_async(x) }
end
threads.each { |t| t.join }
return async_re... |
# -*- mode: ruby -*-
Vagrant.configure("2") do |config|
config.vm.box = "raring64-vanilla"
config.vm.hostname = "base"
config.vm.network :private_network, ip: "192.168.56.9"
config.ssh.forward_agent = true
config.cache.auto_detect = true
config.vm.synced_folder "#{ENV['HOME']}/src/elasticsearch/target/rele... |
# frozen-string_literal: true
module Decidim
module Opinions
class PublishOpinionEvent < Decidim::Events::SimpleEvent
include Decidim::Events::CoauthorEvent
def resource_text
resource.body
end
private
def i18n_scope
return super unless participatory_space_event?
... |
require "helper"
describe Prey::Queue do
let(:cluster) { Prey::Cluster.new }
let(:thrift) { cluster.thrift }
let(:queue_name) { "prey" }
let(:expiration_msec) { 0 }
let(:max_items) { 1 }
let(:timeout) { 0 }
let(:abort_timeout) { 0 }
subject { described_class.new(cluster, queue_name)}
before { thrif... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :project do
project_name "Test Project"
project_description "This is a test project."
project_feature_lang "Ruby"
project_state "Pre-alpha"
project_source_url "www.githubz.com"
project_img "bann... |
class TagpostsController < ApplicationController
def index
@tagposts = Tagpost.all
render json: @tagposts
end
def show
@tagpost = Tagpost.find(params[:id])
render json: @tagpost
end
def delete
@tagpost = Tagpost.delete(params[:id])
render json: @... |
class Ticket < ActiveRecord::Base
belongs_to :user
belongs_to :event
validates :comment, length:{ maximum:30 }, allow_blank: true
end
|
require 'hud/image'
module Hud
class Gameover < Hud::Image
def image
@image ||= @image_registry.image('gameover.png')
end
def draw
image.draw((window.width / 2) - (image.width / 2),
(window.height / 2) - (image.height / 2), 0)
end
end
end
|
class User < ApplicationRecord
enum role: [:regular, :admin]
has_one :profile, dependent: :destroy
has_many :articles, dependent: :destroy
has_many :comments, dependent: :destroy
validates :name, presence: true
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validat... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'set'
module TwitterCldr
module Shared
class Unit
class << self
def create(value, locale = TwitterCldr.locale)
subtype_for(locale).new(value, locale)
end
private
... |
require_relative "board.rb"
require 'yaml'
class Game
attr_accessor :board
attr_reader :previous_command
def initialize(board = Board.new)
@board = board
@previous_command = nil
@previous_pos = nil
end
def run
system("clear")
load_from_file
instructions
board.render
until wo... |
FactoryGirl.define do
factory :event do |e|
e.title "Sopão do Vovô"
e.slug "sopao-do-vovo"
e.start "30/12/2015 17:00"
e.end "30/12/2015 22:00"
e.address "Rua Francisco Barros, 11, Lavras - MG, 37200-000"
e.description "Sopão beneficiente da casa do vovô"
e.how_to_help "Traga amor e sopa!"
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.