text stringlengths 10 2.61M |
|---|
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
belongs_to :cart
attr_accessible :cart_id, :product_id, :product, :quantity, :initial_quantity
def total_price
product.price * quantity
end
# def self.from_cart_item(cart_item)
# li = self.new
# li.product = cart... |
require 'benchmark'
require 'absolute_time'
class Trace
attr_accessor :id, :children, :parent, :payload, :tag, :start, :finish, :gc_start, :gc_finish
#root-node-only attrs
attr_accessor :start_wall, :end_wall
@@id = 0
@@trace_context = nil
@@include_backtrace = RUBY_VERSION =~ /^2/
def initialize(t... |
#First Part:
# Checking whether the credit card is valid or not
def credit_card_valid?(number)
return false unless number.length > 10
digits_array = number.chars.map(&:to_i)
check_digit = digits_array.pop
check_digit_for(digits_array) == check_digit
end
# Getting the check digit for digit array supplied
def check... |
# the library path of this plugin
lib_path = File.expand_path( 'lib', bundle_path )
# The ClientPkgCache class:
if RSence.args[:debug]
load File.expand_path( 'client_pkg_cache.rb', lib_path )
else
require File.expand_path( 'client_pkg_cache', lib_path )
end
# The ClientPkgServe module:
if RSence.args[:debug]
l... |
module Sec
module Firms
class FirmParser < XMLParser
SEC_FIRM_DETAIL_FILE_NAME = 'primary_doc.xml'
SEC_FIRM_URL = 'http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=:CIK_ID&output=atom'
def initialize(cik_id)
fetch_url = SEC_FIRM_URL.gsub(':CIK_ID', cik_id)
xml_str =... |
class MassObject
def self.set_attrs(*attributes)
@attributes = attributes.map(&:to_sym)
attributes.each { |attribute| attr_accessor attribute.to_sym }
end
def self.attributes
@attributes
end
def self.parse_all(results)
set_attrs(*results.first.keys)
returned_results = []
results.each... |
class DocsController < ApplicationController
subdomainbox 'edit-%{id}', :only => [:edit, :update]
subdomainbox 'preview-%{id}', :only => :show
subdomainbox 'star', :only => :star
before_filter :require_user
before_filter :find_resources, :only => :index
before_filter :new_resource, :only => [:new, :create... |
require 'rails_helper'
RSpec.describe ::EtExporter::ClaimExportFeedbackReceivedHandler do
subject(:handler) { described_class.new }
let(:claim) { create(:claim, :default) }
let(:system) { build(:external_system, :ccd) }
it 'adds an event with a status, percent_complete and message matching that given' do
#... |
require './lib/game_board'
require './lib/display_board'
class ShotsFired
attr_reader :shots_board, :shots_display
def initialize(game_board)
@shots_board = game_board
@shots_display = DisplayBoard.new(@shots_board)
end
def win?(hits)
(@shots_board.all_shots & hits) == hits
end
def render_s... |
require 'spec_helper'
describe AppCategory do
it { should belong_to :app }
it { should validate_uniqueness_of(:name).scoped_to(:app_id) }
it { should validate_presence_of(:app_id).on(:update) }
end
|
class CreateFeedings < ActiveRecord::Migration
def self.up
create_table :feedings do |t|
t.datetime :feeding_time
t.integer :feeding_type_id
t.integer :amount
t.string :unit
t.timestamps
end
end
def self.down
drop_table :feedings
end
end
|
SendMessageResult = Struct.new(:sent?, :error, keyword_init: true)
|
require 'rails_helper'
RSpec.describe Recruiter::ScoresController, type: :controller do
before do
@recruiter = FactoryGirl.create :recruiter
sign_in @recruiter
@applicant_detail = FactoryGirl.create :applicant_detail
end
def set_requirement
@requirement = FactoryGirl.create :requirement
en... |
# frozen_string_literal: true
module PatternflyHelper
def pf_button_in_title(label, href)
link_to label, href, class: %w[pf-c-button pf-m-primary pf-c-button__in-title]
end
end
|
class AddGroupToStatus < ActiveRecord::Migration
def change
add_reference :statuses, :group, index: true
Status.find_each do |status|
status.update group_id: Group.find_by_name('Universe').id
end
add_foreign_key :statuses, :groups
change_column_null :statuses, :group_id, true
end
end
|
require 'test_helper'
require 'rexml/document'
class ClientsControllerTest < ActionController::TestCase
test 'index default' do
get :index
assert_response :success
assert_not_nil assigns(:q)
assert_not_nil assigns(:clients)
assert_equal 8, assigns(:clients).length
end
test 'index healthy' do
... |
require "spec_helper"
describe PaperSubmissionsController do
describe "routing" do
it "routes to #index" do
get("/paper_submissions").should route_to("paper_submissions#index")
end
it "routes to #new" do
get("/paper_submissions/new").should route_to("paper_submissions#new")
end
it ... |
require File.dirname(__FILE__)+'/machine'
require 'test/unit'
module RAM
class ProgramTest < Test::Unit::TestCase
def test_add_instructons
p = Program.new
instruction = Instructions::Halt.new(p)
p.add_instruction instruction
assert_equal instruction, p.instruction_at(0)
end
def ... |
#!/usr/bin/env ruby
require_relative "../../search-engine/lib/card_database"
require "pathname-glob"
lists_folder = Pathname(__dir__) + "../../data/collector_numbers"
db = CardDatabase.load
1.times do
lists_folder.glob("*.txt").each do |path|
set_code = path.basename(".txt").to_s
set = db.sets[set_code]
... |
VALID_CHOICES = %w(rock paper scissors)
def prompt(message)
puts("=> #{message}")
end
def win?(first, second)
(first == "rock" && second == "scissors") || (first == "paper" && second == "rock") || (first == "scissors" && second == "paper")
end
# display essage showing who wins
def display_result(player, computer... |
class Inspection < ActiveRecord::Base
validates :building_abbrev, :presence => true
validates :inspection_date, :presence => true
validates :floor, :presence => true
validates :user, :presence => true
validates :location, :presence => true
validates :damper_id, :presence => true
validates :damper_status,... |
class PositionPolicy < ApplicationPolicy
attr_reader :user, # User performing the action
:record # Instance upon which action is performed
def initialize(user, record)
@user = user
@record = record
end
def show? ; record.is_owner? user; end
def create? ; true; end
def update? ... |
class CreateScores < ActiveRecord::Migration
def change
create_table :scores do |t|
t.boolean :skills_check, default: false
t.boolean :qualifications_check, default: false
t.string :skills_note
t.string :qualifications_note
t.integer :skills_score, default: 0
t.integer :qualifi... |
#!/usr/bin/env ruby
# encoding: utf-8
project_dir = File.dirname(__FILE__)
$:.unshift project_dir
$:.unshift File.join(project_dir, "app")
require 'rubygems'
require 'bundle/bundler/setup'
require 'alfred'
require 'omnifocus'
require 'task'
require 'task_generator'
Alfred.with_friendly_error do |alfred|
fb = alfred... |
require 'rails_helper'
RSpec.describe Sistema::Usuario, type: :model do
describe "Atributos" do
it "tiene nombre" do
should respond_to(:nombre)
end
it "tiene email" do
should respond_to(:email)
end
it "tiene número de cuenta" do
should respond_to(:numero_cuenta)
end
... |
class AddCurrentBagCapacityAndPhoneNumber < ActiveRecord::Migration[5.0]
def change
add_column :reservations, :phone, :string
add_column :places, :currnet_big_capacity, :integer
add_column :places, :currnet_small_capacity, :integer
end
end
|
ruby_is_eloquent = true
ruby_is_ugly = false
puts "Ruby is eloquent!" if ruby_is_eloquent
puts "Ruby's not ugly!" unless ruby_is_ugly
20.times { print '-' }
puts
puts true ? 'Ruby is brilliant' : 'Ruby is not brilliant'
20.times { print '-' }
puts
puts "Hello there!"
greeting = 'French'
case greeting
when 'Engl... |
module DeepThought
class State < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
validates :state, presence: true
end
end
|
class UsersController < ApplicationController
def show
@user = User.find(params[:id]) # find which user was called via the web address
# blah.com/users/<1>
end
def new
@user = User.new # create a new user object to pass to the form_for
... |
class AddDefaultToCluster < ActiveRecord::Migration[5.1]
def change
change_column :clusters, :assigned, :boolean, null: false, default: false
end
end
|
class DownloadGitRevision
unloadable
attr_reader :repository
attr_reader :revision
attr_reader :format
attr_reader :project
attr_reader :gitolite_repository_path
attr_reader :commit_valid
attr_reader :commit_id
attr_reader :content_type
attr_reader :filename
attr_reader :cmd_args
def initial... |
require 'capybara/poltergeist'
require 'rspec'
require 'rspec/retry'
require 'capybara/rspec'
require 'html_validation'
# Load our default RSPEC MATCHERS
require_relative 'matchers.rb'
require_relative 'wp.rb'
require_relative 'helpers.rb'
##
# Create new user for the tests (or automatically use one from ENVs: WP_TES... |
# https://github.com/plataformatec/simple_form/wiki/Creating-a-minimalist-form-%28no-labels-just-placeholders%29
class MinimalFormBuilder < SimpleForm::FormBuilder
def input(attribute_name, options = {}, &block)
if options[:placeholder].nil?
options[:placeholder] ||= object.class.human_attribute_name(attrib... |
class Fluentd
module Setting
class ParserCsv
include Fluentd::Setting::Plugin
register_plugin("parser", "csv")
def self.initial_params
{
keys: nil,
delimiter: ","
}
end
def common_options
[
:keys, :delimiter
]
end... |
# -*- coding: utf-8 -*-
require_relative '../helper'
require 'utils'
require 'lib/test_unit_extensions'
require 'lib/weakstorage'
class TC_WeakStorage < Test::Unit::TestCase
def setup
end
must "size limited storage item insertion" do
sls = SizeLimitedStorage.new(Symbol, String, 8)
assert_equal(0, sls.u... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :users_todolists, dependent: :destroy
has_many :to... |
require 'rails_helper'
require 'spec_helper'
RSpec.describe Ad, type: :model do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:start_date) }
it { should validate_presence_of(:end_date) }
it { should validate_presence_of(:desc) }
it { should validate_presence_of(:redirect_url) }
end
|
require 'spec_helper'
require 'world'
describe "DelinquentCustomerPolicy" do
include World
describe "normally" do
let(:delinquent_policy_for_mike) { FactoryGirl.build( :delinquent_policy_for_mike ) }
it { delinquent_policy_for_mike.delinquent?.should be_true }
end
describe "for tim" do
let(:delinquent_pol... |
# frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = 'interactor'
spec.version = '1.0.0'
spec.summary = 'Dry::Validation-based interactor'
spec.authors = ['Vladimir Kleshko']
spec.files = %w[
lib/interactor.rb
lib/interactor/base.rb
lib/interactor/validator.rb
]
spec.r... |
require './lib/card.rb'
require './lib/deck.rb'
require './lib/player.rb'
class Turn
attr_reader :player1, :player2, :deck, :spoils_of_war
def initialize(player1, player2)
@player1 = player1
@player2 = player2
@spoils_of_war = Array.new
end
def type
if player1.deck.rank_of_card_at(0) == play... |
require 'json'
desc "Sets up C://Golosa and the config file if not present"
task :install do
Dir.mkdir(Dir.pwd + "\\GolosaData") unless Dir.exist?(Dir.pwd + "\\GolosaData")
Dir.chdir(Dir.pwd + "\\GolosaData")
f = File.open("config.yml", "w")
STDOUT.print "Add an inital language => "
input = STDIN.gets.chomp... |
class FightIdToSoliders < ActiveRecord::Migration
def up
add_column :soliders, :fight_id, :integer
end
def down
remove_column :soliders, :fight_id
end
end
|
# API Requests handling Authentication and Authorization
class AuthorizationController < ApplicationController
include BCrypt
# Register method
def register
# Define variables from the request
username = params['username']
password = params['password']
# Check to see if username exists
user_c... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define :prestashop do |prestashop|
prestashop.vm.box = "ubuntu/trusty64"
prestashop.vm.network "private_network", ip: "10.0.0.10"
prestashop.vm.synced_folder "./prestashop", "/var/www/prestashop",
owner: "vagrant",... |
require 'rails_helper'
RSpec.describe Guide::NavigationView do
let(:navigation_view) do
described_class.new(bouncer: bouncer,
node: node,
active_node: active_node)
end
let(:bouncer) { instance_double(Guide::Bouncer) }
let(:node) do
instance_double(Guide::... |
class Tag < ApplicationRecord
validates :name, presence: true, :uniqueness => { :scope => :shampoo_id }
validates :shampoo_id, presence: true
belongs_to :shampoo
end
|
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :story, class: StoryboardElements::Story do
association :author, factory: :user
title "Une jolie Histoire"
end
end |
class AddReferenceToItems < ActiveRecord::Migration
def change
add_reference(:items, :user)
end
end
|
require 'formula'
class Movein < Formula
homepage 'http://stew.vireo.org/movein/'
url 'http://stew.vireo.org/movein/downloads/movein-1.3.tar.gz'
md5 'bd86f4360fb91e69168920d416a9f9d9'
depends_on 'mr'
def install
bin.install ['movein']
man1.install gzip('movein.1')
end
def test
system "ls #{... |
# encoding: UTF-8
require 'test_helper'
class OrdersControllerTest < ActionController::TestCase
setup do
@client = Client.create name: "John", email: "john@gmail.com", password: 'tre543%$#', password_confirmation: 'tre543%$#'
@order = @client.orders.create
@xaxa = Product.create name: 'Xaxá', price: 0.2... |
class AssignmentsController < ApplicationController
def index
@course = Course.find(params[:course_id])
@assignments = @course.assignments
end
def show
@course = Course.find(params[:course_id])
@assignment = @course.assignments.find(params[:id])
end
def new
@course = Course.find(params... |
class CreatePropertyImages < ActiveRecord::Migration
def change
create_table :property_images do |t|
t.column :name, :string
t.timestamps
end
add_attachment :property_images, :image
end
end
|
module Enumerable
def my_each
i=0
while i<(self.length) do
yield(self[i])
i+=1
end
self
end
def my_each_with_index
i=0
while i<(self.length) do
yield(self[i],i)
i+=1
end
self
end
de... |
module Auth
module Constrait
class SignedIn
def initialize(scope = nil)
@scope = scope
end
def matches?(request)
request.env['warden'].try(:authenticated?, @scope)
end
end
class SignedOut
def initialize(scope = nil)
@scope = scope
end
de... |
Redmine::Plugin.register :esteren do
name 'Esteren plugin'
author 'Alex "Pierstoval" Rock Ancelet'
description 'Esteren tools for Redmine'
version '0.2.2'
url 'http://esteren.org'
author_url 'http://www.Orbitale.io'
menu(
:top_menu,
:esteren_issues,
{:controller => :issues, :action => :index}... |
# code here!
class School
attr_reader :schoolName
def initialize(schoolName)
@schoolName = schoolName
@roster = {}
end
def roster
@roster
end
def add_student(studName, grades)
if @roster[grades] != nil
@roster[grades] << studName
else
... |
# encoding: utf-8
control "V-52405" do
title "DBMS default accounts must be protected from misuse."
desc "The Security Requirements Guide says, "Default accounts are usually accounts that have special privileges required to administer the database. Well-known DBMS account names are targeted most frequently by attac... |
require 'roby/test/self'
module Roby
module TaskStructure
describe ExecutionAgent do
class BaseExecutionAgent < Tasks::Simple
event :ready
end
class ExecutionAgentModel < Tasks::Simple
event :ready
forward start: :ready
... |
# frozen_string_literal: true
module Admin
class ApplicationController < ::ApplicationController
before_action :only_admin
private
def only_admin
return if user_signed_in? && current_user.is_admin == true
flash[:error] = 'You\'re not allowed on this page'
redirect_to root_path
en... |
require 'rack/test'
require 'screenshots_controller'
RSpec.describe ScreenshotsController do
include Rack::Test::Methods
def app
described_class
end
describe 'GET /', env: { AUTH_TOKEN: 'qwerty' } do
let(:params) { {} }
def dispatch
basic_authorize auth_token, ''
get '/', params
... |
class Api::V1::BooksController < ApplicationController
before_filter :authenticate_user!
before_filter :check_format
def index
if params[:group_id] == 'home'
@books = current_user.readable(:books).order('created_at DESC')
else
group = Group.find(params[:group_id])
authorize! :read, grou... |
require "spec_helper"
module LabelGen
describe "command:" do
describe "'gen_pages'" do
subject(:command){"gen_pages"}
context "with arg N pages" do
let(:n_pages){1}
let(:config_last_number){1001}
let(:fname){'command_gen_pages_spec_0.pdf'}
let(:fpath){File.join(SPEC_T... |
require_relative 'spec_helper'
describe "/user/* URI's" do
def app
Sinatra::Application
end
before :each do
User.delete_all
Tweet.delete_all
Follow.delete_all
@browser = Rack::Test::Session.new(Rack::MockSession.new(app))
end
describe 'get /nanotwitter/v1.0/users/:username' do
be... |
# Usage:
#
# response = Endeca::TopReviewersQuery.execute :category => #<Category>
class Endeca::TopReviewersQuery < Endeca::Query
endeca_param(:M) { |ns| build_M ns }
endeca_param :N do |ns|
category = case ns[:category]
when String then Category.find_by_param ns[:category]
when Categor... |
# Copyright (C) 2012-2014 Tanaka Akira <akr@fsij.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and t... |
class Order < ApplicationRecord
after_create :send_new_order_email
belongs_to :user
belongs_to :product
ORDER_RATING = [1, 2, 3, 4, 5]
validates :quantity, presence: true
validates :quantity, numericality: { greater_than: 0 }
validates :rating, inclusion: { in: ORDER_RATING, on: :update }
validates :... |
FactoryBot.define do
factory :task do
title { 'Factoryで作ったデフォルトのタイトル1' }
content { 'Factoryで作ったデフォルトのコンテント1' }
deadline { DateTime.now }
status {'完了'}
priority {'低'}
association :user
end
factory :second_task, class: Task do
title { 'Factoryで作ったデフォルトのタイトル2' }
content... |
class AnimalName < ActiveRecord::Migration
def change
change_table :found do |t|
t.column :name, :string
end
change_table :lost do |t|
t.column :name, :string
end
end
end
|
class ZeroController < ApplicationController
before_action :check_authentication
layout 'zero'
private
def check_authentication
unless session[:is_login]
flash[:danger] = 'Login First'
redirect_to new_zero_session_path
end
end
end |
cask 'paintbrush-custom' do
version "2.5.0"
sha256 'fca1d23f6da1ff1fe6768ba67cd692362cbf86ad9adf72431514740a37c513b6'
# downloads.sourceforge.net/paintbrush/ was verified as official when first introduced to the cask
url "http://artifactory.generagames.com:8081/artifactory/generic-local/macos/art/paintbrush/2.5.... |
Rails.application.routes.draw do
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
put 'completed_assignment', to: 'assignments#completed', as: :completed_assignment
get 'completed_most', to: 'users#show_completed', as: :completed_most
# get 'users/:user_id/assignments', ... |
class ChangeColumnsGeininMembers < ActiveRecord::Migration[5.1]
def change
add_column :geinin_members, :family_name, :string, null: false
add_column :geinin_members, :first_name, :string, null: false
add_column :geinin_members, :family_name_yomi,:string
add_column :geinin_members, :first_name_yomi,:st... |
require 'rails_helper'
RSpec.describe "categories/index", type: :view do
before(:each) do |test|
if test.metadata[:empty]
assign(:categories,[])
else
assign(:categories, [
Category.create!(
:name => "Name"
),
Category.create!(
:name => "Name"
)
... |
# encoding: utf-8
class EmoticonUploader < CarrierWave::Uploader::Base
storage :fog
configure do |config|
config.remove_previously_stored_files_after_update = false
end
def cache_dir
dir = Rails.configuration.app['carrierwave']['cache_dir']
(dir && File.directory?(dir)) ? dir : super
end
# O... |
# Solution 1
def scripy_dollop(n)
# Get an array of element
array = n.to_s.split('')
# Return -1 if the numbers are all equal
return -1 if array.uniq.length === 1
# Find all Permutations
permutations = array.permutation.to_a
# Converting array of string into integer and sort them
permutations = permutat... |
class AnswersController < ApplicationController
def index
@question = Question.find(params[:question_id])
@answers = @question.answers
render json: @answers.to_json, status: :ok
end
def create
@question = Question.find(params[:question_id])
@answer = @question.answers.build(answer_params)
... |
FactoryGirl.define do
factory :base_date, :class => DateDimension do
sql_date_stamp { Time.utc(Date.parse(date).year, Date.parse(date).month, Date.parse(date).day) }
calendar_year { sql_date_stamp.strftime("%Y") }
calendar_month_name { sql_date_stamp.strftime("%B") }
calendar_quarter { "Q#{((sql_dat... |
# frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'register/version'
Gem::Specification.new do |spec|
spec.name = 'register'
spec.version = Register::VERSION
spec.authors = ['Konstantin Gredeskoul']
spec.em... |
ROM::SQL.migration do
change do
alter_table :rolls do
add_column :rolls, String
end
end
end
|
Then(/^display error message to the user$/) do
current_balance_error = "You cannot schedule a payment for this account.\nThis account has a credit/zero balance or you have pending payments that exceed 110% of your balance."
on(PaymentsDetailsPage).alert_error.should eq current_balance_error #@payment_error_messages... |
class CreateAdminUsersPagesJoin < ActiveRecord::Migration[5.1]
def up
# We don't need an id for this join table. All we want is to join
create_table :admin_users_pages, :id => false do |t|
t.integer "admin_user_id" # Foreign key
t.integer "page_id" # Foreign key
end
# Don't forget to index... |
require 'rails_helper'
RSpec.describe Api::V1::UsersController do
describe 'PUT #update' do
let!(:existing_user) { create(:user) }
context 'with token' do
before(:each) do
allow(controller).to receive(:ensure_access_token_is_valid).and_return(true)
allow(controller).to receive(:current... |
require 'test_helper'
class CartTest < ActiveSupport::TestCase
test "add a unique product" do
cart = carts(:one)
product = Product.new(title: "TitleTitle", description: "Description", image_url: "url.jpg", price: 100)
assert product.save, 'Failed to save the product'
current_item = cart.add_product(p... |
class Recipe < ActiveRecord::Base
has_many :ingredients
accepts_nested_attributes_for :ingredients
before_save :only_used_ingredients
def only_used_ingredients
self.ingredients = self.ingredients.find_all { |ingredient| ingredient.name != '' || ingredient.quantity != '' }
end
end
|
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc.
# Authors: Adam Lebsack <adam@holonyx.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# This program ... |
class AddDiscountParametersToSpreePrices < ActiveRecord::Migration
def change
add_column :spree_prices, :discount_type, :integer, default: 0
add_column :spree_prices, :discount_amount, :integer, default: 0
add_column :spree_prices, :enable_discount, :boolean, default: false
end
end
|
=begin
2. The Remainder Challenge!
-In Ruby 6 / 4 == 1.
-But what if we want the remainder also?
-Write a program that asks for two (2) Integers
-Divides the first by the second and returns the result including the remainder.
-If either of the numbers is not an Integer, then don't accept th... |
module Frank
class Entry < ActiveRecord::Base
belongs_to :profile
has_many :comments
has_one :action
after_initialize :init
def init
self.occurred_on ||= Time.now
end
end
end
|
class Like < ApplicationRecord
belongs_to :check, counter_cache: :likes_count
belongs_to :user
end
|
# The line below is a simple statement
puts "I will now count my chickens:"
#
puts
puts "Hens", 25+30/6
puts "Roosters", 100-25*3%4
puts
puts "Now I will count the eggs:"
puts
puts 3+2+1-5+4%2-1/4+6
puts
puts "Is it true that 3+2<5-7?"
puts
puts 3+2<5-7
puts
puts "What is 3+2?", 3+2
puts "What is 5-7?"... |
# frozen_string_literal: true
require 'rails_helper'
require "#{Rails.root}/lib/legacy_courses/wiki_legacy_courses"
describe WikiLegacyCourses do
describe '.get_course_info' do
it 'should return course info for an existing course' do
VCR.use_cassette 'wiki_legacy_courses/single_course' do
# A singl... |
require "hpricot"
require "open-uri"
class ServerPage
GROENTJUH = "http://newerth.com/?id=serverlist&details=85.197.124.236:11235"
GIRLS = "http://newerth.com/?id=serverlist&details=88.198.26.57:11235"
PWNS = "http://www.newerth.com/?id=serverlist&details=75.126.227.114:11236"
TERRA = "http://ww... |
class Story < ActiveRecord::Base
# after a story is created, a 'narrator' role is created for the owner.
attr_accessible :name, :player_intro, :teaser, :owner_id, :status, :status_notes, :image, :sharing, :first_chapter_name, :first_scene_name, :story_opening
has_many :invitations, :dependent => :destroy
has_ma... |
require 'colorize'
module Rents
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../../templates', __FILE__)
desc 'It automatically create it initializer RentS rails app config'
def copy_initializer
template 'rents.rb', 'confi... |
# =============================================================================
#
# MODULE : test/test_condition_variable_pool.rb
# PROJECT : DispatchQueue
# DESCRIPTION :
#
# Copyright (c) 2016, Marc-Antoine Argenton. All rights reserved.
# ====================================================================... |
class FeatherCmsGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def create_cms_files
template 'initializer.rb', 'config/initializers/feather_cms.rb'
migration_file = Dir.glob("db/migrate/[0-9]*_*.rb").grep(/\d+_create_feather_pages.rb$/).first
migration_numbe... |
class AddPhotoToAuditReports < ActiveRecord::Migration
def change
add_column :audit_reports, :wegoaudit_photo_id, :string
end
end
|
Gem::Specification.new do |s|
s.name = 'appollo_milk_level_editor'
s.version = '1.0.0'
s.date = '2013-06-23'
s.summary = "Level editor for a 2D game"
s.description = "Level editor for a 2D game"
s.authors = ["Julien Michot"]
s.email = "julien@captive.fr"
s.files = [... |
require_dependency 'data_sources/easy_project_contingency_fields'
module EasyReports
module ContingencyFields
class TimeEntryInternalRateField < EasyReports::ContingencyFields::Field
def initialize(data_source)
super(data_source, {
:name => 'time_entry_internalrate',
:cate... |
class AddFrequencyFieldsToCampaigns < ActiveRecord::Migration
def change
add_column :campaigns, :campaign_type, :string
add_column :campaigns, :frequency, :integer
add_column :campaigns, :frequency_date, :timestamp
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.