text stringlengths 10 2.61M |
|---|
# Deploys the given git project to the deploy directory.
git "/var/www/identity/" do
repository "git@github.com:mshanken/identity-api.git"
revision "staging"
action :sync
enable_submodules true
user "root"
group "root"
end
# Creates log and cache dirs for the Kohana project.
directory "/var/www/identity... |
Rails.application.routes.draw do
root :to => 'books#books'
get 'books' => 'books#index'
post 'books' => 'books#create'
get 'books/:id' => 'books#show',as: 'book'
get 'books/:id/edit' => 'books#edit', as: 'edit_books'
patch 'books/:id' => 'books#update', as: 'update_books'
delete 'books/:id' => 'books#destroy', as: 'des... |
class AddMissingDatabaseFields < ActiveRecord::Migration[5.1]
def change
#Ex:- add_column("admin_users", "username", :string, :limit =>25, :after => "email")
#Ex:- change_column("admin_users", "email", :string, :limit =>25)
#Ex:- rename_column("admin_users", "pasword","hashed_pasword")
#leads
add... |
require 'test_helper'
class Web::Admin::BannersControllerTest < ActionController::TestCase
setup do
admin = create :admin
sign_in admin
@banner = create :banner
@exceptions_attributes = ['id', 'created_at', 'updated_at', 'date']
end
test 'should get index' do
get :index
assert_response :... |
Rails.application.routes.draw do
mount ForestLiana::Engine => '/forest'
get 'pages/index'
resources :abyences
resources :client_policies
resources :insurers
resources :coverages
resources :clients
resources :underwriters
resources :companies
# For details on the DSL available within this file, see h... |
class CleanUpBillingInformation < ActiveRecord::Migration
def change
add_column :billing_informations, :year, :integer
add_column :billing_informations, :full_name, :string
remove_column :billing_informations, :expiration
end
end
|
class Controller
def initialize
@interface = Interface.new
@repository = TaskRepository.new
end
def display_tasks
tasks = @repository.tasks
@interface.display_tasks(tasks)
end
def create_task
description = @interface.ask_user_for_task_description
task = Task.new(description)
@rep... |
# encoding: UTF-8
require 'spec_helper'
describe Morpher::Evaluator::Transformer::Input do
let(:object) { described_class.new }
let(:valid_input) { double('Input') }
let(:expected_output) { valid_input }
include_examples 'transforming evaluator'
include_examples 'no invalid input'
end
|
require 'spec_helper'
require File.expand_path('../../load_tasks', __FILE__)
describe 'Reaction Time Analyzer: ' do
describe 'Events are coming properly' do
before(:all) do
events_json = IO.read(File.expand_path('../../fixtures/test_event_log.json', __FILE__))
events = JSON.parse(events_json).find_al... |
require_relative 'smart_log_grouper'
module SmartLogParser
class PageAccessCountGrouper < SmartLogGrouper
def group
page_access_count = Hash.new(0)
@reader.read_lines do |page, _address|
page_access_count[page] += 1
end
page_access_count
end
def self.description
'... |
require 'spec_helper'
describe User do
after { User.destroy_all }
context "attributes" do
context "#inverted_name" do
let(:user) { FactoryGirl.build(:user) }
before do
user.first_name = "John"
user.middle_name = "Quincy"
user.last_name = "Smith"
end
it "shoul... |
class ArrivalsController < ApplicationController
# GET /arrivals
# GET /arrivals.json
def index
@arrivals = Arrival.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @arrivals }
end
end
# GET /arrivals/1
# GET /arrivals/1.json
def show
@arriva... |
class Livro
attr_accessor :titulo, :preco, :ano_lancamento, :possui_reimpressao
def initialize (titulo, preco, ano_lancamento, possui_reimpressao)
@titulo = titulo
@preco = preco
@ano_lancamento = ano_lancamento
@possui_reimpressao = possui_reimpressao
end
def possui_reimpressao?
@possui... |
class Period < ApplicationRecord
belongs_to :user
has_many :jobs
has_many :clients, through: :jobs
validates :name, presence: true
end
|
class Enrollment < ActiveRecord::Base
validates :name, presence: true
validates :surname, presence: true
validates :address, presence: true
validates :email, format: {with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
validates :terms, acceptance: true
end
|
module Darksky
class Entity
attr_accessor :time, :summary, :icon, :sunriseTime, :sunsetTime, :moonPhase, :precipIntensity, :precipIntensityMax, :precipIntensityMaxTime, :precipProbability, :precipType, :temperatureHigh, :temperatureHighTime, :temperatureLow, :temperatureLowTime, :apparentTemperatureHigh, :ap... |
class Friendship < ActiveRecord::Base
belongs_to :user
belongs_to :friended, foreign_key: "friend_id", class_name: "User"
end |
# == Schema Information
#
# Table name: comments
#
# id :bigint not null, primary key
# author_id :integer not null
# story_id :integer not null
# body :string not null
# publish_date :string not null
# created_at :datetime not nul... |
Pod::Spec.new do |s|
s.name = 'SchnorrMusigSDKSwift'
s.version = '0.0.1'
s.summary = 'A short description of SchnorrMusigSDKSwift.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/zks... |
module Portalgun
class Portal
class Host
class BackupSystem
attr_accessor :rate
attr_accessor :compression
attr_accessor :archive
attr_reader :hosts
def initialize
@hosts = Array.new
end
def add_remote(address:, &remote)
@host = B... |
class ChangeRhFromEmployees < ActiveRecord::Migration
def change
rename_column :employees, :rh, :rg
end
end
|
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rest-open-uri-postpatch/version"
Gem::Specification.new do |s|
s.name = "rest-open-uri-postpatch"
s.version = Rest::Open::Uri::Postpatch::VERSION
s.authors = ["David Alber"]
s.email = ["alber.david@gmail.com"]
... |
require 'formula'
class Msp430ElfGcc <Formula
homepage 'https://gcc.gnu.org'
url 'http://ftpmirror.gnu.org/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2'
mirror 'https://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2'
sha256 'f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f'
keg_only :versioned_... |
class Course < ApplicationRecord
has_and_belongs_to_many :students
has_many :topics
end
|
class Location < ActiveRecord::Base
has_many :players
attr_accessor :alias
def self.at(x, y)
find_or_create_by_x_and_y(x, y)
end
def at(x, y)
self.class.at(x, y)
end
def east
at(x + 1, y)
end
def west
at(x - 1 , y)
end
def north
at(x, y + 1)
end
def south
... |
#
# Cookbook Name:: bcpc
# Recipe:: certs
#
# Copyright 2013, Bloomberg Finance L.P.
#
# 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 ... |
include_recipe "homebrew"
package "rbenv"
package "ruby-build"
node[:rbenv][:versions].each do |version|
execute "rbenv install #{version}" do
user node[:rbenv][:user]
not_if{ File.exist?("#{node[:rbenv][:conf_dir]}/versions/#{version}") }
end
end
if version = node[:rbenv][:global]
execute ... |
class Api::V1::CapstonesController < ApplicationController
def index
@capstones = Capstone.all
end
def show
@capstone = Capstone.find_by(id: params[:id])
end
def create
@capstone = Capstone.new(name: params[:name], destription: params[:destription], url: params[:url], screenshot: params[:screenshot])
i... |
class Admin::EmployeesController < Admin::BaseController
before_action :check_admin_rights
before_action :set_admin_employee, only: [:show, :edit, :update, :destroy]
# GET /admin/employees
# GET /admin/employees.json
def index
@admin_employees = Employee.all
end
# GET /admin/employees/1
# GET /ad... |
class Conversation < ActiveRecord::Base
has_many :messages, dependent: :destroy
end
|
# frozen_string_literal: true
module Actions
module Response
class Error < Actions::Response::Base
def success?
false
end
end
end
end
|
class FontLigatureSymbols < Formula
head "https://kudakurage.com/ligature_symbols/LigatureSymbols.zip"
desc "Ligature Symbols"
homepage "https://kudakurage.com/ligature_symbols/"
def install
parent = File.dirname(Dir.pwd) != (ENV['HOMEBREW_TEMP'] || '/tmp') ? '../' : ''
(share/"fonts").install "#{paren... |
# frozen_string_literal: true
require "redis"
# Create a simple throttle that can be used to limit the number of request for a resouce
# per time period. These objects are thread safe.
class SimpleThrottle
# Server side Lua script that maintains the throttle in redis. The throttle is stored as a list
# of timesta... |
class Address < ApplicationRecord
extend ActiveHash::Associations::ActiveRecordExtensions
belongs_to_active_hash :prefecture
belongs_to :user, optional: true
belongs_to :item, optional: true
validates :last_name, presence: true, format: { with: /\A[ぁ-んァ-ン一-龥]/ }
validates :first_name, presence: true, forma... |
Given(/^I vend and insert a (\S[a-z]*) into vending machine$/) do |coin|
@vend = VendingMachine.new
@vend.insert_coin(coin)
end
Then(/^the value of the (\S[a-z]*) will be added to current amount$/) do |coin|
expect(@vend.current_amount).to eq coin.value
end
When(/^I insert a (\S[a-z]*) into vending machine$/) d... |
require './follower_maze/event'
describe FollowerMaze::Event do
it "builds the follow events" do
follow = described_class.build("666|F|60|50", nil)
follow.sequence_index.should == 666
follow.should be_a(FollowerMaze::Event::Follow)
follow.from_user_id.should == "60"
follow.to_user_id.should == "5... |
class OrdersController < ApplicationController
before_action :authenticate_user!
before_action :credit_item,only: [:index,:create]
before_action :move_to_index
before_action :sold_out_item
def index
@credit = Credit.new
end
def create
@credit = Credit.new(purchase_params)
if @credit.valid?
... |
#! /usr/bin/env ruby
require 'minitest/autorun'
require 'nokogiri'
require 'open-uri'
class NokogiriHtmlTest < Minitest::Test
EXPECTED_H2_TITLES = [
"Meta¶",
"Installing Native Gems¶",
"Installing the ruby platform gem¶",
"Troubleshooting¶",
"Appendix A: The Compiler Toolchain¶"
].freeze
def... |
require_relative 'helpers'
require 'rspec'
require 'pry'
def increment_password(password)
password = password.reverse
new_password = password.dup
password_length = password.length
password.split('').each_with_index do |char, i|
# increment char
ord = char.ord + 1
or... |
class Prototype < ActiveRecord::Base
belongs_to :user
has_many :thumbnails , dependent: :destroy
has_one :main_image, -> {where(status: Thumbnail.statuses[:main])}, class_name: "Thumbnail"
has_many :sub_images, -> {where(status: Thumbnail.statuses[:sub])}, class_name: "Thumbnail"
has_many :likes, dependent: :... |
require 'rails_helper'
RSpec.describe BetStepsController, :type => :controller do
before do
@user = create(:user)
sign_in @user
end
describe "GET :show" do
before do
@bet = create(:bet)
session[:bet_id] = @bet.id
end
it "finds the bet instance using the session's bet_id" do
... |
require 'simplecov'
SimpleCov.start
require 'minitest/autorun'
require 'minitest/reporters'
require 'minitest/skip_dsl'
require_relative '../lib/dictionary'
Minitest::Reporters.use!
describe "Scrabble::Dictionary class" do
describe "Dictionary#initialize" do
it "Class initializes with an array" do
my_di... |
class Comment
include Mongoid::Document
field :body, type: String
field :publication_date, type: DateTime
field :author, type: String
field :post_id, type: String
validates_presence_of :body
validates_presence_of :author
validates_presence_of :post_id
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# common
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", path: "vagrant/common.sh"
# web vm
config.vm.define "web" do |web|
web.vm.hostname = "web"
web.vm.provider "virtualbox" do |vb|
... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
FactoryGirl.define do
factory :event do
name "Event name"
description "Event description"
start_date "2015-11-07"
route "Event route"
need_acceptance true
comments_restricted false
end
end
|
require 'test/unit'
class Array
def has_index?(index)
(0...size) === index
end
end # class Array
module Depend
class Base
def initialize
@datasource = nil
end
def set_datasource(node)
@datasource = node
end
def refresh(caller=nil)
hook_visit
@datasource.refresh(self) if @datasource
return unles... |
# frozen_string_literal: true
require 'tzinfo'
require 'tzinfo'
module Jiji::Utils
class Times
extend Jiji::Errors
def self.yesterday(time)
round_day(time - 60 * 60 * 24)
end
def self.round_day(time)
Time.new(time.year, time.mon, time.day, 0, 0, 0, time.utc_offset)
end
def se... |
# class Table
# attr_accessor :num_legs
#
# def initialize (num_legs)
# if num_legs > 0
# @num_legs = num_legs
# else
# # @num_legs = 4
# # puts "Please don't do that"
# # return Exception.new
# # return "it doesn't matter what you return from initialize"
# # asdf
# ... |
class CreatePhotoBoards < ActiveRecord::Migration[5.1]
def change
create_table :photo_boards do |t|
t.integer :photo_id
t.integer :board_id
t.timestamps
end
end
end
|
class CreateLogEntries < ActiveRecord::Migration
def change
create_table :log_entries do |t|
t.string :event_type
t.integer :result
t.text :log_text
t.references :command
t.references :user
t.timestamps
end
add_index :log_entries, :command_id
add_index :log_entries... |
Given /^job description is created$/ do
@job_description = Jobdesc.create! :mission_id => @mission.id,
:last_edited_by => Time.now,
:title => @mission.title,
:status => "draft",
:is_approved => false,
:is_template => false
@document = Document.new
@document.account_id = @current_account.id
... |
require "active_storage/blob"
require "active_support/core_ext/module/delegation"
class ActiveStorage::Attachment < ActiveRecord::Base
self.table_name = "active_storage_attachments"
belongs_to :record, polymorphic: true
belongs_to :blob, class_name: "ActiveStorage::Blob"
delegate_missing_to :blob
def purg... |
require 'rubygems'
require 'parser/current'
module Solargraph
class ApiMap
autoload :Config, 'solargraph/api_map/config'
autoload :Cache, 'solargraph/api_map/cache'
KEYWORDS = [
'__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and',
'begin', 'break', 'case', 'clas... |
class User < ApplicationRecord
has_many :events, class_name: 'Event'
validates_presence_of :username, message: 'Invalid, username cannot be blank'
end
|
namespace :proposal do
desc "Download active proposal files"
task :download => :environment do
proposals = Proposal.selected.active.order(:position)
proposals.each do |proposal|
puts proposal.speaker_name
puts proposal.title
puts
end
proposals.each do |proposal|
next unless... |
class CreateDogCares < ActiveRecord::Migration[6.1]
def change
create_table :dog_cares do |t|
t.references :dog, null: false, foreign_key: true
t.references :care_type, null: false, foreign_key: true
t.timestamps
end
end
end
|
FactoryBot.define do
factory :sprint_market_position, class: IGMarkets::SprintMarketPosition do
created_date '2014-10-22T18:30:15'
currency 'USD'
deal_id 'DEAL'
description 'Description'
direction 'BUY'
epic 'FM.D.FTSE.FTSE.IP'
expiry_time '2014-10-22T19:30:14'
instrument_name 'Instrum... |
class Message
attr_accessor :message
def initialize(msg)
@log = []
@config = {:message => msg,
:cursive => false,
:backup_messages => ["goodbye", "bonjour"]}
end
def print_message?(time)
true
end
def print
if print_message?(Time.now)
@log << get_messag... |
module HealthDataStandards
module Export
module ViewHelper
def code_display(entry, options={})
options['tag_name'] ||= 'code'
options['attribute'] ||= :codes
code_string = nil
preferred_code = entry.preferred_code(options['preferred_code_sets'], options['attribute'])
... |
# frozen_string_literal: true
class EtsPdf::Etl::GroupBuilder < SimpleClosure
def initialize(academic_degree_term_course, parsed_lines)
@academic_degree_term_course = academic_degree_term_course
@parsed_lines = parsed_lines
end
def call
@parsed_lines
.each_with_object([], &method(:group_by_gro... |
# frozen_string_literal: true
module Boring
module FontAwesome
module RubyGem
class InstallGenerator < Rails::Generators::Base
desc "Adds fontawesome via yarn to the application"
def add_font_awesome_sass_gem
say "Adding font_awesome_sass gem", :green
Bundler.with_unbun... |
class AddPercentagesToSetups < ActiveRecord::Migration[5.2]
def change
add_column :setups, :devs_percentage, :integer, default: 15
add_column :setups, :negs_percentage, :integer, default: 8
end
end
|
json.array!(@events) do |event|
json.extract! event, :location, :starts_at, :ends_at, :hobby_id
json.url event_url(event, format: :json)
end
|
require 'spec_helper'
describe User do
before do
User.any_instance.stub(:get_dropbox_attributes).and_return(true)
@user = FactoryGirl.create(:user)
end
it "should be deactivatable" do
@user.deactivate
expect(@user.deactivated).to eq(true)
end
it "should be persistable" do
expect(@user.v... |
#encoding: utf-8
require 'concurrent'
require 'concurrent-edge'
require_relative 'query'
require 'hamster'
class QueryAgent < Concurrent::Actor::Context
def initialize(query)
@query = query
end
def on_message(msg)
case msg[:type]
when :xml
perform msg[:payload]
when :report
report
... |
# frozen_string_literal: true
module Mahonia
class EdtfLiteral < RDF::Literal
DATATYPE = RDF::URI('http://id.loc.gov/datatypes/edtf/EDTF')
# support ActiveJob serialization
include GlobalID::Identification
def self.find(id)
new(id)
end
def initialize(value, **opts)
value = EDTF... |
class ChaptersController < ApplicationController
before_action :load_chapter, only: :show
def index
@chapters = @comic.chapters.sort_by_name.page(params[:page])
.per Settings.chapter.per_page_default
end
def show
@comment = @chapter.comments.build
@comments = @chapter.comment... |
module Boilerpipe::SAX::TagActions
class Chained
def initialize(t1, t2)
@t1 = t1
@t2 = t2
end
def start(handler, name, attrs)
@t1.start(handler, name, attrs) | @t2.start(handler, name, attrs)
end
def end_tag(handler, name)
@t1.end_tag(handler, name) | @t2.end_tag(handler,... |
# verify ruby dependency
verify_ruby 'Memcached - Ruby Plugin'
# check required attributes
verify_attributes do
attributes [
'node[:newrelic][:license_key]',
'node[:newrelic][:memcached_ruby][:install_path]',
'node[:newrelic][:memcached_ruby][:user]'
]
end
verify_license_key node[:newrelic][:license_... |
FactoryGirl.define do
factory :vehicle do
vin { Faker::Lorem.characters(17) }
year { 1900 + rand(150) }
make { Faker::Name.first_name }
model { Faker::Name.last_name }
end
end
# == Schema Information
#
# Table name: vehicles
#
# id :integer not null, primary key
# vin ... |
class Estimate < ApplicationRecord
belongs_to :customer
validates_presence_of :location, :distance, :final_price, :fence_material,
:fence_height, :gate_count
end
|
set :application, "test repo"
set :domain, "youfolio-beta.com"
set :repository, "git@github.com:youfoliodevuser/TestRepo2.git"
set :user, "youfolio"
default_run_options[:pty] = true
set :use_sudo, false
set :scm, :git
set :deploy_via, :remote_cache
set :deploy_to, "/home/youfolio/TestRepo"
role :web, domain ... |
require 'rspec'
require_relative '../lib/pig_latin.rb'
describe PigLatinTranslation do
def pig_latin(phrase)
return PigLatinTranslation.new(phrase).translate
end
it 'should translate words that begin with consonant' do
expect(pig_latin('duck')).to eql("uckday")
end
it 'should translate a phrase' d... |
require "rails_helper"
feature "Welcome page" do
scenario "everybody can see title of the project" do
visit root_path
within "nav.navbar" do
expect(page).to have_content "Rep of Spaces"
end
end
end
|
class AddRightsToMembership < ActiveRecord::Migration[5.1]
def up
add_column :memberships, :rights, :string, default: 'show'
ActiveRecord::Base.record_timestamps = false
begin
Membership.all.each do |m|
m.rights = 'all'
m.save!
end
ensure
ActiveRecord::Base.record_tim... |
# frozen_string_literal: true
# JSON Decoder/Encoder.
require 'json'
module Customer
#
# Class responsible for reading/writing customer
# records too and from text files with JSON
# encoded customers.
#
class Store
class << self
#
# Parse a given customer file i... |
class IdeasController < ApplicationController
respond_to :json, :html
def index
respond_with Idea.order('created_at DESC').all
end
def update
respond_with Idea.update(params[:id], idea_params)
end
def destroy
respond_with Idea.delete(params[:id])
end
def create
respond_with Idea.crea... |
#Fedena
#Copyright 2011 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#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 ... |
class UserPicturesController < ApplicationController
load_and_authorize_resource only: [:create, :destroy]
before_action :find_user
layout "user"
def index
@user_pictures = @user.user_pictures
@user_picture = UserPicture.new
end
def create
@user_picture = @user.user_pictures.build(user_picture... |
require 'bundler/setup'
require_relative '../lib/java_version'
describe JavaVersion do
describe '.valid?' do
context 'valid version string' do
subject { JavaVersion.valid?('JDK7u40') }
it { should be_true }
end
context 'invalid version string' do
subject { JavaVersion.valid?('hoge') }... |
require 'spec_helper'
describe 'sudo::alias::runas' do
let(:title) { 'runas_rspec' }
let(:params) { {:content => ['millert', 'mikef'], :comment => 'generic comment'} }
it do
should contain_sudo__alias('runas_rspec').with({
'content' => ['millert', 'mikef'],
'order' => '10',
'comment' => ... |
$LOAD_PATH << '../../comrank/lib'
require 'cxbrank/const'
class ChangeMusics5 < ActiveRecord::Migration
def self.up
change_table :musics do |t|
t.integer :category, :default => CxbRank::REV_CATEGORY_ORIGINAL
end
end
def self.down
drop_column :musics, :category
end
end
|
class WelcomeController < ApplicationController
before_action :authorize, only: [:devices,:faulter]
def index
end
def devices
@devices=Device.order(:mac).page params[:page]
end
def faulter
@device = Device.find_by_id(params[:id])
@device.defaulter= !@device.defaulter
if @device.save
... |
# frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :check_logged_in
def check_logged_in
redirect_to login_path if session[:name].nil?
end
end
|
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
require 'rails_helper'
describe 'Signing in' do
context 'when user is not signed up' do
it 'is not possible' do
visit new_user_session_url
within '#new_user' do
fill_in 'user_email', with: ''
fill_in 'user_password', with: ''
click_button 'Log in'
end
expect(page... |
require 'byebug'
require_relative 'pieces/slidingpiece'
require_relative 'pieces/steppingpiece'
require_relative 'pieces/pawn'
class Board
HASH_PIECES = {white: {
king: '♔',
queen: '♕',
rook: '♖',
bishop: '♗',
knight: '♘',
pawn: '♙'
}, black: {
king: '♚',
queen: '♛',
rook: '♜',... |
# Patch for banner plugin. This affects in "plugin" action of Redmine Settings
# controller.
# Now banner plugin does not have own model(table). So, datetime informations
# are stored as string and required datetime validation by controller.
#
# TODO Store banner settings to banner's own model (table).
#
module S... |
require 'rubygems'
require 'json'
require 'twitter'
require 'geocoder'
client = Twitter.configure do |config|
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
config.oauth_token = ENV["OAUTH_TOKEN"]
config.oauth_token_secret = EN... |
class ApplicationSerializer < Oj::Serializer
include TypesFromSerializers::DSL
identifier
def currency_for(obj)
obj.cost&.amount&.to_f
end
end
|
class Cell
attr_accessor :alive
def initialize(alive = false)
@alive = alive
end
end
|
class AdminRefundedEvent < WorkspaceStatusEvent
CNAME = 'admin_refunded_event'
belongs_to :user
field :reason
def display
I18n.t("workspaces.events.#{CNAME}", :email => StaticDataLancer::TEAM_EMAIL)
end
def awaiting
I18n.t("workspaces.awaiting.#{CNAME}")
end
def notify
receiver_employer... |
require 'rails_helper'
describe MatchupCreator do
let!(:player_1) { Player.create name: 'Player 1' }
let!(:player_2) { Player.create name: 'Player 2' }
let(:primary_id) { player_1.id }
let(:secondary_id) { player_2.id }
let(:matchup) { Matchup.create primary_id: primary_id, secondary_id: secondary_id, series_... |
FactoryBot.define do
factory :oauth, class: OmniAuth::AuthHash do
provider 'instagram'
uid { '1234567890' }
extra { build(:oauth_info) }
trait :with_credentials do
credentials { build(:oauth_credentials) }
end
end
factory :oauth_info, class: OmniAuth::Au... |
class ChatroomsController < ApplicationController
before_action :set_chatroom, only: [:show]
def show
if @chatroom.post.candidates.nil?
redirect_to posts_path
else
a = []
@chatroom.post.candidates.each do |c|
a.append(c.user_id)
end
if a.exclude?(current_user.id)
... |
require 'ostruct'
module Bonobo
module Middleware
class OpenStructResponse < Faraday::Response::Middleware
def on_complete(env)
if env[:status] == 200
env[:body] = recursive_hash_to_open_struct(env[:body])
end
end
private
def recursive_hash_to_open_struct(value)
... |
class Comentario < ApplicationRecord
belongs_to :comentable, polymorphic: true
belongs_to :comentario
belongs_to :usuario
has_many :comentarios, foreign_key: 'comentario_id'
has_many :votos, as: :votable
validate :tiene_contenido_o_media_id
private
def tiene_contenido_o_media_id
mensaje_de_erro... |
# frozen_string_literal: true
class InviteMailerPreview < ActionMailer::Preview
# http://localhost:3000/rails/mailers/invite_mailer/invite
def invite
subscriber = random_subscriber || Subscriber.create!(email: 'udotman3@gmail.com', name: 'Evgeny')
current_user = random_subscriber
type = (0..4).to_a.sam... |
class PlatformsController < ApplicationController
def index
@platforms = Platform.where("LOWER(name) LIKE ?", "%#{params[:search].downcase}%").limit(10)
respond_to do |format|
format.js
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.