text stringlengths 10 2.61M |
|---|
class CreatePlaces < ActiveRecord::Migration
def self.up
create_table :places do |t|
t.integer :request_id, :null=>false
t.integer :country_id, :null=>false
t.integer :exp_id, :null=>false
end
end
def self.down
drop_table :places
end
end
|
class Review < ApplicationRecord
belongs_to :cheese
belongs_to :user
validates :title, presence: true
validates :blocks, numericality: {only_integer: true, greater_than_or_equal_to: 0, less_than: 11}
scope :top_cheeses, -> { where('blocks > ?', 8) }
end
|
require 'open-uri'
class Instagram
attr_accessor :api_call, :photos_json
def initialize(user_id, access_token)
@api_call = "https://api.instagram.com/v1/users/#{user_id}/media/recent/?access_token=#{access_token}"
open_url
end
def open_url
@photos_json = JSON.load(open(@api_call))["data"]
end
... |
class CartProduct < ApplicationRecord
validates :customer_id, presence: true
validates :product_id, presence: true
validates :quantity, presence: true
belongs_to :customer
belongs_to :product
end
|
require_relative "casouza_video_palindrome/version"
module CasouzaVideoPalindrome
# Returns true for a palindrome, false otherwise.
def palindrome?
if processed_content.empty?
false
else
processed_content == processed_content.reverse
end
end
private
# Returns content for palindrome te... |
class Artist < ActiveRecord::Base
has_many :songs
def song_count
self.song.count
end
end
|
module ApplicationHelper
def bootstrap_class_for flash_type
{ success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type] || "alert-" + flash_type.to_s
end
def alert_banner msg_type, message
concat(content_tag(:div, message, class: "alert #{bootstrap_class... |
class Image < ApplicationRecord
belongs_to :product
def as_json
{
id: id,
image_url: image_url
}
end
end
|
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :name, presence: true, length: { maximum: 20... |
class Admin::AppController < ApplicationController
layout "admin"
# skip_before_action :check_admin
before_action :admin_restricted
private
def admin_restricted
if user_signed_in? && (current_user.role == :admin || current_user.role == :manager)
return true
else
redirect_to root_url
end
end
end |
class SliceTemplate
attr_reader :content
attr_accessor :slices
def initialize(filename)
@content = File.read(filename)
@slices = {}
parse
end
def initialize_copy(other)
@content = other.content.clone
@slices = other.slices.clone
end
def [](slice_name)
@slices[slice_name] = Sli... |
require 'pathname'
require 'cgi'
require 'rdiscount'
require_relative 'linker'
# The Helpers are 'mixed' into your {Generator::Generator generator} and therefore can be used in
# all template-views.
# If you are searching for a method and don't know, where it may be implemented i suggest the
# following inheritence... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ApplicationController, type: :controller do
it 'should redirect to profile path after login' do
@user = FactoryBot.create :user, email: 'joao@example.org'
target_uri = @controller.after_sign_in_path_for(@user)
expect(target_uri).to eq... |
require 'spec_helper'
resource "Greenplum DB: databases" do
let(:owner) { users(:owner) }
let(:owned_instance) { gpdb_instances(:owners) }
let(:database) { gpdb_databases(:default) }
let(:owner_account) { owned_instance.owner_account }
let(:id) { database.to_param }
let(:database_id) { database.to_param }
... |
# Copyright © 2011-2013, Esko Luontola <www.orfjackal.net>
# This software is released under the Apache License 2.0.
# The license text is at http://www.apache.org/licenses/LICENSE-2.0
require 'bundler'
require 'fileutils'
describe Bundler, "given no javadocs," do
before(:all) do
@testdata = 'test-data'
@s... |
class AddAvatarToBanners < ActiveRecord::Migration
def change
add_column :banners, :avatar, :string
end
end
|
require 'spec_helper'
describe Status do
it_behaves_like 'an api model'
describe 'attributes' do
it { should respond_to :overall }
it { should respond_to :services }
end
describe '#initialize' do
let(:attrs) { { overall: 'running', services: [] } }
subject { described_class.new(attrs) }
... |
require 'spec_helper'
describe Reservation do
subject(:reservation) { Reservation.new(vmt_userid, vmt_password, vmt_url) }
let(:vmt_userid) { VMT_USERID }
let(:vmt_password) { VMT_PASSWORD}
let(:vmt_url) { VMT_BASE_URL }
describe "Should be a valid VMT Object" do
it_behaves_like 'a VMT API object'
end
des... |
require 'rake'
namespace :wow do
namespace :realm do
desc "Update stored realm information from API data"
task :import => :environment do |t|
WowClient.new.update_realm_status
end
end
end
|
class WordsTest
class << self
# the main function called by the CLI
def process(in_file)
seq_hash = proc_file(in_file)
# open files
sf = File.new("sequences", "w")
wf = File.new("words", "w")
seq_hash.keys.sort.each do |seq|
sf.write(seq + "\n")
wf.write(seq_h... |
require 'rails_helper'
RSpec.describe 'registrar/contacts/form/_legal_document' do
let(:contact) { instance_spy(Depp::Contact) }
before :example do
without_partial_double_verification do
allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:depp_contact, contact, view, {}))
end
assign(:... |
$:.push File.expand_path("../lib", __FILE__)
require "guide/version"
Gem::Specification.new do |s|
s.name = "guide"
s.version = Guide::VERSION
s.authors = ["Luke Arndt", "Jordan Lewis", "Jiexin Huang"]
s.email = ["luke@arndt.io", "jordan@lewis.io", "hjx500@gmail.com"]
s.homepage = "h... |
class Room < ActiveRecord::Base
belongs_to :zone
delegate :world, to: :zone
validate :room_fits_in_zone
def try_exit(dir)
case dir
when 'north'
r1 = zone.room(zz, yy + 1, xx)
when 'south'
r1 = zone.room(zz, yy - 1, xx)
end
if r1
return r1, nil
else
return self,... |
##
# This class defines the abilities and privileges belonging to the various
# user roles.
class Ability
include CanCan::Ability
def initialize(user)
alias_action :manage, :change_state, to: :everything
user ||= User.new
roles = user.roles.map(&:value)
grant_generic_privileges(roles)
grant_e... |
# @param {Array<Integer>} nums
# @param {Integer} n
# @return {Array<Integer>}
def shuffle(nums, n)
shuffled = []
for i in 0..n-1 do
pX = i
pY = (n)+i
shuffled.push(nums[pX])
shuffled.push(nums[pY])
end
shuffled
end
puts shuffle([2,5,1,3,4,7],3) |
activity Java::org.ruboto.test_app.OptionMenuActivity
setup do |activity|
start = Time.now
loop do
@text_view = activity.findViewById(42)
break if @text_view || (Time.now - start > 60)
sleep 1
end
assert @text_view
end
test('option_menu changes text') do |activity|
assert_equal "What hath Matz w... |
class TagSerializer < ActiveModel::Serializer
attributes :id, :title
belongs_to :task
end
|
class StartupsBadges < ActiveRecord::Base
has_and_belongs_to_many :badges
has_and_belongs_to_many :startups
# Definition: This method takes the startup_id and calls different helper methods to set achieved badges.
# It then returns an array of recently achieved badges' description.
# Input: startup_id.
# O... |
class AddTypeToComboItem < ActiveRecord::Migration
def change
add_column :combo_items, :combo_type, :string
end
end
|
require "spec_helper"
describe ObservationTutorialsController do
describe "routing" do
it "routes to #index" do
get("/observation_tutorials").should route_to("observation_tutorials#index")
end
it "routes to #new" do
get("/observation_tutorials/new").should route_to("observation_tutorials#ne... |
FactoryBot.define do
factory :comments do
user
article
text { Faker::Food.description }
end
end
|
require 'byebug'
class HomeController < ApplicationController
before_action :set_script_obj
def index
@scripts = @script_obj.all
end
def search_by_isbn
@script = @script_obj.by_isbn(params[:isbn])
if @script
render :show
else
flash[:notice] = 'No matching!'
redirect_to root_... |
# frozen_string_literal: true
module Riskified
module Entities
## Reference: https://apiref.riskified.com/curl/#models-payment-details
PaypalDetails = Riskified::Entities::KeywordStruct.new(
##### Required #####
:payer_email,
:payer_status,
:payer_address_status,
:p... |
# 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class Page < ActiveRecord::Base
include ActionView::Helpers::TextHelper
has_many :navigators, as: :navigatable, dependent: :destroy
validates :name, length: { maximum: 250 }
validates :permalink, uniqueness: true, length: { maximum: 99 }
validates :title, length: { maximum: 250 }
validates :meta_descript... |
# Probably won't work as written, and is not currently needed, but useful for reference
namespace :db do
desc "Erase and fill database"
task :populate => :environment do
require 'populator'
require 'faker'
[Attempt, Question, Tag, User].each(&:delete_all)
# Create users
50.times do |i|... |
class RenameTargetHealthAttributeRatingsToHealthAssessments < ActiveRecord::Migration[5.2]
def change
rename_table :target_health_attribute_ratings, :health_attributes
end
end
|
# == Schema Information
#
# Table name: products
#
# id :integer(4) not null, primary key
# name :string(255)
# serial_number :string(255)
# date_ordered :date
# date_received :date
# date_invoiced :date
# vendor_invoice :string(255)
# scc_invoice :string(255)
# quantity ... |
####
#
# Product
#
# Product is a line item on the invoice.
#
# Invoices are created of property related information and the billed charges
# for a period. The product are these billed charges plus any arrears.
#
####
#
class Product < ApplicationRecord
include Comparable
enum payment_type: { manual: 0, automatic: ... |
require 'optparse'
require_relative 'speech'
require_relative 'version'
module Txt2Speech
class Application
def initialize
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: txt2speech [options]"
opts.on("-o", "--output [String]", String, "Output file") {|o| o... |
# vim: set expandtab ts=2 sw=2 nowrap ft=ruby ff=unix : */
require './lib/api-server/users-handler'
module ApiServer
class UsersPostHandler < UsersHandler
# Insert a new record.
def execute_insert_query(filtered_params)
table = Arel::Table.new(:users)
manager = Arel::InsertManager.new(Arel::Table... |
require 'yaml/store'
require 'pry'
class RobotWorld
attr_reader :database
def initialize(database)
@database = database
end
def create(robot)
if robot.values.all? {|value| value.empty?}
robot = fake_robot
raw_robots.insert(robot)
else
raw_robots.insert(robot)
end
end
de... |
require './lab6ex.rb'
class Leaberboard
attr_accessor :teams_points, :score_input, :game_tracker
def initialize
@game_tracker = Tracker.new
@teams_points = {}
@score_input = {}
start
end
def start
puts "Would you like to input scores (1) or see league ranking (2)?"
choice
end
def choice
response ... |
class Api::V1::SessionsController < DeviseTokenAuth::SessionsController
include NoCaching
before_action :configure_permitted_parameters
private
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_in, keys: [:format])
end
end
|
class OrdersController < ApplicationController
def create
#takes all carted products for the current user where the status is carted. Then loops through each carted product to add the price to the created subtotal varible. Then add new variables for tax and total. Create new order using all variables.... |
require 'rspec'
require 'rules/is_overtime_activity_type'
module Rules
describe IsOvertimeActivityType do
describe 'processing' do
let(:criteria) {
{
minimum_daily_hours: 0.0,
maximum_daily_hours: 0.0,
minimum_weekly_hours: 0.0,
maximum_weekly_hours:... |
#!/usr/bin/env ruby
require 'fileutils'
require 'shellwords'
require 'csv'
HEADERS = true
BUFFER_SIZE = 1024*1024*10 # 10MB, seems fast
SHELL_APPEND = ">>" # FIXME: make this work with different shells
def which(cmd)
# Thanks to http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists... |
class PersonStarship < ApplicationRecord
belongs_to :person
belongs_to :starship
end
|
require 'error_codes'
require 'tracing_service'
class ApplicationController < ActionController::Base
include HttpAcceptLanguage::AutoLocale
protect_from_forgery with: :exception, prepend: true
skip_before_action :verify_authenticity_token
before_action :configure_permitted_parameters, if: :devise_controller?... |
#
# Installs _wlang_ utility methods on Ruby String.
#
class String
# Converts the string to a wlang template
def wlang_template(dialect = "wlang/active-string", block_symbols = :braces)
WLang::template(self, dialect, block_symbols)
end
#
# Instantiates the string as a wlang template using
# a cont... |
class Message
include ActiveAttr::Model
attribute :name
attribute :email
attribute :subject
attribute :content
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }
validate... |
class User < ActiveRecord::Base
has_many :portfolios
has_secure_password
validates :name, :email, :password, presence: true
validates :password, confirmation: true
def send_password_reset
generate_token(:password_reset_token)
self.password_reset_sent_at = Time.zone.now
save!
UserMailer.password_r... |
class Insumo < ActiveRecord::Base
belongs_to :unidade
enum tipo: {
'Material': 0,
'Mão de Obra': 1,
}
has_many :composicao
has_many :servico, through: :composicao
filterrific(
default_filter_params: { sorted_by: 'descricao_desc' },
available_filters: [
:sorted_by,
:search_query,
:wi... |
module IPCrypt
class InvalidIPv4Error < Exception
def initialize(ip)
super "Invalid IPv4 address: #{ip}"
end
end
class InvalidKeyTypeError < Exception
def initialize(key, type)
super "Expected key '#{key}' to be a String, got #{type}"
end
end
class InvalidKeyBytesError < Exception
... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe 'Mongos pinning' do
require_topology :sharded
min_server_fcv '4.2'
let(:client) { authorized_client }
let(:collection) { client['mongos_pinning_spec'] }
before do
collection.create
end
context 'successful operations' ... |
class Myaccount::RefundsController < Myaccount::BaseController
include Trackings::Trackable
load_and_authorize_resource class: 'Requests::Refund'
skip_load_resource :only => [:create]
before_action :find_refund, only: [:show, :cancel]
self.trackable_resource_name= :refund
track!
def index
@refunds = curre... |
# == Schema Information
#
# Table name: questions
#
# id :bigint not null, primary key
# text :string not null
# poll_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Question < ApplicationRecord
validates ... |
require 'rss'
require_relative 'entry'
class RssItemsExtractor
def extract_items xml
rss = RSS::Parser.parse xml
[].tap do |entries|
rss.items.each do |item|
entries << Entry.new(
author: rss.channel.title,
title: item.title,
pub_date: item.pubDate,
... |
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.role == 'admin'
can :manage, :all
else
can :read, :all
can :manage, Album do |album|
album.user == user
end
can :manage, Photo do |photo|
photo.album.user == user
end
can :create, Comment
can :... |
module Methods
class Computer
def initialize(data_source = nil)
return unless data_source
@data_source = data_source
data_source.methods.grep(/^get_(.*)_info$/) { Computer.define_component $1 }
end
def self.define_component(name)
define_method(name) do
puts "I'm a #{name... |
# frozen_string_literal: true
module Piktur::Spec::Helpers
module Inheritance
STRATEGIES ||= {}
STRATEGIES[:clone] ||= lambda do |klass, anonymous: false, **options, &block|
if anonymous
klass.clone(&block)
else
Test.safe_const_reset(:Clone, klass.clone(&block))
end
e... |
module Domotics::Core
class RgbStrip < Element
def initialize(args = {})
@type = args[:type] || :rgb_strip
@strips = Hash.new
@crazy_lock = Mutex.new
@crazy_thread = nil
super
sub_args = args.dup
%w(r g b).each do |x|
sub_args[:name] = (args[:name].to_s+"_#{x}_str... |
class CreateErrors < ActiveRecord::Migration[6.0]
def change
create_table :errors do |t|
t.integer :industry_id, null: false
t.integer :own_error_id, null: false
t.integer :human_factor_id, null: false
t.integer :in_my_head_id
t.integ... |
=begin
Write a program that uses the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
The Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as composite (i.e. not prime) the multiples of each prime, start... |
module IControl::LocalLB
##
# The ProfileRTSP interface enables you to manipulate a local load balancer's RTSP
# profile.
class ProfileRTSP < IControl::Base
set_id_name "profile_names"
class ProfileRTSPStatisticEntry < IControl::Base::Struct; end
class ProfileRTSPStatistics < IControl::Base::Struc... |
Rails.application.routes.draw do
devise_for :users
get "home/read/:id", to: "home#read" , :as => :post_read
get "home/:tag/posts", to: "home#tag_search", :as=> :tag_search
get "home/category/:category_slug", to: "home#category_search", :as=> :category_search
#tag_search post_read are the alias for the route... |
# frozen_string_literal: true
module Deviseable
include ActiveSupport::Concern
protected
# :nocov:
def add_standard_error_message_if_valid(message)
message != 'StandardError' ? "Error: #{message}" : ''
end
def render_error_message(message)
Rails.logger.error message.to_json
render json: mess... |
class Blog < ActiveRecord::Base
attr_accessible :website_blog_enabled
belongs_to :website
has_many :posts
end
|
require 'ruble'
command t(:footer) do |cmd|
cmd.scope = 'source.php'
cmd.trigger = 'wpfoot'
cmd.output = :insert_as_snippet
cmd.input = :none
cmd.invoke do
items = [
{ 'title' => 'Get Footer' , 'insert' => %^get_footer(); ^},
{ 'title' => 'Footer Hook' , 'insert' => %^wp_footer(); ^},
]
... |
module Gitlab
module BitbucketImport
class KeyAdder
attr_reader :repo, :current_user, :client
def initialize(repo, current_user, access_params)
@repo, @current_user = repo, current_user
@client = Client.new(access_params[:bitbucket_access_token],
access_pa... |
class CreateTags < ActiveRecord::Migration
def change
create_table :categories_images do |t|
t.references :image
t.references :category
# t.timestamps
end
add_index :categories_images, :image_id
add_index :categories_images, :category_id
end
end
|
class ReviewsController < ApplicationController
before_action :require_user, only: [:create]
def index
@reviews = Review.recent_reviews
end
def create
business_id = params[:review][:business_id]
@business = Business.find(business_id)
@review = Review.new(review_params)
if @review.save
... |
class Category < ApplicationRecord
has_many :movie_categories
has_many :movies, :through => :movie_categories, :dependent => :destroy
end
|
# locuserspec.rb
require 'locuser/locality'
require 'active_support'
module Locuser
module SpecBase
extend ActiveSupport::Concern
included do
field :description, type: String
field :name, type: String
end
end
end
|
class Broker < ApplicationRecord
include Sidekiq::Worker
sidekiq_options retry: false
validates :siren, presence: true, allow_nil: false, :length => { :minimum => 9, :maximum => 9 }
validates_uniqueness_of :siren
scope :with_localisation, -> { where('latitude is not null') }
end
|
#Right now using this so we can call the solr index directly as it sits on a different port
# Also utilizing this to make calls to the forestecoservices site but that will eventually get routed differently
# when code is moved
class DataProductProxyController < ApplicationController
#Need to include below to enable ... |
class Api::V1::FriendablesController < Api::V1::BaseController
def index
friend_requests = current_user.friend_requests
render json: friend_requests, status: 201, root: false
end
def show
render json: Friendable.where(id: params[:id]), status: 201, root: false
end
end |
require 'socket'
Dir.glob('lib/**/*.rb').each do |file|
require file
end
module WebServer
class Server
attr_reader :options
DEFAULT_PORT = 2468
def initialize(options={})
@options = options
@options[:echo] = true
httpd_file = File.open('config/httpd.conf', 'rb')
mime_file = F... |
class PaymentsController < ApplicationController
before_action :set_payments, only: [:new, :create, :edit, :update]
before_filter :authenticate_user!
def new
end
def create
begin
plan = @plans.find(params[:plan_id])
@account.plan = plan
customer = Stripe::Customer.create(email: current... |
RSpec.describe "Static pages" do
it "renders contribute" do
visit contribute_path
expect(page).to have_current_path(contribute_path)
expect(page.status_code).to be 200
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec::Matchers.define :a_partial_iteration_at_index do |index|
match do |actual|
actual.instance_of?(::ActionView::PartialIteration) && actual.index == index
end
end
RSpec.describe Components::Rails::Component do
subject { described_class.new(nil, :view... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'linkshare_coupon_api/version'
Gem::Specification.new do |spec|
spec.name = "linkshare_coupon_api"
spec.version = LinkshareCouponApi::VERSION
spec.authors = ["Kirk Jarvi... |
class NextBusInterface
NB_ROUTE_LIST = 'http://webservices.nextbus.com/service/publicXMLFeed?command=routeList'
attr_reader :data, :agency_name
def initialize name:, fast_debug: false
@agency_name = name
@data = Hash.new
@fast_debug = fast_debug
@nb = {
route_list: 'http://webservices.next... |
require 'rails_helper'
RSpec.describe ChoiceCategory, type: :model do
before { @model = FactoryGirl.build(:choice_category) }
subject { @model }
it { should respond_to(:name) }
it { should respond_to(:description) }
it { should respond_to(:id) }
it { should be_valid }
it { should have_many(:choices) ... |
require 'spec_helper'
describe UsersController do
before (:each) do
@user = FactoryGirl.create(:user)
sign_in @user
end
describe "Get Pages" do
render_views
describe "GET 'new'" do
it "should be successful" do
get :new
response.should be_success
response.should ren... |
require 'rails_helper'
feature "parking", :type => :feature do
scenario "guest parking" do
# step 1 打开首页
visit "/"
# 存下测试当时html页面供后续排查
# save_and_open_page
# 检查打开html页面
expect(page).to have_content("一般计费")
# step 2 点击开始计费按钮
click_button "开始计费"
# step 3 点击结束计费按钮
click_butto... |
json.array!(@attachments) do |attachment|
json.extract! attachment, :id, :url, :resource_id, :resource_type
json.url attachment_url(attachment, format: :json)
end
|
require 'scripts/entity_system/component'
module Components
class Team < Base
register :team
field :number, type: Integer, default: Enum::Team::NEUTRAL
end
end
|
RSpec.describe Evil::Client::Middleware::StringifyJson do
def update!(result)
@result = result
end
let(:app) { double :app }
before { allow(app).to receive(:call) { |env| update!(env) } }
subject { described_class.new(app).call(env) }
context "with a body:" do
let(:env) { { format: "json", body:... |
class Doctor::ConsultsController < ApplicationController
layout "doctor_layout"
before_filter :require_doctor_signin
before_filter :set_cache_headers
before_filter(:only => [:show, :edit_after_consult, :finish]) { |c| c.require_right_doctor Consult.find(params[:id]) }
before_filter(:only => [:show]) { |c| c.d... |
class Politician < ActiveRecord::Base
validates_uniqueness_of :pid
end |
require 'spec_helper'
describe ProjectHistoriesController do
let!(:project_type) { FactoryGirl.create(:project_type) }
let(:consultant) { FactoryGirl.create(:confirmed_consultant, :wicked_finish) }
let(:position) { FactoryGirl.create(:position) }
let(:phone) { FactoryGirl.attributes_for(:phone, phone_type_id: ... |
require 'rubygems'
require 'sinatra'
require 'boxr'
require 'awesome_print'
require 'ap'
require 'dotenv'; Dotenv.load(".env")
require 'logger'
require 'dalli'
# initialize memcache
set :cache, $cache = Dalli::Client.new(ENV["MEMCACHIER_SERVERS"],
{:username => ENV["MEMCACHIER_USERNAME"],
... |
module Events
module EventNaming
extend self
def create_handler_name(event_or_event_name)
return create_handler_name_from_name(event_or_event_name.to_s) if [String, Symbol].include?(event_or_event_name.class)
event_name = create_event_name_from_event(event_or_event_name)
return create_hand... |
class DesignationProfile < ApplicationRecord
belongs_to :designation_account
belongs_to :member
def name
"#{designation_account.name} | #{member.name}"
end
end
|
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe 'Auto Encryption' do
require_libmongocrypt
require_enterprise
min_server_fcv '4.2'
# Diagnostics of leaked background threads only, these tests do not
# actually require a clean slate. https://jira.mongodb.org/browse/RUBY-2138
... |
source 'https://rubygems.org'
ruby '2.2.0'
gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
# Front-end framework
gem 'foundation-rails'
# Access to the MailChimp API
gem 'gibbon'
# Use Google Drive s... |
module ScorchedEarth
class Player
attr_reader :x, :y
def initialize(x, y)
@x = x
@y = y
freeze
end
end
end
|
class PostsController < ApplicationController
before_filter :authenticate_user!
before_filter :load_community
def create
@post = @community.posts.new(post_params)
@post.user = current_user
@post.save
end
private
def load_community
@community = Community.find(params[:community_id])
end
... |
class Flight < Flight.superclass
module Cell
# A `<span>` that has a little pic of plane and says where the flight is from
# and to.
#
# @!method self.call(model, opts = {})
# @param model [Flight]
class Summary < Abroaders::Cell::Base
property :id
def show
content_tag(:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.