text stringlengths 10 2.61M |
|---|
class AddWalkupAttributeToVouchers < ActiveRecord::Migration
def self.up
add_column :vouchers, :walkup, :boolean, :null => false, :default => false
purchasemethod_ids = Purchasemethod.walkup_purchasemethods.map(&:id)
walkup_cust_id = Customer.walkup_customer.id
Voucher.find(:all,
:conditions => ... |
require_relative 'base'
module MaterializeComponents
class Badge < Base
# Creates a new instance of a badge
#
# @param [String] content The content to put in a badge
def initialize content
@content = content
@tag = :span
reset_class
end
def reset_class c=nil
@css_c... |
# Email validator, takes a single input CSV and writes a CSV valid_emails.csv
# ruby email_regex.rb filename.csv
#
# file MUST be a proper CSV format, with a single first column, with "email" as only header row.
#########
# valid email regex is: \b[a-zA-Z0-9!#$%&'*+-\/=?^_`.{|}~]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b
requ... |
class AddImgVideoFileToTopics < ActiveRecord::Migration
def change
add_column :topics, :img_file_name, :string
add_column :topics, :img_content_type, :string
add_column :topics, :img_file_size, :integer
add_column :topics, :img_updated_at, :datetime
add_column :topics, :video_file_name, :string
add_... |
namespace :db do
desc 'Use database_cleaner to erase all data from the db, without dropping it'
task :clean => :environment do
puts "Cleaning...".green
DatabaseCleaner.strategy = :deletion
DatabaseCleaner.clean
puts "Cleaned!".light_green
end
end
|
require 'spec_helper'
describe Idea do
it "should properly classify long expired ideas" do
fresh_idea = FactoryGirl.create(:idea)
week_old_scratched_idea = FactoryGirl.create(:idea, :updated_at => 1.1.weeks.ago, :scratched => true)
month_old_active_idea = FactoryGirl.create(:idea)
month_old_scratc... |
module Fog
module DNS
class Google
##
# Fetches the representation of an existing Project. Use this method to look up the limits on the number of
# resources that are associated with your project.
#
# @see https://developers.google.com/cloud-dns/api/v1/projects/get
class Real
... |
require 'transaction'
require 'account'
describe Transaction do
let(:account) { Account.new }
let(:deposit) { account.deposit(1000) }
let(:withdrawal) { account.withdraw(500) }
it 'creates a new deposit transaction' do
deposit
expect(account.transaction_history.length).to eq(1)
expect(account.tran... |
require 'spec_helper'
describe UsersController do
let(:user_bart) {FactoryGirl.find_or_create(:user_bart)}
before(:each) do
sign_in user_bart
end
describe 'GET index' do
it 'assigns @users' do
saved_users = [FactoryGirl.find_or_create(:user_bart), FactoryGirl.find_or_create(:user_lisa)]
... |
module ApplicationHelper
def flass_class(type)
case type
when :success then "success"
when :error then "warning"
when :alert then "warning"
when :notice then ""
else "info"
end
end
end
|
class Staff < ActiveRecord::Base
has_many :staff_tags
has_many :tags, through: :staff_tags
has_many :staff_items
has_many :items, through: :staff_items
end
|
class MemberWallet < ApplicationRecord
belongs_to :member
accepts_nested_attributes_for :member
end
|
# frozen_string_literal: true
module WinrForm
module FormHelper
def winr_form_for(record, *args, &block)
options = args.extract_options!
output = tag(:'winr-form', {}, true)
output << form_for(record, *(args << options.merge(builder: WinrForm::Builder)), &block)
output.safe_concat('</winr... |
class ChangeTimeStampToContactShares < ActiveRecord::Migration
def change
remove_column :contact_shares, :timestamps, :datetime
add_column :contact_shares, :created_at, :datetime
add_column :contact_shares, :updated_at, :datetime
end
end
|
# == Schema Information
#
# Table name: items
#
# id :bigint(8) not null, primary key
# name :string not null
# item_number :string not null
# description :text
# image_url :string
# product_info :text
# price :decimal(, ) not null
# category_id :in... |
class CreateMesocycles < ActiveRecord::Migration
def change
create_table :mesocycles do |t|
t.integer :user_id
t.integer :program_id
t.integer :max_bench
t.integer :max_squat
t.integer :max_deadlift
t.integer :max_ohp
t.timestamps
end
end
end
|
class Actor
extend Creation::ClassMethods
include Creation::InstanceMethods
attr_accessor :name
attr_reader :movies
@@all = []
def initialize(name)
@name = name
@movies = []
@@all << self
end
def add_movie(movie)
if !@movies.include?(movie)
@... |
class UserMailer < ActionMailer::Base
default from: SUPPORT_MAIL
helper :application, :mail
layout 'mail'
def standard(user)
@user = user
mail(:to => user.email)
end
def invite(user)
@user = user
@title = 'Tilbud om undervisning i lumbalpunktur'
mail(:to => user.email, :subject => @tit... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Project, type: :model do
it 'does not allow duplicate project names per user' do
user = User.create(
first_name: 'John',
last_name: 'carter',
email: 'john@gmail.com'
)
user.projects.create(
name: 'Test Project'
... |
require 'rails_helper'
describe Activity, :type => :model do
let(:key) { "run" }
subject { build_stubbed :activity, key: key }
describe "#run?" do
it "returns true" do
expect(subject).to be_run
end
end
describe "#unknown?" do
let(:key) { "unknown" }
it "returns true" do
expect(... |
module OpenAPIParser::Schemas
class Base
include OpenAPIParser::Parser
include OpenAPIParser::Findable
include OpenAPIParser::Expandable
attr_reader :parent, :raw_schema, :object_reference, :root
# @param [OpenAPIParser::Schemas::Base]
def initialize(object_reference, parent, root, raw_schem... |
worker_processes 2
working_directory "/home/deploy/current"
# This loads the application in the master process before forking
# worker processes
# Read more about it here:
# http://unicorn.bogomips.org/Unicorn/Configurator.html
preload_app true
timeout 30
# This is where we specify the socket.
# We will point the up... |
require 'psd'
require 'recursive-open-struct'
class PsdParser
def initialize(file_path)
psd_path = File.expand_path file_path
@psd = PSD.new psd_path
end
def parse(type = :hash)
@psd.parse!
return @psd if type == :plain
return RecursiveOpenStruct.new(@psd.tree.to_hash) if type == :hash
... |
require 'spec_helper'
describe "commits/index" do
before(:each) do
assign(:commits, [
stub_model(Commit,
:committer_email => "Committer Email",
:committer_name => "Committer Name",
:html_url => "Html Url",
:repository_id => "Repository",
:sha => "Sha",
:autho... |
require "sub_parser/version"
require "sub_parser/subtitle"
require "sub_parser/timespan"
require "sub_parser/timestamp"
module SubParser
def self.parse subtitles
subtitles
.gsub(/\r/, '')
.split(/\n\n/)
.map { |raw| Subtitle.parse raw }
end
def self.join subtitles
subtitles
.each... |
module Api
module V1
class WebhooksController < BaseApiController
skip_before_action :authenticate_from_token!
def index
bot_name_to_class = {
smooch: Bot::Smooch,
keep: Bot::Keep,
fetch: Bot::Fetch
}
unless bot_name_to_class.has_key?(params[:name... |
class ContractsController < ApplicationController
def index
@contracts = Contract.all
render json: @contracts
end
end
|
require 'rails_helper'
feature 'admin user can approve or reject podcast suggestions', js: true do
before do
stub_omniauth
end
scenario 'successfully if they can be found through Itunes Search API' do
PodcastSuggestion.create(suggestion: "the bike shed")
pending_suggestions_count = PodcastSuggestio... |
require('minitest/autorun')
require('minitest/reporters')
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require_relative('../room')
require_relative('../guests')
require_relative('../song')
class RoomTest < Minitest::Test
def setup()
@room = Room.new(10)
end
def test_room_has_price()
assert_equ... |
require 'spec_helper'
describe Employee do
before do
@employee = Employee.new(name: "Example User", email: "employee@example.com")
end
subject { @employee }
it { should respond_to(:name) }
it { should respond_to(:email) }
it { should respond_to(:password_digest) }
end |
#!/usr/bin/env ruby
# this script generates the SQL DDL for the DataMeta DOM model
# Example, from gem root:
# dataMetaMySqlDdl.rb ../../../dataMeta/showCase.dmDom ../../../../../target/sql
%w(dataMetaDom dataMetaDom/mySql dataMetaDom/help).each(&method(:require))
include DataMetaDom, DataMetaDom::MySqlLexer
@sou... |
#!/usr/bin/ruby
# This is the main entry point for running SHRDLURN. See
# fig/lib/execrunner.rb for more documentation for how commands are generated.
# There are a bunch of modes that this script can be invoked with, which
# loosely correspond to the modules.
$: << 'fig/lib'
require 'execrunner'
$path = 'plot'
$ou... |
require 'rails_helper'
RSpec.describe Domain do
before :example do
Setting.ds_algorithm = 2
Setting.ds_data_allowed = true
Setting.ds_data_with_key_allowed = true
Setting.key_data_allowed = true
Setting.dnskeys_min_count = 0
Setting.dnskeys_max_count = 9
Setting.ns_min_count = 2
Sett... |
class Application
attr_reader :team, :name, :conf
attr_accessor :flight
def initialize(team, name, conf)
@team = team
@name = name
@conf = conf
conf.popularity += 1
end
def conf_name
conf.name
end
def to_row
["#{conf.name}#{ ' *' if flight}", name, team]
end
end
|
require 'test_helper'
class GuiFunctionsControllerTest < ActionController::TestCase
setup do
@gui_function = gui_functions(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:gui_functions)
end
test "should get new" do
get :new
assert_res... |
require 'quickmr/processor_base'
class Multiplexer < ProcessorBase
def initialize(options)
super
@sequence = 0
@outputs = []
end
def connect(outputs)
@outputs = outputs
log "multiplexing to #{@outputs.length} outputs"
end
private
def on_data(event)
if not event.data
@outputs.each do |output|
... |
class AddAddressColumnsToEventMasters < ActiveRecord::Migration
def change
add_column :event_masters, :address_one, :string
add_column :event_masters, :address_two, :string
add_column :event_masters, :city, :string
add_column :event_masters, :state, :string
add_column :event_masters, :countr... |
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@mail = @user.email
@posts = @user.posts
end
def edit
@user = User.find(params[:id])
redirect_to user_path unless @user == current_user
end
def update
@user = User.find(params[:id])
@user.update user_params
redir... |
class User < ActiveRecord::Base
has_many :splatts
has_and_belongs_to_many :follows,
class_name: "User",
join_table: :follows,
foreign_key: :follower_id,
association_foreign_key: :followed_id
has_and_belongs_to_many :followed_by,
class_name: "User",
join_table: :follows,
foreign_key: :followed_id,
... |
=begin
class MyTemplateBuilder < Vizier::TemplateBuilder
command_set do
require 'myapp/commands'
MyApp::Commands::setup_commands
end
template_path [""] + %w{etc myapp templates}, %{~ .myapp templates}
end
MyTemplateBuilder.go
=end
require 'valise'
require 'vizier/visitors/base'
modul... |
class Station < ActiveRecord::Base
has_many :deliveries
has_many :delivery_areas, dependent: :destroy
has_many :service_stats
has_many :customs, through: :service_stats
accepts_nested_attributes_for :delivery_areas, allow_destroy: true
has_many :apps, dependent: :delete_all, class_name: "MobileApp"
acce... |
module TidyDesktop
# Adds daily tidy desktop job
class Cron
COMMAND = 'crontab'.freeze
def initialize(command)
@command = command
end
def output
"@daily /bin/bash -c '#{@command}'\n"
end
def uninstall!
crontab = current_crontab.delete_if { |a| a.include? @command.to_s }
... |
class CreateOfCompaniesTypeOfCompanies < ActiveRecord::Migration
def change
if !table_exists? :of_companies_type_of_companies
create_table :of_companies_type_of_companies do |t|
t.integer :of_company_id
t.integer :type_of_company_id
t.timestamps
end
end
end
end
|
class ChangeTimeTypeInEntries < ActiveRecord::Migration
def change
change_column :account_entries, :time, :decimal
end
end
|
class Item_API < Grape::API
resource "items" do
helpers do
def item_params
ActionController::Parameters.new(params).permit(:description, :name, :price, :image)
end
def save_tags(item,tag_name)
tag = Tag.where(name: tag_name).first_or_create()
table_obj = ItemTag.create(t... |
#We've decided to make the joins from (input/output) logical extensions to file format
# normalization paths one to many instead of many to many. So we can get rid of the join
# model and simply store the logical extension ids on the file format normalization path
# model itself.
class AddLogicalExtensionsToFileFormatN... |
require 'app/apis/base_api'
require 'app/models/event'
require 'app/presenters/beer_presenter'
require 'app/presenters/brewery_presenter'
require 'app/presenters/event_presenter'
class EventsAPI < BaseAPI
get { EventsPresenter.new(Event.all, context: self, root: nil).present }
param :id do
let(:event) { Event... |
require_relative '../src/product'
require_relative 'spec_helper'
RSpec.describe Product, type: :model do
describe 'validations' do
subject { Product.new('Mega Coverage', -1, 80) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:sellIn) }
it { should validate_presence_of(:p... |
require 'gosu'
module Zindex
Background, Ballons, Player, Clouds, UI = *0..4
end
class GameWindow < Gosu::Window
attr_accessor :background_image, :fonts, :images, :player, :ballons, :timer, :game_over, :clouds
def initialize
super(1200, 900, false)
self.caption = 'Ballons vs Unicorn'
restart
pl... |
require 'formula'
class Winexe < Formula
url 'http://sourceforge.net/projects/winexe/files/winexe-1.00.tar.gz'
homepage 'http://sourceforge.net/projects/winexe/'
md5 '48325521ddc40d14087d1480dc83d51e'
def patches
# This patch removes second definition of event context, which *should* break the build virtu... |
require 'spec_helper'
describe Luego::Delegate do
it "should take an object when initialised" do
Luego::Delegate.new("hello")
end
it "should not delegate methods until delegate! is called" do
string = Luego::Delegate.new("hello world")
lambda { string.upcase }.should raise_error NoMethodError
s... |
# frozen_string_literal: true
# QueryObjectBase
class QueryObjectBase
def initialize(repository)
@repository = repository
end
end
|
class UserReportsController < ApplicationController
def show
@user_report = UserReport.find(params[:id])
end
def edit
@user_report = UserReport.find(params[:id])
@report_options = Report.all.map {|r| [r.name, r.id ]}
end
def update
@user_account = UserAccount.find(params[:id])
@user_rep... |
class Client < ApplicationRecord
before_create :create_unique_key
belongs_to :user
has_many :gadgets
validates :name, :presence => true, :uniqueness => {:scope => :user}
def create_unique_key
begin
self.key = SecureRandom.base64(12)
end while self.class.exists?(:key => key)
end
def conne... |
class V1::FeedbacksController < ApplicationController
skip_before_action :authenticate_user!, only: [:create]
def index
project = Project.find(params[:project_id])
@feedbacks = project.feedbacks.except_archived.filterable(params[:filter], project)
end
def create
project = Project.find(params[:proj... |
class Kunde
attr_accessor:name
attr_writer :adresse
def initialize(pname)
@name = pname
@kredite = []
end
def set_kredit(pkredit)
@kredite << pkredit
end
def show_kredite
puts "#{@name}, #{@adresse} hat folgende Kredite:"
@kredite.each.with_index(1) do |value, key|
puts "Kredit... |
#[5.1]イントロダクション
#配列と同様、ハッシュも使用頻度の高いオブジェクトです。本格的なRubyプログラミングを書く上では避けて通ることはできません。
#また、シンボルは少し変わったデータ型で、最初は文字列と混同してしまうかもしれませんが、こちらも使用頻度が高いデータ型なので、しっかり理解していきましょう。
#---------------------------------------------------------------------------------------------------------------------------------------------------------
#[5.1.... |
class Paper < Theme
name "Paper"
author "DarkPreacher"
homepage "https://github.com/DarkPreacher/tt-rss-theme-paper"
repo "git@github.com:DarkPreacher/tt-rss-theme-paper.git"
screenshot "https://raw.github.com/DarkPreacher/tt-rss-theme-paper/master/paper-previews/paper-combined-auto-expand.jpg"
install do ... |
module Reports
class DeploymentCostReport
attr_reader :costs, :clouds
def initialize(report)
@report = report
@user_currency = @report.user.currency
Time.zone = @report.user.timezone
@deployment = @report.reportable
@costs = []
# Cache all clouds to avoid ... |
class AddContentFragmentIdsToSentEmailMessages < ActiveRecord::Migration
def up
add_column :sent_email_messages, :content_fragment_ids, :string
end
def down
remove_column :sent_email_messages, :content_fragment_ids
end
end
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper' ))
class AnExistingForumWithBoards < ActionController::IntegrationTest
def setup
factory_scenario :site_with_forum
login_as :admin
@board = Factory :board, :site => @site, :section => @forum
end
def tes... |
require 'uri'
class Params
# use your initialize to merge params from
# 1. query string
# 2. post body
# 3. route params
def initialize(req, route_params = {})
@params = route_params
parse_www_encoded_form(req.body) if req.body
parse_www_encoded_form(req.query_string) if req.query_string
@pe... |
require "spec_helper"
describe Deal do
specify { expect(described_class.constants).to include :State }
context "When asking for the retailer name and logo" do
it "should only query the store service once" do
mock_deal_store = double('store_service_id' => 123, "name" => "Wittner", "_links" => double({'lo... |
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
self.rank = rank
self.suit = suit
end
def output_card
puts "#{self.rank} of #{self.suit}"
end
def self.random_card
Card.new(rand(10), :spades)
end
end
class Deck
def initialize
@cards = []
@suits = [:Diamonds, ... |
module CalculationSupport
def retrofit_calculation(field, strict: true, **options)
calculations_set = measure.run_retrofit_calculations(
strict: strict,
**options)
expect(calculations_set.errors_hash[field]).to be_nil
calculations_set.get_calculation_value(field)
end
def should_get_compon... |
class Expense < ApplicationRecord
self.inheritance_column = :_type_disabled
belongs_to :user
validates_presence_of :name,:expense_date, :type, message: "field required"
validates :amount, numericality: { only_integer: true }
end
|
# =============================================================================
#
# MODULE : test/test_concurrent_queue.rb
# PROJECT : DispatchQueue
# DESCRIPTION :
#
# Copyright (c) 2016, Marc-Antoine Argenton. All rights reserved.
# ===========================================================================... |
require 'rails_helper'
describe StructureCombiner do
before do
create(:structure_type, name: 'Lighting', api_name: 'lighting')
end
let!(:json_structures) do
[
{ id: SecureRandom.uuid,
name: 'Hallway lights',
structure_type: { name: 'Lighting', api_name: 'lighting' },
n_stru... |
module Kernel
def document
System::Windows::Browser::HtmlPage.document
end
def window
System::Windows::Browser::HtmlPage.window
end
end
class NilClass
def blank?
true
end
end
class String
def blank?
empty?
end
end
class System::Windows::FrameworkElement
# Monkey-patch FrameworkElem... |
class Jtl::LabeledValue
attr_reader :label
attr_reader :value
def initialize(label, value)
@label = label
@value = value
end
end
|
class CreateHabilitacoes < ActiveRecord::Migration[6.0]
def change
create_table :habilitacoes do |t|
t.references :pessoa, index: true
t.string :numero
t.string :modalidades
t.date :validade
t.timestamps
end
end
end
|
desc "Heroku scheduler add-on used to re-seed db periodically"
task :update_db => :environment do
puts "Updating database. . ."
Rake::Task['db:seed'].invoke
puts "Update complete."
end |
describe StepController do
it 'should return all step templates' do
get '/step/templates'
expect(last_response).to be_ok
result = JSON.parse(last_response.body, symbolize_names: true)
expect(result.length).to eq 2
end
it 'should return step template' do
get '/step/templates/copy_artifacts'
... |
module BabySqueel
module Nodes
# This proxy class allows us to quack like any arel object. When a
# method missing is hit, we'll instantiate a new proxy object.
class Proxy < ActiveSupport::ProxyObject
# Resolve constants the normal way
def self.const_missing(name)
::Object.const_get(n... |
class BibleRef < Formula
desc "Look up Bible references and search for verses"
url "https://github.com/padwasabimasala/bible-ref/archive/v1.1.1.tar.gz"
sha256 "1e451ca8d7d9575b8d3187cd8f7b4d7f5eaf755b3566cae9094220c303277ef7"
homepage "https://github.com/padwasabimasala/bible-ref"
head "https://github.com/pad... |
def cls
system("cls") || system("clear")
end
def get_letters
slovo = ARGV[0]
slovo = Unicode.downcase(slovo)
if slovo == nil || slovo == ""
abort "Для игры введите загаданное слово в качестве аргумента при " \
"запуске программы"
end
return slovo.encode('UTF-8').split("")
end
def get_user_input... |
#
# PaymentsByDates
#
# Displaying payments grouped by dates
#
class PaymentsByDatesController < ApplicationController
def index
params[:date] ||= Payment.last_booked_at
@records = Payment.booked_on(date: params[:date])
.includes(join_tables)
.load
@payments_b... |
require_relative './database_connection'
class Comment
attr_reader :id, :text, :tweet_id
def initialize(id:, text:, tweet_id:)
@id = id
@text = text
@tweet_id = tweet_id
end
def self.create(tweet_id:, text:)
result = DatabaseConnection.query("INSERT INTO comments (tweet_id, text) VALUES ('#{... |
class AnswersController < ApplicationController
def index
@question = Question.find(params[:question_id])
@answer = @question.answers.order(:created_at)
end
def new
@question = Question.find(params[:question_id])
@answer = Answer.new
end
def create
@question = Question.find(params[:ques... |
require 'aepic'
module Aepic
module Concerns
module Serializer
module Adapter
def self.inject!
require 'active_model/serializer/adapter/json_api'
ActiveModel::Serializer::Adapter::JsonApi.send(:include, self)
end
def meta_for(serializer)
STDERR.puts 'A... |
module Tact
class Card
attr_reader :contact
def initialize(contact, index="*")
@contact = contact
@index = index
end
def to_s
string = "=" * 40 + "\n"
string += "[#{@index}]".red + " #{@contact.to_s}"
contact.phone_numbers.each_with_index {|number, i| string += "\s\s" + ... |
Factory.define :metasubservicio do |mss|
mss.sequence(:nombre) { |n| "algun metasubservicio con numero #{n}" }
mss.association :metaservicio
end |
class Table
attr_accessor :table
def initialize
@table = [
["-","-","-"],
["-","-","-"],
["-","-","-"]
]
end
def do_table
@table.each_index do |i|
subtable = @table[i]
subtable.each do |x|
print "| #{x} |"
end
print "\n"
end
end
def reset_table
@table = [["-","-","-"],["-","-... |
require "error_nande/version"
module ErrorNande
def self.nande(error)
summary = "#{error.inspect} at #{compact_backtrace(error)}"
while error = error.cause
summary << " (cause #{error.inspect} at #{compact_backtrace(error)})"
end
summary
end
class << self
alias_method :summary, :nande
... |
require 'fileutils'
require 'tempfile'
require 'util/postgres_admin'
module ManageIQ
module ApplianceConsole
# configure ssl certificates for postgres communication
# and appliance to appliance communications
class CertificateAuthority
CFME_DIR = "/var/www/miq/vmdb/certs"
PSQL_CLIENT_DIR = "/root/... |
class CreateRoomParticipation < ActiveRecord::Migration
def change
create_table :room_participations do |t|
t.references :user, index: true
t.references :room, index: true
end
end
end
|
require 'rails_helper'
describe Leagues::Matches::GenerationService do
describe 'single elimination' do
it 'works' do
division = create(:league_division)
team1 = create(:league_roster, division: division, seeding: 3)
team2 = create(:league_roster, division: division, seeding: 2)
team3 = ... |
# encoding: UTF-8
##
# Auteur JORIS TOULMONDE
# Version 0.1 : Date : Thu Feb 11 16:27:55 CET 2016
#
load 'ControleurPartie.rb'
load 'Controleur.rb'
load 'Vue.rb'
load 'VueCase.rb'
load 'Grille.rb'
load 'VueChoixGrille.rb'
load 'Aventure.rb'
load 'VueChoixAventureNiveau.rb'
load 'ChoixAventureNiveau.rb'
#Classe permet... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'blade/rails_plugin/version'
Gem::Specification.new do |spec|
spec.name = "blade-rails_plugin"
spec.version = Blade::RailsPlugin::VERSION
spec.authors = ["Celso Fernande... |
class HomeController < ApplicationController
include ReposExposer
expose(:articles) { articles_repository.search(params[:query]).page(params[:page]) }
expose(:article)
end
|
require 'spec_helper'
describe 'Apps Requests', type: :request do
describe 'GET /v1/apps/{id}' do
it 'responds with the requested app' do
app = App.create( name: 'example_app', host_group: 'ag-web')
get "/v1/apps/#{app.id}.json", {}, {'Accept' => 'app/vnd.primedia.com; version=1', 'Content-Type' => '... |
require_relative 'my_inject'
require 'rubygems'
require 'twilio-ruby'
class Invitraunt
def initialize
@full_order = []
end
attr_reader :full_order
def total_price
corresponding_prices.my_inject { |net_price, item| net_price + item }
end
def corresponding_prices
full_order.map {|dish| dishes[dish] }
... |
class Movie < ApplicationRecord
has_many :reviews , dependent: :destroy
validates_uniqueness_of :api_id
validates_presence_of :api_id
validates_presence_of :title
validates_presence_of :overview
def to_param
self.api_id.to_s
end
def populate_from_api id
Tmdb::Api.key '6d5073fd950729a0d1b024f7... |
# The MIT License (MIT)
#
# Copyright (c) 2015 Oleg Ivanov http://github.com/morhekil
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the r... |
class SetCheckedToEnquiries < ActiveRecord::Migration
def change
change_column_default :user_alerts, :enquiry, true
end
end
|
require 'rails_helper'
describe Park do
it { should validate_presence_of :area}
it { should validate_presence_of :description }
it { should validate_presence_of :state }
it { should validate_presence_of :name }
end
|
class AddPhotosCountToPhotos < ActiveRecord::Migration[5.1]
def change
add_column :photos, :photos_count, :decimal
end
end
|
#!/usr/bin/ruby
require 'bundler/setup'
require 'pi_piper'
PIN_IN1 = 23
PIN_IN2 = 24
SLEEP = 0.01
=begin
MODE = 0 (IN/IN)
IN1 IN2 OUT1 OUT2
0 0 - - 空転 (coast)
0 1 L H 逆進
1 0 H L 前進
1 1 L L 回生ブレーキ (break)
MODE = 1 (PHASE/ENABLE)
IN1 IN2 OUT1 OUT2
0 x L L 回生ブレーキ... |
#
# Be sure to run `pod spec lint PYCore.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/... |
require 'psyduck/version'
require 'net/ftp'
module Psyduck
class FTPClient
# attr_readers are needed for tests
attr_reader :ip_address
attr_reader :username
attr_reader :password
attr_reader :command_port
attr_reader :passivity
attr_reader :resumable
def initialize(
ip_address:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.