text stringlengths 10 2.61M |
|---|
require_dependency "webcore/webcore_controller"
module Webcore
class PagePhotosController < Webcore::WebcoreController
def reprocess
Webcore::PagePhoto.find_each { |p| p.photo.reprocess! }
redirect_to root_path, notice: 'Success recompiling page photo thumbs'
end
def edit
@page_photo = Webcore::Page... |
class Destination < ActiveRecord::Base
attr_accessible :name, :location, :image, :thoughts, :trip_id
validates :trip_id, presence: true
validates :name, presence: true
belongs_to :trip
end |
require 'pp'
module Jekyll
class InspectTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
if !text.empty? then
@key = text.to_sym
end
end
def render(context)
var = context.registers
if @key then
var = var[@key]
end
return var.pretty_p... |
json.cache! [Api::Public::V1::VERSION, @billboard] do
json.partial! @billboard
json.posts @billboard.posts do |post|
json.partial! 'api/public/v1/posts/post', post: post
end
end
|
# encoding: UTF-8
require 'linguistics/latin/verb/phonographia'
module Linguistics
module Latin
module Verb
##
# == NAME
#
# TenseBlock
#
# == DESCRIPTION
#
# As per the LatinVerb documentation, LatinVerbs decorate themselves with
# the method which loads up a voice/tense/moo... |
module Naf
DEFAULT_PAGE_OPTIONS = [10, 20, 50, 100, 250, 500, 750, 1000, 1500, 2000]
LOGGING_ARCHIVE_DIRECTORY = "/archive"
if ['test', 'development'].include?(Rails.env)
LOGGING_ROOT_DIRECTORY = 'var/log'
else
LOGGING_ROOT_DIRECTORY = '/var/log'
end
NAF_DATABASE_HOSTNAME = Rails.configuration.database_conf... |
#!/usr/bin/ruby
require "Token"
require "Parser"
require "Node"
#hasExtras
#tests whether or not the inputted category has an extra line; returns true if it does; otherwise, returns false
#input: category
#output: boolean describing whether or not the inputted category has an extra line
def hasExtras(category)
if(cat... |
class DropTypeFromCategories < ActiveRecord::Migration
def self.up
remove_index :categories, [:name, :type]
remove_column :categories, :type
add_index :categories, [:name, :division], :unique => true
end
def self.down
end
end
|
FactoryGirl.define do
factory :user do
first_name 'Bob'
last_name 'Everyman'
street_address '123 Main St.'
phone '1234567890'
sequence(:email) { |n| "user#{n}@example.com" }
password 'password'
unit
end
factory :bill do
bill_received '2015-12-13'
amount 19.99
user
end
... |
class CreateOperatingSystems < ActiveRecord::Migration
def self.up
create_table :operating_systems do |t|
t.column :name, :string
t.column :vendor, :string
t.column :variant, :string
t.column :version_number, :string
t.column :created_at, :datetime
... |
FactoryBot.define do
factory :user do
email { 'lorem@email.com' }
token { 'JHsUBvuzZyv_dFpa5keV' }
first_name { 'John' }
password { '12345678' }
password_confirmation { '12345678' }
trait :with_assigned_book do
after(:create) do |user|
create(:assigned_book, user_id:... |
Vagrant.configure("2") do |config|
config.trigger.before :provision do |trigger|
trigger.info = "Copying certificates..."
trigger.only_on = "controller-2"
trigger.run = { path: "copy-certs.sh" }
end
(1..2).each do |i|
config.vm.define "controller-#{i}" do |node|
node.... |
module Slimpay
extend ActiveSupport::Concern
require 'date'
private
def self.get_token
authorization = 'Basic '+ Settings.slimpay.encoded_key
response = HTTParty.post(Settings.slimpay.server+'/oauth/token',
headers: {
'Accept' => 'application/json',
'Content-Type' =... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
mount_uploader :avatar, AvatarUploader
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :tr... |
class WorksController < ApplicationController
def set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Request-Method'] = '*'
end
def fetch_question
@work = Work.find_by_id(params[:id])
end
def index
@works = Work.all
respond_to do |format|
... |
require('capybara/rspec')
require('./app')
Capybara.app = Sinatra::Application
set(:show_exceptions, false)
describe('/', {:type => :feature}) do
it("loads the index page correctly") do
visit('/')
expect(page).to have_content("Word Counter")
end
it("returns the correct count of each word") do
visit('... |
class homepageObjects
set_url 'https://www.exercise1.com/values '
include PageObject
page_url("https://www.exercise1.com/values")
text_field(:first_element_in_page , :id => 'lbl_val_1')
text_field(:value_text_label, :id => 'lbl_val_')
text_field(:actual_value_label, :id => 'txt_val_')
... |
require_relative 'routee_service'
class RouteeAccountsService < RouteeService
def self.getInstance
@instance ||= RouteeAccountsService.new(nil, 'https://connect.routee.net/accounts')
end
def getAccountBalance(token)
response = RestClient.get(baseUrl + '/me/balance', {'authorization': 'Bearer ' + token}... |
class CreateBillTypes < ActiveRecord::Migration
def self.up
create_table :bill_types do |t|
t.references :account
t.text :name
t.integer :lock_version, :default => 0
t.timestamps
end
end
def self.down
drop_table :bill_types
end
end
|
module GssUsps
module Request
def self.request(web_method, params, raw_xml = false)
client = Savon.client(wsdl: GssUsps.configuration.wsdl,
follow_redirects: GssUsps.configuration.follow_redirects,
log: true,
logger: GssUsps... |
require 'ruby-debug'
require_relative 'item'
require_relative 'room'
class Parser
attr_reader :file
attr_accessor :rooms
def initialize(file)
@file = File.open(file, "r").read
@rooms
end
def get_sections
file.split(/\n\n/)
end
def name(object)
object.scan(/Room @(.*):|\$(.*):|!(.*):/).... |
Trestle.resource(:users) do
menu do
item :users, icon: "fa fa-star"
end
table do
column :email
column :created_at, align: :center
actions
end
form do
text_field :email
end
end
|
class Post < ApplicationRecord
belongs_to :user
acts_as_votable
acts_as_commentable
mount_uploader :attachment, AvatarUploader
validates :attachment, :presence => true
end
|
# frozen_string_literal: true
require "spec_helper"
RSpec.describe SidekiqUniqueJobs::Script do
subject { described_class }
it { is_expected.to respond_to(:call).with(2).arguments.and_keywords(:keys, :argv) }
it { is_expected.to respond_to(:script_source).with(1).arguments }
it { is_expected.to respond_to(:s... |
json.categories do
json.array!(@categories) do |category|
json.id category.id
json.name category.name
end
end
|
class AddHomeCheckShow < ActiveRecord::Migration
def up
add_column :shows, :home, :boolean
end
def down
remove_column :shows, :home
end
end
|
require 'player'
describe 'Player' do
let(:player) {Player.new}
it 'can be given a name' do
player.set_name('Kirk')
expect(player.name).to eq 'Kirk'
end
it 'has a weapon choice' do
expect(player.weapon).to eq :no_weapon
end
it 'can choose a weapon' do
player.choose(:ROCK)
expect(pla... |
module LazyJason
DEFAULT_EXPIRATION_TIME = 10.seconds.freeze
def self.included(base)
base.class_eval do
rescue_from ActiveRecord::RecordNotFound, :with => :no_such_object
end
end
def index
objects = scope.all(:offset => @offset_limit[0], :limit => @offset_limit[1])
if stale?(:last_modi... |
require 'rails_helper'
RSpec.describe Item, type: :model do
let(:item_instance) { build(:item) }
it "has a valid factory" do
expect(item_instance).to be_valid
end
context "item should have the correct attributes" do
it { expect(item_instance).to respond_to(:title) }
it { expect(item_instance).to... |
require 'spec_helper'
describe Api::CategoriesController, :type => :controller do
before do
@project = Project.create(name: 'Project', days_per_point: 1.0 )
end
describe "xhr GET 'show':" do
before do
@category = @project.categories.create(name: 'SampleCategory', remarks: 'Test', position: 99)
... |
module ProtocolHelper
def admin_portal_link(protocol)
content_tag(:a, href: protocol.sparc_uri, target: :blank, class: 'btn btn-default btn-xs admin_portal_link', title: 'Admin Portal link', aria: { expanded: 'false' }) do
content_tag(:span, '', class: 'glyphicon glyphicon-link')
end
end
def forma... |
class Customer < ActiveRecord::Base
include Helper
attr_accessible :name, :facebook_id, :friends, :username, :picture_url
attr_accessor :fb_user, :fb_me
has_many :tours
has_many :choices
serialize :friends
#current_user.bar.name, current_user.bar.logo
def post_bar_visit(bar, root_url)
if self.just_... |
class Admin::LoaiSanPhamsController < Admin::AdminController
before_action :set_loai_san_pham, only: [:show, :edit, :update, :destroy]
# GET /loai_san_phams
# GET /loai_san_phams.json
def index
@san_phams = SanPham.all.paginate(page: params[:page], per_page: 3)
end
# GET /loai_san_phams/1
# GET /loa... |
# frozen_string_literal: true
module Kafka
module Protocol
class CreatePartitionsRequest
def initialize(topics:, timeout:)
@topics, @timeout = topics, timeout
end
def api_key
CREATE_PARTITIONS_API
end
def api_version
0
end
def response_class
... |
class AddPositionIndexToVisitGroups < ActiveRecord::Migration
def change
add_index "visit_groups", ["position"], name: "index_visit_groups_on_position", using: :btree
end
end
|
class AddOrderNumToDdh < ActiveRecord::Migration
def change
add_column :ddhs, :order_num, :integer, default: 0
end
end
|
require 'rspec'
describe Towers do
describe "#initialize" do
it "sets the first array to 1-2-3, the second and third to empty" do
Towers.new.array1.should == [1, 2, 3]
Towers.new.array2.should be_empty
Towers.new.array3.should be_empty
end
end
describe "#move" do
it "should move ... |
require_relative 'spec_helper'
describe Overleap do
before(:all) do
hash = { propensity: 1, ranking: 'C' }
js = JSON.generate(hash)
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
stub.get('/customer_scoring') { |env| [200, {}, js] }
end
@test = Faraday.new do |builder|
builder.ad... |
class Post < ApplicationRecord
belongs_to :user
has_many :likes
has_many :likers, through: :likes, source: :user
has_one_attached :image
validate :image_presence
# validate :description length
def image_presence
errors.add(:image, "can't be blank") unless image.attached?
end
def imageURL
... |
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'with_retries/version'
Gem::Specification.new do |gem|
gem.name = "with_retries"
gem.version = WithRetries::VERSION
gem.authors = ["Bryan Woods", "Abel Martin"... |
require 'request_spec_helper'
describe 'GET /api/current_season/characters' do
it "returns the current characters" do
team = Team.create
season = Season.create
week = season.weeks.create number: 1
player = Player.create name: "Player One"
character = Character.create season: season, player: playe... |
class MessagesController < InheritedResources::Base
def show
if merchant_signed_in?
@merchant = current_merchant
@user = Message.find(params[:id]).user
@msg = @merchant.messages.build
elsif user_signed_in?
@user = current_user
@merchant = Message.find(params[:id]).merchant
... |
# frozen_string_literal: true
require "cell/partial"
module Decidim
module Opinions
# This cell renders a opinions picker.
class OpinionsPickerCell < Decidim::ViewModel
MAX_OPINIONS = 1000
def show
if filtered?
render :opinions
else
render
end
e... |
class SessionsController < ApplicationController
def new
end
def login
user = User.find_by(email:params[:email])
flash[:errors] = []
if params[:email] == ''
flash[:errors] << "Email cannot be blank"
end
if params[:password] == ''
flash[:errors] << "Password cannot be blank"
end
if us... |
class Inventory < ApplicationRecord
belongs_to :user
belongs_to :book
validates :book_id, uniqueness: {scope: :user_id, message: "should only add a book once."}
enum status: {currently_reading: 0, want_to_read: 1, read: 2}
end
|
module PrsBot
class API
attr_reader :client
def initialize(options={})
@client = Client.new
end
def get_user_profile(address)
path = format('api/users/%s', address)
client.get(path)
end
def get_user_feed(address, options={})
options = options.with_indifferent_access
... |
module Robut # :nodoc:
# Robut's version number.
VERSION = "0.5.2"
end
|
class SubjectsController < ApplicationController
before_action :set_subject, only: [:show, :update, :destroy]
include SubjectsHelper
def show
@subject.punch(request)
@promotions = Promotion.find(:all, from: :active).to_a
respond_to do |format|
format.json { render json: @subject }
format.... |
# frozen_string_literal: true
require 'dotenv/load'
require 'minitest/autorun'
require 'minitest/reporters'
require 'active_support/all'
require 'rest-client'
require 'awesome_print'
require 'json'
require 'parallel'
require 'fileutils'
require 'uuidtools'
require 'time'
reporters = [Minitest::Reporters::SpecRepor... |
class FillDocument < ApplicationUseCase
include DetailsHelper
attr_reader :body
def initialize(body:, employee:)
@body = body
@employee = employee
end
def perform
fill_in_document
end
private
def fill_in_document
# Find fields to fill in doc - e.g. [%start_date]
fields = @body.sc... |
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/ficha_tematicas/edit.html.erb" do
include FichaTematicasHelper
before do
@ficha_tematica = mock_model(FichaTematica)
@ficha_tematica.stub!(:autor).and_return("MyString")
@ficha_tematica.stub!(:resumen).and_return("MyText")
@ficha_t... |
require 'rails_helper'
describe 'Item ID Shows Merchant Data API' do
before :each do
@merchant_2 = create(:merchant)
@item_2 = create(:item, merchant: @merchant_2)
end
describe 'happy path' do
it "shows a merchant data for a merchant associated with a particular item" do
get api_v1_items_merch... |
class Profile < ActiveRecord::Base
belongs_to :client
belongs_to :staff
# devise_group :person, contains: [:staff, :client]
has_many :posts, dependent: :destroy
has_attached_file :avatar, styles: { medium: "300x300#", thumb: "100x100#" }, default_url: "/images/:style/missing.png"
validates_attachment_con... |
# p025mtdproc.rb
=begin
Você não pode passar métodos dentro de outros métodos
(mas pode passar procs dentro dos métodos),
e métodos não podem retornar outros métodos (mas eles podem retornar procs)
=end
def algum_metodo algum_proc
puts 'Início do método'
algum_proc.call
puts 'Fim do método'
end
fale = lam... |
class Info < ApplicationRecord
has_one :blok
has_many :comments
end
|
class TeamRatingsController < ApplicationController
before_filter :set_contest
before_filter :set_team_2
#before_filter :verify_team_access
before_filter :find_rating
before_filter :set_tabs
helper :application
def show
unless can_see_rating?
flash[:message] = "Рейтинг недоступен"
... |
# The program converts the array by adding the first element to odd numbers.
# The first and last elements of the array do not change.
arr = [1, 2, 2, -4, 0, 6, 7, 8, 12]
arr = arr.each_with_index do |elem, index|
next unless index.positive? && index < arr.size - 1
arr[index] += arr.first if elem.odd?
end
puts "Pr... |
require 'spec_helper'
describe Klin::Pairer do
Node = Struct.new(:id)
let(:pairer) { described_class.new }
let(:a_nodes) { [Node.new(:foo), Node.new(:bar)] }
let(:b_nodes) { [Node.new(:me), Node.new(:you)] }
let(:all_pairs) do
[
[a_nodes[0], b_nodes[0]],
[a_nodes[0], b_nodes[1]],
[a_no... |
json.array! @api_activities do |activity|
if (@user.platform == "ios" && (@user.app_version == nil || @user.app_version < "2.0.3")) || (@user.platform == "android" && (@user.app_version == nil || @user.app_version < "1.0.2" ))
if activity.trackable_type == "Recommendation"
@restaurant_id = @all_recommenda... |
require 'rubygems'
require 'iso_country_codes'
class TLD
class Currency
CURRENCY_MAP = {
:eu => %w{EUR},
:gov => %w{USD},
:mil => %w{USD}
}
class << self
def find(klass)
tld = klass.tld
mapped_currency = CURRENCY_MAP[tld.to_sym]
if mapped_currency.nil?
... |
class Questioning < FormItem
include Replication::Replicable
before_validation :normalize
delegate :all_options, :auto_increment?, :code, :code=, :first_leaf_option_node, :first_leaf_option,
:first_level_option_nodes, :has_options?, :hint, :level_count, :level, :levels, :min_max_error_msg,
:multilevel?,... |
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'pp'
require_relative 'factories/csv_parser.rb'
require_relative 'factories/dino_fetcher.rb'
class DinoDex
def self.parse(args)
# Set up default options
options = OpenStruct.new
options.json_export = false
options.cli_options = {}
... |
class App < Sinatra::Base
include Rack::Utils
get '/rules' do
haml :rules
end
get '/booze' do
# which date to run
@rundate = Date.parse(params[:date]) rescue nil || Date.today
opts = {
rundate: @rundate,
divisor: params[:divisor]
}
@results = create_magic_number(opts)
... |
#
# Author:: Malte Swart (<chef@malteswart.de>)
# Cookbook Name:: postfix-full
#
# Copyright 2013, Malte Swart
#
# 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/li... |
require 'spec_helper'
describe ROM::Setup do
it 'is configurable' do
setup = ROM::Setup.new({})
setup.configure do |config|
config.sql.infer_relations = false
end
expect(setup.config.sql.infer_relations).to be(false)
expect(setup.config[:sql][:infer_relations]).to be(false)
expect(se... |
# frozen_string_literal: true
class Company < ApplicationRecord
has_many :collaborators, dependent: :destroy
validates :name, presence: true
accepts_nested_attributes_for :collaborators
end
|
class Book < ApplicationRecord
belongs_to :user, optional: true
validates :title,
:presence => true
validates :s_no,
:presence => true,
:uniqueness => true
validates :description,
:presence => true
end
|
Spree::CheckoutController.class_eval do
before_filter :redirect_to_samport_payment, :only => [:update]
before_filter :update_flash_message, :only => [:edit]
def redirect_to_samport_payment
return unless params[:state] == "payment"
@payment_method = Spree::PaymentMethod.find(params[:order][:payment... |
module OpenIconicHelper
def open_iconic(svg_class, icon)
icon = icon.to_s.gsub('_','-')
svg_class = svg_class.to_s.gsub('_','-')
icons = [
"account-login", "account-logout", "action-redo", "action-undo",
"align-center", "align-left", "align-right", "aperture", "arrow-bottom",
"arrow-cir... |
class TestimonialsController < ApplicationController
before_action :set_testimonial, only: [:edit, :update, :show]
before_action :set_user
def new
@testimonial = Testimonial.new
end
def create
@user = User.find(session[:user_id])
@testimonial = @user.testimonials.new(testimonial_params)
@tes... |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{dictionary}
s.version = "1.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["trans <transfire@gmail.com>", "- Jan Molic", "- Andrew Johnson", "- Jeff Sharpe", "- ... |
=begin
#===============================================================================
Title: Cover Targets
Author: Hime
Date: Dec 20, 2013
URL: http://himeworks.com/2013/11/21/cover-targets/
--------------------------------------------------------------------------------
** Change log
Dec 20, 2013
- fixed bu... |
module Enjoy::Pages
module Models
module ActiveRecord
module Blockset
extend ActiveSupport::Concern
included do
has_paper_trail
validates_lengths_from_database only: [:name]
if Enjoy::Pages.config.localize
translates :name
end
h... |
class Character < ActiveRecord::Base
belongs_to :guild
belongs_to :user
validates_uniqueness_of :name
accepts_nested_attributes_for :guild
validate :character_exists
validate :guild_is_registered
before_save :set_guild
after_save :fetch_stats!
def stats
@stats ||= Stat.where(character_id: self... |
class ApplicationController < ActionController::API
include ExceptionHandler
include Response
include BucketlistUtilities
before_action :authenticate_request
attr_reader :current_user
private
def authenticate_request
result = AuthorizeApiRequest.new(request.headers).call
@token = result[:token]... |
module Math
class MathQuestions
attr_reader :quest1, :quest2, :answer
def initialize
@quest1 = rand(20) + 1
@quest2 = rand(20) + 1
@answer = @quest1 + @quest2
end
def questions(turn, player)
puts "\n ******QUESTION #{turn} *******\n\n"
puts "\n#{player}'s turn\n\n"
... |
class FontCastoro < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/castoro"
desc "Castoro"
desc "Named for the north american beaver, castor canadensis"
homepage "https://fonts.google.com/specimen/Castoro"
def install
(share/"fonts"... |
class Game
attr_accessor :board, :player_1, :player_2
WIN_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
]
def initialize(player_1 = Players::Human.new("X"), player_2 = Players::Human.new("O"), board = Board.new)
@pl... |
class Beer < ActiveRecord::Base
include RatingAverage
belongs_to :brewery, touch: true
belongs_to :style
has_many :ratings, :dependent => :destroy
has_many :raters, -> {uniq}, through: :ratings, source: :user
validates :name, :presence => true
validates :style_id, :presence => true
def to_s
" #{se... |
module Admin::UsersHelper
def show_role user
case
when user.admin?
t ".role_admin"
when user.supervisor?
t ".role_supervisor"
else
t ".role_trainee"
end
end
end
|
require 'test_helper'
class AssetHatTest < ActiveSupport::TestCase
context 'AssetHat' do
should 'know where to find/store assets in the file system' do
assert_equal 'public/stylesheets', AssetHat.assets_dir(:css)
assert_equal 'public/javascripts', AssetHat.assets_dir(:js)
assert_equal 'bundles... |
require 'slack'
module Embulk
module Input
class SlackMessage < InputPlugin
Plugin.register_input("slack_message", self)
def self.transaction(config, &control)
task = {
'channel' => config.param('channel', :hash),
'token' => config.param('token', :string),
'repe... |
require 'fileutils'
require 'test/unit'
require 'pp'
require 'rubygems'
require 'bundler/setup'
require 'rspec'
require 'json'
require 'vocabularise/model'
require 'vocabularise/config'
require 'vocabularise/crawler'
require 'vocabularise/request_handler'
require 'spec/spec_helper'
describe 'RequestHandler' do
... |
class AddPriceToHotel < ActiveRecord::Migration[6.0]
def change
add_column :hotels, :price, :numeric
end
end
|
require 'spec_helper'
describe Mongoid::History::Tracker do
before :each do
class Element
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::History::Trackable
track_history
field :body
# force preparation of options
history_trackable_options
e... |
class Catchword < ApplicationRecord
belongs_to :company, required: false
has_many :catchword_list_catchwords, dependent: :destroy
has_many :catchword_lists, through: :catchword_list_catchwords
mount_uploader :sound, SoundUploader
end
|
require "spec_helper"
describe Wunderground do
describe "history_for" do
it "gets history response from Wunderground", :vcr do
time = Time.zone.parse("March 1, 2015 at 12pm")
location = "knyc"
raw_response = subject.history_for(time, location)
expect(raw_response).to have_key("history")
... |
class AddIndexToFriendsUsers < ActiveRecord::Migration
def change
add_index(:friends_users, [:friend_id, :user_id], :unique => true)
end
end
|
describe 'fazer requisicao' do
context 'para alterar dados com' do
it 'put' do
@body_put = {
"id": 637,
"name": "brunoX batista 289",
"last_name": "batistaX 289",
"email": "broX12@gmail.com",
"age": "21",
... |
# frozen-string-literal: true
require File.join(File.dirname(__FILE__), 'helper')
require 'fileutils'
class TestUnicodeFilename < Test::Unit::TestCase
SRC_FILE = 'test/data/vorbis.oga'
# That's "hello-" followed by "ni hao" in UTF-8
DST_FILE = "test/data/hello-\xE4\xBD\xA0\xE5\xA5\xBD.oga".dup # mutable
cont... |
class DashboardsController < ApplicationController
before_filter :require_user, :only => [ :show, :change_workouts_display ]
def show
type = 'a'
first_date = Date.today - Date.today.wday - 20
last_date = Date.today + (7 - Date.today.wday) + 21
@user = @current_user
@swims = @current_... |
require "spec_helper"
describe Card do
it "should accept suit and value when building" do
card = Card.new(:clubs, 10)
card.suit.should eq(:clubs)
card.value.should eq(10)
end
it "should have a value of 10 for facecards" do
cards = ["J", "Q", "K"]
cards.each do |facecard|
card = Card.n... |
class RemoveTimesToLesson < ActiveRecord::Migration[5.0]
def change
remove_column :lessons, :lesson_hour_start, :time
remove_column :lessons, :lesson_hour_end, :time
add_column :lessons, :lesson_hour_start, :datetime
add_column :lessons, :lesson_hour_end, :datetime
end
end
|
class CreateNodeDatabaseInstanceAssignments < ActiveRecord::Migration
def self.up
create_table :node_database_instance_assignments do |t|
t.column :node_id, :integer
t.column :database_instance_id, :integer
t.column :assigned_at, :datetime
t.column :created_at, ... |
module ERBB
# Parses ERBB files (erb files with #named_block calls in them). Use like you
# would the ERB class, except instead of passing a binding when getting the
# result, you pass in an object which will be the implicit receiver for all
# ruby calls made in the erb template. This object will be decorated w... |
# rest-client extension
module RestClient
# This class enhance the rest-client request by accepting a parameter for ca certificate store,
# this file can be removed once https://github.com/rest-client/rest-client/pull/254
# get merged upstream.
#
# :ssl_cert_store - an x509 certificate store.
class Request
... |
Given(/^user is logged into eHMP\-UI$/) do
# p "running test #{TestSupport.test_counter} #{TestSupport.test_counter % 10}"
# if ENV.keys.include?('LOCAL') || TestSupport.test_counter % 10 == 0
# p 'refresh the app'
# TestSupport.navigate_to_url(DefaultLogin.ehmpui_url)
# else
# TestSupport.navigate_to... |
class Api::RestaurantsController < ApplicationController
def index
search_key = params[:restaurant_name].downcase
@restaurants = Restaurant.where(city_id: params[:city_id]).where("lower(name) like ?", "%#{search_key}%").with_attached_image
end
def show
@restaurant = Restaurant.find... |
require 'uri'
require 'net/http'
require 'nokogiri'
module Gizoogle
# Translate your strings into gangsta
class String
# Translate a single string, returns translated string
#
# Example:
# >> Gizoogle::String.translate('hello world')
# => wassup ghetto
#
# Arguments:
# str: (S... |
#!/usr/bin/ruby2.0
NAME = 'collab'
VERSION = [0, 0, 1]
require 'docopt'
require 'yaml'
require 'thin'
require 'time'
require 'pp'
require 'mono_logger'
require 'pathname'
require './util.rb'
require './opt.rb'
require './html.rb'
require './cli.rb'
require './slet.rb'
require './server.rb'
parse_ARGV
dispatch_CLO
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.