text stringlengths 10 2.61M |
|---|
# encoding: utf-8
class File
def self.read_utf8( path )
text = open( path, 'r:bom|utf-8' ) do |file|
file.read
end
##
## todo: make normalize newlines into a filter (for easy (re)use)
## normalize newlines
## always use LF \n (Unix):
##
## convert CR/LF \r\n (Windows) ... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
validate :check_domain_name
before_validat... |
module Concerns::Contest::Info
extend ActiveSupport::Concern
included do
has_many :task_items, class_name: "Contest::Task",
dependent: :destroy,
foreign_key: :contest_id
has_many :tasks, through: :task_items, class_name: "Task::Info"
end
def score
ba = [ nil, 12, 16, 20]
ra = [ nil,... |
# frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'thanx/style/version'
Gem::Specification.new do |s|
s.name = 'thanx-style'
s.version = Thanx::Style::VERSION
s.authors = ['Eng @ Thanx']
s.email = ['eng@th... |
class CreatePreferences < ActiveRecord::Migration[5.1]
def change
create_table :preferences do |t|
t.belongs_to :user, index: true
t.string :position
t.string :shift
t.string :location
t.string :level
t.string :keywords
t.string :function
t.string :salary
t.t... |
class Checkout
attr_reader :basket
def initialize(promotional_rules=Promotion.new, basket=Basket)
@basket = basket.new(promotional_rules)
@promotional_rules = promotional_rules
end
def scan(item)
basket.add(item)
end
def total
basket_discount? ? discount_total.round(2) : basket.total
end... |
class UserMailer < ActionMailer::Base
default from: "from@example.com"
def new_registration(user)
@user = user
mail(to: user.mail,
subject: "You have been registered to AX database")
end
end
|
require 'json'
require 'singleton'
module LeagueOfLegends
class Items
include Singleton
attr_accessor :items
def initialize(file_name='items.json')
load_items(file_name)
end
def get_name(item_id)
@items[item_id] || nil
end
def get_id(item_name)
@items... |
require_relative '../types/invoice_type'
class Query < GraphQL::Schema::Object
field :invoice, InvoiceType, null: true do
description 'Find invoice'
argument :id, Integer, required: false
end
field :not_null_invoice, InvoiceType, null: false do
description 'Find invoice'
argument :id, Integer, re... |
FactoryBot.define do
factory :topic, class: "Kafkat::Topic" do
name { 'topic_name' }
factory :topic_with_one_empty_broker do
partitions do
[
Kafkat::Partition.new(name, 0, [0], 0, [0]),
Kafkat::Partition.new(name, 1, [1], 1, [1]),
Kafkat::Partition.new(name, 2, [0]... |
FactoryBot.define do
factory :visit do
link
ip_address { Faker::Internet.ip_v4_address }
browser_name { 'chrome' }
os { 'mac' }
end
end
|
#!/usr/bin/env ruby
# Manages the TEM Certificates and CA
require 'rubygems'
require 'tem_ruby'
case ARGV[0]
when 'config'
Tem::CA.scaffold_config
when 'ca'
Tem::CA.scaffold_ca
end
|
class CreateMembers < ActiveRecord::Migration
def up
create_table :members do |t|
t.belongs_to :space
t.string :name, :cobot_member_id
end
add_index :members, :space_id
end
def down
drop_table :members
end
end
|
# frozen_string_literal: true
ParameterType(
name: 'user',
regexp: /user .*?/,
transformer: ->(des) { User.find_by(name: des.split.last) }
)
Given("{string} is a user") do |user_name|
FactoryBot.create :user, name: user_name
end
Given("I log in as {user}") do |user|
visit '/users/log_in'
fill_i... |
class Booking < ApplicationRecord
belongs_to :profile
belongs_to :cheval
validates :start_date, presence: true
validates :end_date, presence: true
validates :statut, presence: true
validates :message, presence: true, length: { maximum:300 }
validates_presence_of :end_date, if: :temporalite?
def tempo... |
class BrandsController < ApplicationController
before_action :brand_category_header
before_action :set_detail_search, only: [:index, :detail_search]
def index
@items = Item.all.where(item_status: false).where.not(brand_id: nil).order("id DESC").page(params[:page]).per(50)
end
def show
@brand = Brand... |
class ChangePostIdtoReviewIdinComments < ActiveRecord::Migration
def change
rename_column :comments, :post_id, :review_id
end
end
|
# Rotation (Part 2)
# Write a method that can rotate the last n digits of a number.
# Note that rotating just 1 digit results in the original number being returned.
# You may use the rotate_array method from the previous exercise if you want. (Recommended!)
# You may assume that n is always a positive integer.
#... |
module Entity
class Message
include Mongoid::Document
field :timestamp, type:Time, default: ->{Time.now}
field :characters, type:Array
field :message, type:String
field :type, type:Symbol
scope :character, ->(char_id){ where(:characters.in => [char_id]) }
scope :from, ->(from){ where(:timestamp.gt => f... |
class Admin::ShowsController < ApplicationController
# GET /shows
# GET /shows.json
before_filter :authorize_admin, :find_auditorium
before_filter :find_show, :except => [:index, :new, :create]
def index
@shows = @auditorium.shows.order(:on_date)
respond_to do |format|
format.html # index.html... |
# Method to create a list
# input: string of items separated by spaces (example: "carrots apples cereal pizza")
# steps:
# turn list into an array so that each item has its own index in the array
# set default quantity
# associate values with the eys
# print the list to the console: using iteration
# output: h... |
class RemindersController < ApplicationController
# GET /reminders
# GET /reminders.json
def index
@reminders = Reminder.where(user_id:current_user.id)
end
# GET /reminders/1
# GET /reminders/1.json
def show
end
# GET /reminders/new
def new
@reminder = Reminder.new
end
# GET /reminder... |
class CreateWeddingPhotos < ActiveRecord::Migration[5.2]
def change
create_table :wedding_photos do |t|
t.integer :wedding_album_id
t.string :photo_url
end
add_index :wedding_photos, :wedding_album_id
end
end
|
class AssignmentsController < ApplicationController
before_action :authenticate_user!,except:[:index, :show]
before_action :find_assignment, only:[:show, :edit, :destroy, :update]
def index
if params[:course].blank?
@assignments = Assignment.all.order("created_at DESC")
else
@course_id = Course.find_by(nam... |
require 'rails_helper'
RSpec.describe "tickets/show", type: :view do
before(:each) do
@ticket = assign(:ticket, Ticket.create!(
:id => "",
:subject => "Subject",
:message => "MyText",
:is_active => false,
:is_read => false,
:user_id => "",
:status => "Status",
:num... |
require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'test_helper')
require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'lapis_webhook')
class LapisWebhookTest < ActiveSupport::TestCase
def setup
@lw = Lapis::Webhook.new('https://ca.ios.ba/', { foo: 'bar' }.to_json)
su... |
# add customization to the nginx configs
if ['solo','app_master'].include?(node[:instance_role])
##############################################
## ADD Mime Types to the nginx default list ##
##############################################
ey_cloud_report "nginx" do
message "Adding mime types to nginx co... |
class UserChannel < ModelBase
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :user
has_many :user_connections, dependent: :destroy
def self.Create(userId)
userChannel = UserChannel.new
userChannel.user = User.find(userId)
userChannel.save
userChannel.log("Create")
return userChannel
e... |
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(255) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime... |
require 'rails_helper'
RSpec.describe Contact, type: :model do
let(:contact) { build(:contact) }
context "Associations" do
it 'belongs_to a user' do
association = described_class.reflect_on_association(:user)
expect(association.macro).to eq(:belongs_to)
end
it 'belongs_to a contact' do
... |
require 'rails_helper'
require 'shoulda/matchers'
describe Book, type: :model do
it { should validate_presence_of(:gender) }
it { should validate_presence_of(:author) }
it { should validate_presence_of(:image) }
it { should validate_presence_of(:title) }
it { should validate_presence_of(:editor) }
it { sho... |
Facter.add('dnsmasq_version') do
setcode 'dnsmasq --version'
end |
class CreateMentions < ActiveRecord::Migration[5.0]
def change
create_table :mentions do |t|
t.references :congressman, null: false, index: true
t.references :comment, null: false, index: true
t.timestamps null: false
end
add_index :mentions, [:congressman_id, :comment_id], unique: true... |
# frozen_string_literal: true
require "kafka/fetched_offset_resolver"
require "kafka/fetched_batch_generator"
module Kafka
# Fetches messages from one or more partitions.
#
# operation = Kafka::FetchOperation.new(
# cluster: cluster,
# logger: logger,
# min_bytes: 1,
# max_w... |
require "ostruct"
require "bigdecimal"
require 'json'
module Lita
class MailgunDroppedRateRepository
VALID_EVENTS = [:delivered, :dropped]
MAX_EVENTS = 50
ONE_WEEK = 60 * 60 * 24 * 7
TWO_WEEKS = ONE_WEEK * 2
class DroppedResult
attr_reader :domain, :uniq_dropped, :uniq_addresses, :total
... |
require 'pg'
require './app/app.rb'
# fetches database from bookmarks
class Bookmark
attr_reader :id, :url, :title
def initialize(id, url, title)
@id = id
@url = url
@title = title
end
def self.all
if ENV['ENVIRONMENT'] == 'test'
con = PG.connect :dbname => 'bookmark_manager_test'
else
c... |
class Make < ActiveRecord::Migration[5.0]
def change
change_column :line_items, :variant_id, :string
change_column :line_items, :sku, :string
change_column :line_items, :pre_tax_price, :string
change_column :line_items, :total_discount, :string
end
end
|
require 'rails_helper'
RSpec.describe "recording_sessions/show", type: :view do
before(:each) do
@recording_session = assign(:recording_session, RecordingSession.create!(
:description => "Description"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Description/)
... |
class Employer < ApplicationRecord
has_many :employees, dependent: :delete_all
has_many :budgets, dependent: :delete_all
validates :employer_name, presence: true, length: { maximum: 50 }, allow_blank: false
end
|
require 'rails_helper'
describe User do
it 'has a valid factory' do
expect(build(:user)).to be_valid
end
it 'is valid without a birthdate' do
expect(build(:user, :no_birthday)).to be_valid
end
it 'is eligible for birthday deals' do
expect(build(:user, :birthday_today).eligible_for_birthday_deal... |
class PostMailer < ApplicationMailer
def create(post, email)
@post = post
mail to: email
end
end
|
require 'test_helper'
class UserTest < ActiveSupport::TestCase
def test_full_name_when_name
user = create(:user, name: 'test')
assert_equal 'test', user.full_name
end
def test_full_name_when_nickname
user = create(:user, nickname: 'nickname', name: nil)
assert_equal 'nickname', user.full_name
... |
require 'rails_helper'
#
# RSpec.feature "RegisterUser", type: :feature do
# context "Landing page" do
# Steps "Going to Landing page" do
# Given "I visit localhost 3000:" do
# visit "/users/index"
# end
# Then "I see Welcome!" do
# expect(page).to have_content("Welcome!")
# ... |
module ActiveRecord
module Blakstar
module Like
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def blakstar_like(options = {})
has_many :likes, :as => :likeable, :dependent => :destroy
include ActiveRecord::Blakstar::... |
require 'open-uri'
require 'json'
class GamesController < ApplicationController
def new
@start_time = Time.now
@grid = 10.times.map do
('A'..'Z').to_a.sample
end
3.times.each do
@grid << ['a', 'e', 'i', 'o', 'u'].sample.upcase
end
end
def score
@time = Time.now - params[:sta... |
class Pledge < ApplicationRecord
belongs_to :user
belongs_to :project
validates :dollar_amount, presence: true
validates :user, presence: true
# validate :owner_cannot_back_own_project
validate :must_be_positive
def owner_cannot_back_own_project
if project.user == user
errors.add(:user_id, ... |
module QBIntegration
module Processor
class Bill
include Helper
attr_reader :bill
def initialize(bill)
@bill = bill
end
def as_flowlink_hash
{
id: bill.id,
doc_number: bill.doc_number,
balance: bill.balance.to_i,
last_updated_... |
class Answer < ActiveRecord::Base
belongs_to :question
belongs_to :user
named_scope :by_user, lambda {|user|
{ :conditions => ["answers.user_id = ?", user]}
}
end |
# frozen_string_literal: true
module Gitlab
module Checks
class PushCheck < BaseChecker
def validate!
logger.log_timed("Checking if you are allowed to push...") do
unless can_push?
raise GitAccess::UnauthorizedError, 'You are not allowed to push code to this project.'
... |
class Meal
include Mongoid::Document
extend Badgeable::Award
referenced_in :diner, :inverse_of => :meals
end |
class Post < ApplicationRecord
belongs_to :category
validates :title, presence: true
validates :body, presence: true
def reading_length
num = self.body.split(" ").length
if num.between?(1, 750)
return "Short Post"
elsif num.between?(751, 2500)
return "Medium Post"
elsif num >= 250... |
require 'qbwc'
require 'concerns/qbwc_helper'
class TxnDeleteWorker < QBWC::Worker
include QbwcHelper
#We will establish which worker this is. This will be used through-out.
WorkerName = "TxnDeleteWorker"
# This worker will grab only active items, in the assembly section of QB.
# We will use thi... |
class RenameSharePermissionsFields < ActiveRecord::Migration
def up
rename_column :shares, :can_create, :allow_create
rename_column :shares, :can_view, :allow_view
rename_column :shares, :can_update, :allow_update
rename_column :shares, :can_destroy, :allow_destroy
end
def down
rename_column ... |
class Mypage::SendingDestinationsController < ApplicationController
before_action :authenticate_user
def edit
@sending_destinations = SendingDestination.find_by(user_id: current_user.id)
end
def update
@sending_destinations = SendingDestination.find_by(user_id: current_user.id)
atri = @sending_des... |
class AddRelationships < ActiveRecord::Migration
def change
# Add person relationship to all models it owns
add_reference :educations, :person, index: true
add_reference :work_experiences, :person, index: true
add_reference :skills, :person, index: true
add_reference :projects, :person, index: tru... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
# Import the MongoDB public GPG Key and create a list file - https://docs... |
class Expense < ApplicationRecord
validates_presence_of :spent_for, :amount
end
|
class AddImageToNante < ActiveRecord::Migration[5.1]
def change
add_column :nantes, :image, :string
end
end
|
#############################################################################################################
class Vehicle
def initialize(number_of_wheels, type_of_tank, seating_capacity, maximum_velocity)
@number_of_wheels = number_of_wheels
@type_of_tank = type_of_tank
@seating_capacity = seating_cap... |
require "rails_helper"
RSpec.feature "Error handling", type: :feature do
scenario "The application gracefully handles invalid short URLs" do
visit "/FOO"
expect(page).to have_text "404 Not Found"
expect(page).to have_text /You tried to access 'http:\/\/[\w\.].*\/FOO', which is not a valid page./
c... |
class Favorite < ApplicationRecord
belongs_to :musical_instrument
belongs_to :user
end
|
require 'spec_helper'
describe "api", type: :integration do
describe "v1" do
before(:each) do
@task1 = FactoryGirl.create(:task, name: 'My first task', description: 'My first task description')
@task2 = FactoryGirl.create(:task_with_task_items, name: 'My second task with task items', description: 'M... |
require 'spec_helper'
describe Order do
before do
make = CanonicalMake.new(name: 'iPhone', manufacturer: 'Apple')
model = CanonicalModel.new(name: '4S', make_id: :make)
device = Device.new(model_id: :model, size: '32', carrier: 'Verizon', condition: 'Good', resell_price: 100)
@order = Order.new(firs... |
require 'test_helper'
class FinalidadesControllerTest < ActionDispatch::IntegrationTest
setup do
@finalidade = finalidades(:one)
end
test "should get index" do
get finalidades_url, as: :json
assert_response :success
end
test "should create finalidade" do
assert_difference('Fina... |
# Geopolitical Helpers
module Geopolitocracy
extend ActiveSupport::Concern
included do
# field :gid, type: Integer # geonames id
field :name, type: String, localize: true
field :abbr, type: String
field :nick, type: String
field :souls, type: Integer # Population
field :asc... |
require 'bushido'
module Locomotive
module Hosting
module Bushido
module Enabler
module ClassMethods
def subscribe_to_events
::Bushido::Data.listen('app.claimed') do |event|
Locomotive.log "Saving #{Account.first.inspect} with incoming data #{event.inspect}"
... |
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/ravenloft/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["George Avramidis", "Kostas Karachalios"]
gem.email = ["avramidg@gmail.com"]
gem.description = %q{D&D Information parser}
gem.summary = %q{Ravenloft will... |
ActiveAdmin.register Category do
action_item only: :show do
link_to "Posts", admin_category_posts_path(resource)
end
end
|
class CreateProducts < ActiveRecord::Migration[5.0]
def change
create_table :products do |t|
t.string :title
t.string :place_of_origin
t.string :size
t.text :packings
t.text :description
t.text :features
t.timestamps
end
end
end
|
class AddToggleBooleansToSettings < ActiveRecord::Migration[5.1]
def change
add_column :settings, :infl_show, :boolean, default: false
add_column :settings, :trans_show, :boolean, default: false
add_column :settings, :video_show, :boolean, default: false
end
end
|
require 'multi_json'
require 'aws/s3' if (File.exist? File.join(::Rails.root, 'config', 'amazon_s3.yml'))
require 'aws_extension' if (File.exist? File.join(::Rails.root, 'config', 'amazon_s3.yml'))
class RedactorS3Helper
attr_reader :options
def initialize(_options = {})
@options = {
:acl => Config.a... |
require 'csv'
require 'open-uri'
require 'nokogiri'
Vote.destroy_all
News.destroy_all
Nlp.destroy_all
Favorite.destroy_all
BrandCategory.destroy_all
Category.destroy_all
Tag.destroy_all
Review.destroy_all
Brand.destroy_all
user = User.find_by(email: "timothee.rouquette@gmail.com")
#Seeding categories
clothing = Cate... |
require 'spec_helper'
module OpenFec
RSpec.configure do |config|
config.before(:each) do
# Search Data
candidate_search_john = JSON.parse(File.read("spec/stubs/search/candidate_search_john.json"))
committee_search_congress = JSON.parse(File.read("spec/stubs/search/committee_search_congress.js... |
#!/usr/bin/env ruby
require "test_helper"
require "mocks/person"
require "active_record_operation"
class ActiveRecordOperationTest < Test::Unit::TestCase
context "ActiveRecordOperation instance" do
setup do
@connection = stub(:opt => {:schema => "foo", :server => "bar"})
@config = { :basedn => "stuf... |
# frozen_string_literal: true
require 'spec_helper'
describe 'full' do
let(:component) do
var(role: :full, name: 'component')
end
let(:deployment_identifier) do
var(role: :full, name: 'deployment_identifier')
end
let(:domain_name) do
var(role: :full, name: 'domain_name')
end
let(:public_zone... |
class PolyTreeNode
attr_reader :value, :parent, :children
def initialize(value)
@parent = nil
@children = []
@value = value
end
def parent=(node)
if !@parent.nil? && @parent.children.include?(self)
@parent.children.delete(self)
end
if !node.nil? && !node.children.inclu... |
class CreateCatDogSurveys < ActiveRecord::Migration[5.0]
# Set'up'
def up
create_table :cat_dog_surveys do |t|
t.belongs_to :users, :index => true
t.boolean "cat"
t.boolean "dog"
t.boolean "predicted"
t.timestamps
end
end
# Tear'down'
def down
drop_table :cat_dog_sur... |
class ItemsController < ApplicationController
before_action :authenticate_user!, only: [:new, :create, :update, :edit, :destroy]
before_action :set_item, only: [:show, :edit, :update, :destroy]
before_action :root_item, only: [:destroy, :update, :edit]
def index
@items = Item.all.order(created_at: :desc)
... |
# frozen_string_literal: true
class CalculatorController < ApplicationController
STATUS_OK = 'ok'
STATUS_ERROR = 'error'
def index
success
end
def payment_amount
perform_calculation(class_to_use: PaymentAmountCalculator, params_to_use: payment_amount_params)
end
def mortgage_amount
perf... |
# frozen_string_literal: true
class PriceGroupMember < ApplicationRecord
belongs_to :price_group
validates_presence_of :price_group_id
end
|
module MemberHelper
# Returns the local image for the member with gravatar as a fallback.
# If we have the member's twitter handle, make the image a link to
# their twitter account, and append their handle to the title on the image.
# If we don't have twitter, but we do have their githup username,
# make the ... |
ActionController::Routing::Routes.draw do |map|
map.root :controller => 'high_voltage/pages',
:action => 'show',
:id => 'welcome',
:conditions => { :method => :get }
map.resources :users,
:only => [:create, :show, :edit, :update] do |user|
user.resources :cal... |
require 'rails_helper'
feature 'Identity uncompletes an appointment', js: true do
scenario 'and sees the completed date reset' do
given_i_have_added_a_procedure_to_an_appointment
when_i_begin_the_appointment
when_i_complete_the_procedure
when_i_complete_the_appointment
when_i_uncomplete_the_appo... |
$LOAD_PATH.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "ketsuban/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "ketsuban"
spec.version = Ketsuban::VERSION
spec.authors = ["oieioi"]
spec.email = ["at... |
describe Mellon do
specify "VERSION" do
expect(defined?(Mellon::VERSION)).to_not be_nil
end
end
|
Pod::Spec.new do |s|
s.name = "Axe"
s.version = "0.2.0-alpha.0"
s.summary = "Axe is all the reinforcement this army needs"
s.homepage = "https://github.com/axe-org/axe"
s.license = { :type => "MIT"}
s.author ... |
require "test_helper"
describe Rugged::Blob do
before do
@path = File.dirname(__FILE__) + '/fixtures/testrepo.git/'
@repo = Rugged::Repository.new(@path)
@oid = "fa49b077972391ad58037050f2a75f74e3671e92"
end
describe "when loading blobs" do
it "can read the blob data" do
blob = @repo.look... |
# frozen_string_literal: true
require 'lighthouse/facilities/client'
class VAFacilitySerializer < ActiveModel::Serializer
type 'va_facilities'
def id
"#{object.facility_type_prefix}_#{object.unique_id}"
end
def operating_status
if Flipper.enabled?(:facility_locator_pull_operating_status_from_lightho... |
require 'rest-client'
require 'json'
require 'singleton'
require 'yaml'
require 'CloudFlareConnection'
#load "CloudFlareConnection.rb"
# CloudFlareDNS
# This class supports DNS requests to the CloudFlare DNS Service.
# It uses the CloudFlareConnection class to send GET, POST, DELETE HTTP Request to the CloudFlare R... |
module KnapsackPro
class TestFileFinder
def self.call(test_file_pattern)
new(test_file_pattern).call
end
def initialize(test_file_pattern)
@test_file_pattern = test_file_pattern
end
def call
test_file_hashes = []
test_files.each do |test_file_path|
test_file_hashe... |
require 'spec_helper'
describe HTTPalooza::Players::OraclePLSQLPlayer do
before(:all) do
@skip_all_tests = begin
require 'oci8'
OCI8.new('system', 'oracle', 'localhost')
false
rescue => e
true
end
end
before(:each) do
if @skip_all_tests
skip("Oracle Database is prob... |
require 'rspec/mocks'
require_relative 'book_in_stock'
require_relative 'data_access'
describe DataAccess do
before(:each) do
@sqlite_database = double(:sqlite_database)
@dalli_client = double(:dalli)
@data_access = DataAccess.new(@sqlite_database,@dalli_client)
end
describe '#findISBN' do
bef... |
require "zero_formatter/version"
require "zero_formatter/utils"
require "zero_formatter/serializer"
require "zero_formatter/zero_formattable"
module ZeroFormatter
def self.load(klass, bytes)
serializer.load(klass, bytes)
end
def self.dump(data)
serializer.dump(data)
end
def self.serializer
@ser... |
AjaxTodo::Application.routes.draw do
# STEP 4 - Create routes required for TasksController
get '/' => 'tasks#index', as: :index
post '/create', to: 'tasks#create'
put '/complete/:id', to: 'tasks#complete'
delete '/destroy/:id', to: 'tasks#destroy'
end
|
class PriceNotificationsController < ApplicationController
before_filter :require_login
before_filter :find_and_authorize_price_notification, only: [:edit, :update, :destroy]
before_filter :add_breadcrumbs, only: [:edit]
handles_sortable_columns
def index
if sort_param.blank?
flash.keep
re... |
class Rdomino::Document
# @param [Document] question
def response_of!(question)
@obj.makeresponse(question.obj)
end
# @param [Document] document
# @return [Boolean]
def response_of?(document)
document.unid == g(:$ref)
end
# @return [Boolean]
def response?
hasitem? :$ref
end
def unr... |
# dog_leash_1 = {:length => "3m", :color => "black", :price => 12.99}
# dog_leash_2 = {:length => "1m", :color => "pink", :price => 8.99}
# dog_leash_3 = {length: "5m", color: "chain", :price => 17.99}
# p "This #{dog_leash_1[:color]} leash is #{dog_leash_1[:length]} and it cost $#{dog_leash_1[:price]}"
# p "This #{do... |
class MainController < ApplicationController
def index
redirect_to featured_projects_path
end
end |
class LoginNotice
attr_accessor :enabled, :callAfter, :callBefore, :dependencies
def initialize(mother)
@parent = mother
@enabled = true
@callAfter = false
@callBefore = true
@dependencies = {
'author' => 'Lynx',
'version' => '0.1',
'hook_type' => 'login'
}
end
def handleGameLogin(data, cli... |
## user_access_steps.rb
# Used in checked what access a user has to the CSA application
#
# @author Helen Harman
# @created November 2014
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
Then(/^"(.*?)" tab should be avaliable$/) do |tab_id|
assert has_selector?(:xpath, "//a[@i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.