text
stringlengths
10
2.61M
# # Copyright (c) 2013, 2021, Oracle and/or its affiliates. # # 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 Gdk::SubPartsMastodonStatusInfo < Gdk::SubParts DEFAULT_ICON_SIZE = 20 register def get_photo(filename) return nil unless filename path = Pathname(__dir__) / 'icon' / filename uri = Diva::URI.new('file://' + path.to_s) Plugin.collect(:photo_filter, uri, Pluggaloid::COLLECT).first end ...
require 'securerandom' class BillsController < ApplicationController before_filter :authenticate_user, :only => [:new, :index, :create, :show, :edit, :update] def index rds = RdsClient.new #TODO: change the hard-code username to be the login username. bills = rds.get_user_bills(@current_user, params...
FactoryBot.define do factory :order_item do order item sequence(:quantity) { |n| ("#{n}".to_i+1)} ordered_price { 2.5 } fulfilled { false } end factory :fulfilled_order_item, parent: :order_item do fulfilled { true } end factory :fast_fulfilled_order_item, parent: :order_item do c...
FactoryGirl.define do factory :position do name { Faker::Team.creature } end end
require 'spec_helper' RSpec.describe Raven::Logger do it "should log to a given IO" do stringio = StringIO.new log = Raven::Logger.new(stringio) log.fatal("Oh noes!") expect(stringio.string).to end_with("FATAL -- sentry: ** [Raven] Oh noes!\n") end it "should allow exceptions to be logged" do ...
Given("We navigate to the login page") do visit 'http://ec2-52-15-34-101.us-east-2.compute.amazonaws.com/users/sign_in' end When("We fill valid credentials") do find_by_id('user_email').send_keys('abhishek.kanojia+1@vinsol.com') find_by_id('user_password').send_keys('1111111') click_on('Log in') end Then("The ...
require './spec/spec_helper' describe Correction do it 'takes two arguments' do Correction.new('a', 'b') end it 'has one original' do Correction.new('a', 'b').original.should == 'a' end it 'has one replacement' do Correction.new('a', 'b').replacement.should == 'b' end end
require 'spec_helper' describe VehicleData::Vin do let(:vin){ SecureRandom.hex(10) } subject{ VehicleData::Vin } it { subject.should respond_to(:decode) } context ".decode" do before(:each) do api = stub("Typhoeus") Typhoeus.stub(:get).and_return(api) end it "should send a request...
class Knowledge < ActiveRecord::Base searchkick callbacks: :async belongs_to :user belongs_to :customer default_scope { order('knowledges.updated_at DESC') } end
require 'open-uri' require 'nokogiri' class RealTimeWeatherData URLS = { :rogers_pass => 'http://www.avalanche.ca/feeds/glacier_dataloggers/data/RogersPassLast24Hof60M.htm' } TIME = 0 MAX_TEMP = 1 MIN_TEMP = 2 RELATIVE_HUM = 3 PRECIPITATION = 4 WIND_DIRECTION = 5 WIND_SPEED = 6 MAX_WIN...
require 'rails_helper' RSpec.describe Unit, type: :model do before :each do @user = create(:user) @unit = create(:unit, user: @user) @act_indicator_relation = create(:act_indicator_relation, act_id: 1, indicator_id: 1, unit: @unit, user: @user) @measurement ...
# More Stuff Exercises # Exercise 1. Write a program that checks if the sequence of characters "lab" exists in the following strings. If it does exist, print out the word. "laboratory" "experiment" "Pans Labyrinth" "elaborate" "polar bear" def check_in(word) if /lab/ =~ word puts word else puts "No match...
require "rubygems" require 'fusefs' require 'rfuse_merged_fs_opts' class RFuseMergedFS # http://rubydoc.info/gems/fusefs/0.7.0/FuseFS/MetaDir # contents( path ) # file?( path ) # directory?( path ) # read_file( path ) # size( path ) # # save # touch( path ) # can_write?(path) # write_to(path,bo...
class OneLine desc 'find [TERM]', 'find a recent life by character name/hash/id' option :t, :type => :string, :desc => 'tag for known players if only one life is found' option :eve, :type => :boolean, :desc => 'only eves', :default => false def find(term, tag = options[:t]) found = [] matching_lives(ter...
require 'test_helper' class SubchurchesControllerTest < ActionController::TestCase setup do @subchurch = subchurches(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:subchurches) end test "should get new" do get :new assert_response :s...
module Api module V1 class AccountsController < ApplicationController def update account = AccountLimitUpdateService.new( token: request.headers['Authorization'], limit: limit_params[:limit] ).update if account render( json: { ...
class Api::LtiDeploymentsController < Api::ApiApplicationController load_and_authorize_resource :application_instance load_and_authorize_resource :lti_deployment, through: :application_instance, parent: false def index per_page = 100 @lti_deployments = @lti_deployments. order(created_at: :desc). ...
class BookmarksController < ApplicationController include Authenticatable before_action :lookup_bookmarks, only: [:index, :show] before_action :lookup_bookmark, only: [:edit, :update, :destroy] # GET /bookmarks # GET /bookmarks.json def index respond_to do |format| format.html { render :index }...
FactoryGirl.define do factory :organization do name Organization::MULTUNUS end end
# frozen_string_literal: true class Widget < ApplicationRecord belongs_to :user validates :name, presence: true def to_json(*_args) { id: id, name: name, } end end
# @param {Integer[]} target # @param {Integer[]} arr # @return {Boolean} # [1] # [1,2] # [2,1] # [1,2,3] # [1,3,2] # [3,2,1] # permutations, O(n!) def can_be_equal(target, arr) return true if target == arr permutations = [target,target.reverse] size = target.length (0...size).each do |idx| ...
require 'rails_helper' RSpec.feature "Contacts", type: :feature do scenario "user no fill, and click submit, show alert" do visit root_path click_link 'お問い合わせ' click_button 'この内容で送信する' expect(page).to have_content '入力内容をご確認ください' end scenario "user don't fill name, and click submit, show alert ...
class ContactController < ApplicationController def new @contact = ContactForm.new end def send_question @contact = ContactForm.new(contact_form_params) if @contact.valid? ContactMailer.contact_email(@contact).deliver redirect_to thank_you_path else render 'new' end end ...
require 'raw_string' def hammingDistance s, t sb = s.pack("c*").unpack("B*").join.chars tb = t.pack("c*").unpack("B*").join.chars dist = 0 for i in 0..([sb.length, tb.length].min - 1) if sb[i] != tb[i] dist += 1 end end return dist + (sb.length - tb.length).abs end # Tries to find the key ...
#encoding: utf-8 module PageCell class Parser < Temple::Parser WHITE_SPACE = /(?:&#160;|&nbsp;|\s)*/ CODE = /^#{TAG_START}#{WHITE_SPACE}(\w+)#{WHITE_SPACE}(.*)?#{WHITE_SPACE}#{TAG_END}$/om COMMENT = /^#{TAG_START}#{WHITE_SPACE}#(.*?)#{WHITE_SPACE}#{TAG_END}$/om DYNAMIC = /^#{DYNAMIC_ST...
class OrderAddress include ActiveModel::Model attr_accessor :streetadoress, :postalcade, :cities, :buildname, :user_id, :token, :prefectures_id, :streetadores, :phonename, :item_id with_options presence: true do validates :user_id validates :postalcade, format: {with: /\A[0-9]{3}-[0-9]{4}\z/, message:...
class Rate < ActiveRecord::Base VALID_CURRENCY = ['SEK', 'NOK', 'EUR'] def self.at(date, base_currency, counter_currency) return 1 if base_currency == counter_currency date = Date.parse date raise ArgumentError, 'Invalid date' if Date.today < date raise ArgumentError, 'Invalid currency' unless(VAL...
class Match < ApplicationRecord validates :outcome, presence: true validates :user_class, presence: true validates :opp_class, presence: true end
class MicropostsController < ApplicationController before_filter :signed_in_user, only: [:create, :destroy] before_filter :correct_user, only: :destroy caches_page :index,:correct_user,:create def index end def create @micropost = current_user.microposts.build(params[:micropost]) expire_page :acti...
class ChangeOptionToGenderIdInInterests < ActiveRecord::Migration def change rename_column :interests, :option, :gender_id change_column :interests, :gender_id, :integer end end
module Plympton # Class responsible for parsing a YAML serialized chunk object class Chunk # YAML entries attr_accessor :startEA, :endEA, :blockList, :numBlocks # Defines the objects YAML tag # @return [String] A string signifying the start of an object of this class def to_yaml_type...
module Signatory module API class Connection < ActiveResource::Connection private def new_http Signatory.credentials.token end def apply_ssl_options(http) http #noop end def request(method, path, *arguments) path += path.index('?') ? '&' : '?' ...
require 'rails_helper' RSpec.describe Exercise, type: :model do it { should have_valid(:name).when('Bench Press') } it { should have_valid(:category).when('Chest') } it { should have_valid(:description).when('Lay down on bench with bar above chest') } it { should have_valid(:muscles).when('Pectoralis major') }...
module IControl::Networking ## # The SelfIPPortLockdown interface enables you to lock down protocols and ports on # self IP addresses. class SelfIPPortLockdown < IControl::Base set_id_name "access_lists" class ProtocolPort < IControl::Base::Struct; end class SelfIPAccess < IControl::Base::Struct; ...
class OpenSourceStats class Organization < OpenSourceStats::User attr_accessor :name def initialize(name) @name = name end end end
require File.dirname(__FILE__) + '/../test_helper' class MovieTest < ActiveSupport::TestCase should_have_many :shows should_have_many :theaters, :through => :shows should_validate_presence_of :name end
require_relative '../test_helper' class ProjectMedia6Test < ActiveSupport::TestCase def setup require 'sidekiq/testing' Sidekiq::Testing.fake! super create_team_bot login: 'keep', name: 'Keep' create_verification_status_stuff end test "should get creator name based on channel" do Request...
# # SurveyTemplatesHelper # module SurveyTemplatesHelper # # Renders action links for survey templates # def action_buttons(edit_path:, delete_path:) edit_link = link_to 'Edit', edit_path, class: 'btn btn-primary' delete_link = link_to 'Delete', delete_path, class: 'btn btn-danger', method: :delete, dat...
FactoryBot.define do factory :badge do name "MyString" kind_id 1 points 1 default false end end
class EventsController < ApplicationController before_action :require_logged_in_user def index @events = current_user.events end def new @event = Event.new end def create @event = current_user.events.build(event_params) if @event.save flash[:success] = 'Evento criado com sucesso.' ...
# Each player class Player attr_accessor :piece def initialize @piece = :X end def move(choice) choice.between?(1, 9) ? choice - 1 : bad_choice end private def bad_choice puts "Not a valid choice, try again\n>" c = new_choice move(c) end def new_choice gets.chomp.to_i en...
class Gblock attr_accessor :id, :the_geom, :nodes, :length, :nb_node, :gblock_nodes, :forward_gnodes ActiveRecord::Base.establish_connection :kbase42222 puts 'Definig class Gblock' INFINITY = 1 << 32 @@loaded = false @@linked = false @@gblocks = {} class << self; attr_accessor :loaded end def...
require 'spec_helper' class FakeTwilioSender def create(data) end end class FakeTwilioResponse def sid "SM727fd423411e4b1b8dcdc4d48ee07f20" end def status "accepted" end def error_code nil end def error_message nil end def price nil end def price_unit nil end def ...
module Openra class IRCBot < Cinch::Bot VERSION = File.read('VERSION').strip.freeze end end
class Admin::ProductsController < AdminController load_and_authorize_resource has_scope :by_product_name has_scope :by_article_name has_scope :by_product_provider_name def index @products = Kaminari.paginate_array(apply_scopes(Product).all.order("created_at")).page(params[:page]) @stores = Store.all ...
def transpose(array) number_of_rows = array.size number_of_columns = array[0].size new_array = [] number_of_columns.times { |_| new_array << [] } 0.upto(number_of_rows - 1) do |index_row| 0.upto(number_of_columns - 1) do |index_column| new_array[index_column][index_row] = array[index_row][index_colu...
module Appilf class ResourcePage < AppilfObject include Enumerable include APIActions attr_accessor :items attr_accessor :page_meta attr_accessor :page_links # :page_number , :page_size, :total_results def page_meta @page_meta ||= {} end # :prev, :next def page_links ...
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru> # frozen_string_literal: true # rubocop:disable Metrics/ClassLength class DeepStonerStrategy < Strategy LEVELS_MULT = ENV.fetch('LEVELS_MULT', 1).to_i LEVELS_DECADE = ENV.fetch('LEVELS_DECADE', 10).to_i attr_reader :buyout_account class Settings < St...
group 'dev' do action :create end file '/etc/sudoers.d/10dev_users' do content '%dev ALL=(ALL) NOPASSWD:ALL' owner 'root' group 'root' mode '0500' action :create end node[:user][:dev_users].each do |dev| user_name = dev['name'] user_home = "/home/#{user_name}" user user_name do comment dev['ful...
class Brand < ApplicationRecord # アソシエーション has_many :items, dependent: :destroy belongs_to :user # バリデーション validates :brand_name, presence: true end
require 'rails_helper' RSpec.describe Section, type: :model do it "has a unique title" do section = FactoryGirl.create(:section) expect(FactoryGirl.build(:section, title: section.title)).to_not be_valid end end
#!/usr/bin/env ruby require 'trollop' require 'yaml' require 'rpmbuild' require 'pp' opts = Trollop::options do version "gen_rpm 2.0.0 (c) 2014 Albert Dixon" banner <<-EOS gen_rpm is basically a wrapper around rpmbuild. It will generate all spec files and run rpmbuild to create a custom rpm package. EOS opt...
class SurveysSweeper < ActionController::Caching::Sweeper observe Survey def after_save(survey) Rails.cache.write :surveys_cache_expirary_key, rand.to_s[2..-1] expire_action survey_questions_url(:survey_id => survey) end def after_destroy(survey) Rails.cache.write :surveys_cache_expirary_key, rand...
# Numbers to English Words # I worked on this challenge [by myself]. # This challenge took me [0.75] hours. # Pseudocode # Create three constants of hashes with keys of strings of single-digit numbers: # TEENS: the English words of all of the teens (this will have keys of two-digit numbers) # SINGLES: the English...
require 'rails_helper' RSpec.describe Purchase, type: :model do before do @purchase = FactoryBot.build(:purchase) end describe '商品購入' do context '商品購入できるとき' do it 'user_id、item_id、post_code、prefecture_id、city、phone_number、tokenが存在すれば購入できる' do expect(@purchase).to be_valid end end ...
# frozen_string_literal: true module Analytics class GeneralController < AnalyticsController def index selected_organizations = find_resource_by_id_param @selected_organization_id, Organization selected_chapters = find_resource_by_id_param(@selected_chapter_id, Chapter) { |c| c.where(organization: se...
module Fog module Google class SQL ## # Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage # # @see https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/instances/import class Real def import_instance(instance_id, uri, database: nil, ...
class Question < ActiveRecord::Base # This assumes that the answer model has a question_id integer field that references the question. # possible values for dependent are :destroy or :nullify. :Destroy will delete all associated answers. :Nullify will update the question_id to be NULL for the associated records (th...
class VoicemailMessage < ActiveRecord::Base self.table_name = 'voicemail_msgs' self.primary_key = 'uuid' belongs_to :voicemail_account, :foreign_key => 'username', :primary_key => 'name', :readonly => true # Prevent objects from being destroyed def before_destroy raise ActiveRecord::ReadOnlyRecord end...
class HdfsEntry < ActiveRecord::Base include Stale attr_accessible :path has_many :activities, :as => :entity has_many :events, :through => :activities belongs_to :hadoop_instance belongs_to :parent, :class_name => HdfsEntry, :foreign_key => 'parent_id' has_many :children, :class_name => HdfsEntry, :fo...
require 'pry' # rubocop:disable Style/MutableConstant INIT_MARKER = ' ' PLAYER_MARKER = 'X' COMPUTER_MARKER = 'O' # rubocop:enable Style/MutableConstant WIN_CONDITION = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + [[1, 4, 7], [2, 5, 8], [3, 6, 9]] + [[1, 5, 9], [3, 5, 7]] def prompt(msg) puts...
class AddcodetoPurchaseOrders < ActiveRecord::Migration def change add_column :purchase_orders, :code, :string end end
class UserSetting < ActiveRecord::Base validates :user, presence: true validates :primary_market_coin, presence: true validates :weather, presence: false belongs_to :primary_market_coin, class_name: 'MarketCoin' belongs_to :base_currency belongs_to :user, touch: true end
require 'cucumber/formatter/ordered_xml_markup' require 'cucumber/formatter/interceptor' require 'cucumber/formatter/junit' # Based on Junit formatter. Add stderr/stdout output into testcase. class JenkinsJunitFormatter < Cucumber::Formatter::Junit def before_steps(steps) @interceptedout_steps = Cucumber::Format...
require 'rails_helper' RSpec.describe '通知機能', type: :request do let!(:user) { create(:user) } context '通知一覧ページの表示' do context 'ログインしているユーザーの場合' do before do sign_in user end it 'レスポンスが正常に表示されること' do get notifications_path expect(response).to render_template('notifica...
def write_tmpfile # firetower sends two signals, # p # SIGHUP to the parent # and multiple to the child, SIGTERM and SIGINT, and in some versions SIGKILL # so we mark this process as the parent, and handle SIGHUP # while making a dummy process and denote it as the child `echo #{Process.pid} $(sleep 10...
Pod::Spec.new do |spec| spec.name = "GaugeSlider" spec.version = "1.2.1" spec.summary = "Highly customizable GaugeSlider primarily designed for a Smart Home app." spec.homepage = "https://github.com/edgar-zigis/GaugeSlider" spec.screenshots = "https://raw.githubusercontent.com/edgar-zi...
class CreateMeasurements < ActiveRecord::Migration def change create_table :measurements do |t| t.belongs_to :user, index: true t.string :suit_size t.float :chest_overarm t.float :chest_underarm t.float :pants_waist t.float :pants_hip t.float :pants_outseam t.float :shirt_c...
class CollaboratorRoleSerializer < ActiveModel::Serializer attributes :id, :job, :song end
require 'rails_helper' feature 'Admin register car' do scenario 'and must be sign in' do visit root_path click_on 'Frota de carro' expect(current_path).to eq new_user_session_path end scenario 'from index page' do user = User.create!(name: 'João Almeida', email: 'joao@gmail.com', password: '12...
# frozen_string_literal: true require_relative "./lib/colorizer" ## What's this sourcery def project_name "HOP! into the Grain 2019 🍺" end ## Serve task :serve do puts "== Project: " + project_name.green puts "== Start server..." system "bundle exec middleman serve" || exit(1) end ## Build the website task...
class UsersAddPasswordDigest < ActiveRecord::Migration def change add_column :users, :password_digest, :string, unique: true end end
# frozen_string_literal: true require 'roar/decorator' require 'roar/json' require_relative 'comment_representer' module IndieLand module Representer # Represents Comments class Comments < Roar::Decorator include Roar::JSON property :event_id collection :comments, extend: Representer::Co...
class Order < ApplicationRecord belongs_to :circle before_save :default_values def default_values self.acceptUserName ||= '-1' end end
FactoryBot.define do sequence :id do |n| "#{n}"; end factory :item do association :merchant id { generate :id } name { Faker::Commerce.product_name } description {Faker::Quotes::Shakespeare.hamlet_quote } unit_price {Faker::Commerce.price} end end
# == Schema Information # # Table name: notes # # id :integer not null, primary key # title :string not null # content :string # user_id :integer not null # notebook_id :integer not null # created_at :datetime not null # updated_at :datetime ...
class VoteMangasController < ApplicationController before_action :authenticate_user! before_action :find_manga,only: [:create,:destroy] def create @manga.liked_by current_user respond_to do |format| format.html{redirect_to @manga} format.js end end def destroy @manga.disliked_by ...
# Assignment: Calculator # Code up your own calculator from the lecture. # Make sure you can run it from the command line. # Save the calculator file in a directory, and initialize the directory as a git repository. # Make sure this isn't nested in another existing git repository. Then, push this git repository to ...
require "rails_helper" describe Api::V3::BloodPressurePayloadValidator, type: :model do describe "Data validations" do it "validates that the blood pressure's facility exists" do facility = create(:facility) blood_pressure = build_blood_pressure_payload(create(:blood_pressure, facility: facility)) ...
describe Limbo::Client do use_vcr_cassette 'limbo.client.post' before do Limbo.configure do |config| config.key = "test-key" config.uri = "http://limbo-listener-staging.herokuapp.com" end end describe ".post" do it "returns a client instance" do Limbo::Client.post(data: "info").s...
require File.dirname(__FILE__) + "/spec_helper" describe Sequel::MigrationBuilder do it "should return nil if the table hash is empty and the database has no tables" do mock_db = double(:database) expect(mock_db).to receive(:tables).at_least(:once).and_return([]) expect(Sequel::MigrationBuilder.new(mo...
require 'net/http' require 'qu-mongo' require 'qu-immediate' JobsDatabase = Mongo::Connection.new Qu.configure do |c| c.connection = Mongo::Connection.new.db("openreqs-qu") end class Clone def self.uri_escape(uri) uri.gsub(/([^a-zA-Z0-9_.-]+)/) do '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase ...
class User < ActiveRecord::Base def self.from_omniauth(auth_info) where(uid: auth_info[:uid]).first_or_create do |new_user| new_user.uid = auth_info.uid new_user.name = auth_info.extra.raw_info.name new_user.nickname = auth_info.extra.raw_info.login n...
class AddIndexesToNotations < ActiveRecord::Migration[4.2] def change add_index :notations, :concept_id end end
class ContactCategory < ActiveRecord::Base has_many :contacts, dependent: :restrict_with_error validates :name, presence: true validates :email, presence: true has_enumeration_for :status, with: CommonStatus, required: true, create_helpers: true, create_scopes: true default_s...
describe "get projects" do context "when I list all projects" do let(:user) { build(:user) } let(:token) { ApiUser.token(user.email, user.password) } let(:result) { ApiProject.find_projects("", token) } it { expect(result.response.code).to eql "200" } end context "when I list one project" do ...
# # Author:: Matt Ray <matt@opscode.com> # Cookbook Name:: drbd # Recipe:: pair # # Copyright 2011, Opscode, Inc # # 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/...
package 'polipo' do if(ver = node[:polipo][:install][:version]) version ver end if(act = node[:polipo][:install][:action]) action act.to_sym end notifies :restart, 'service[polipo]' end file File.join(node[:polipo][:directories][:config], 'config') do content lazy{ node[:polipo][:config].map d...
class Access < ActiveRecord::Base belongs_to :meditation belongs_to :mystic validates :mystic_id, :presence => true validates :meditation_id, :uniqueness => {scope: :mystic_id}, :presence => true end
# require modules here require 'yaml' require 'pry' def load_library(yaml_file) yaml_data = YAML::load(File.open(yaml_file)) definition_hash = {} yaml_data.each do |definition, array_of_emoticons| japanese_emoticon = yaml_data[definition][1] definition_hash["get_meaning"] ||= {} definition_hash["get_...
# Was named users_controller.rb just in case class UsersController < ApplicationController before_action :authenticate_user! skip_before_action :authenticate_user!, :only => [:create] # PATCH/PUT /users def create puts("Create User Firing in users_controller") user = User.new(user_param...
class PostObserver < ActiveRecord::Observer observe :post def after_create(photo) message = "#{photo.user.name} posted a "+photo.media_type+"." notify_followers(message) end def notify_followers(message) APN::Device.all.each do |device| notification = APN::Notification.create(:device =...
# frozen_string_literal: true require 'rails_helper' RSpec.describe TransferMailer, type: :mailer do describe '#created_transfer' do let(:user) { create :user } let(:other_user) { create :other_user } let(:transfer) { create :transfer, from: user, to: other_user } let(:mail) { described_class.created...
require 'yaml' require 'juggalo/portlet' require 'juggalo/page' require 'juggalo/page/loader/base' module Juggalo class Page::Loader class YAML < Base def initialize(location) @location = location end def page page_hash["page"] end def components page_hash[...
describe 'Parsing des décors du film' do before(:all) do parse_collecte(folder_test_6) end let(:donnee_decors) { @donnee_decors ||= begin film.pstore.transaction do |ps| ps[:decor] end end } let(:saved_decors) { @saved_decors ||= donnee_decors[:items] } describe 'Le parse du film' do ...
def string_to_integer(string) number_map = { '0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9 } integer = 0 string.reverse.each_char.with_index(1) do |c, index| integer += (number_map[c] * (10 ** index)) end integer / 10 end puts string_to_integer...
module Asciidoctor module Converter; end # required for Opal # An abstract base class for defining converters that can be used to convert # {AbstractNode} objects in a parsed AsciiDoc document to a backend format # such as HTML or DocBook. # # Concrete subclasses must implement the {#convert} method and, o...
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /users # GET /users.json def index @users = User.all end # GET /users/1 # GET /users/1.json def show end # GET /users/new def new @user = User.new end # GET /users/1...
require 'nesta-contentfocus-extensions/paths' module Nesta class App < Sinatra::Base helpers do def authenticated?(page) return false if session[:passwords].nil? || session[:passwords].empty? page.passwords.detect do |password| session[:passwords].include? password end ...