text stringlengths 10 2.61M |
|---|
require "spec_helper"
def process_job(worker)
worker.work_one_job(worker.reserve)
end
RSpec.describe Sentry::Resque do
before do
perform_basic_setup
end
class FailedJob
def self.perform
1/0
end
end
class TaggedFailedJob
def self.perform
Sentry.set_tags(number: 1)
1/0
... |
#references
require "pp"
system "clear"
def line_dec
print "\n"
print "*********************************************************\n"
print "\n"
end
def change_string(a)
a.replace("this is a new string")
end
s = "this is original"
print "\n"
puts "this is the value of s now: "
puts s
print "\n"
puts... |
# 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... |
module AbTesting
class ReactiveConsoleReader
def initialize(labels)
@labels = labels
end
def get_label
puts "Enter label"
while raw_label = gets
label = raw_label.chomp
return label if @labels.include?(label)
end
end
end
end
|
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
# Uncomment to autoload libs every request in development (by default — only on server startup)
before_filt... |
require 'rails_helper'
feature 'reviewing' do
before {Restaurant.create name: 'Burger King'}
def add_review
visit '/restaurants'
click_link 'Review Burger King'
fill_in "Thoughts", with: "so so"
select '3', from: 'Rating'
click_button 'Leave Review'
end
def sign_up
visit('/')
clic... |
require 'rails_helper'
RSpec.describe ApplicationController, type: :controller do
describe "#current_user" do
let!(:user) { create :admin_user }
context "when signed in" do
it "returns the currently signed in user" do
session[:user_id] = user.id
expect(subject.current_user).to eq use... |
require 'spec_helper'
describe Cheer do
it {should belong_to(:user)}
it {should belong_to(:goal)}
it {should_not allow_value(0).for(:delta)}
it {should_not allow_value(2).for(:delta)}
it {should_not allow_value(-2).for(:delta)}
it {should allow_value(1).for(:delta)}
it {should allow_value(-1).for(:del... |
class Accompaniment < Experienceable
validates :subject, presence: true
def name
subject
end
def show_fields
[
{name: :subject, type: :text_field, options: {autofocus: true}},
{name: :accompaniable_type, type: :hidden_field, options: {}},
{name: :accompaniable_id, type: ... |
Given /^I am an administrator$/ do
@user.admin = true
@user.save!
end
Given /^I am an user$/ do
end
Given /^I have an user called "([^"]*)"$/ do |firstname|
email = Factory.next(:email)
username = Factory.next(:username)
Factory(:user,
:firstname => firstname,
:email => email,
... |
class EventsController < ApplicationController
def new
@event = Event.new
authorize @event
end
def create
@event = Event.new(event_params)
authorize @event
@event.agenda = current_user.agenda
if @event.save
flash[:notice] = "Votre rappel a bien été enregistré."
redirect_to age... |
module UsersHelper
def user_status status
case status
when User::STATUS[0]
css_class = 'label-default'
when User::STATUS[1]
css_class = 'label-success'
when User::STATUS[2]
css_class = 'label-important'
end
content_tag 'span', status.capitalize, class: "label #{css_clas... |
# frozen_string_literal: true
# rubocop:todo all
require_relative './performs_legacy_retries'
module SupportsLegacyRetries
shared_examples 'it supports legacy retries' do
context 'when server does not support modern retries' do
before do
allow_any_instance_of(Mongo::Server).to receive(:retry_write... |
# Inspired from https://github.com/marks/RubyScriptPageLoad
require 'json'
require 'open-uri'
class PageWeight
PHANTOMJS_BIN = `which phantomjs`.chop
YSLOW_COMMAND = "./js/yslow.js --info all "
attr_accessor :url
def initialize(url)
@url = url
end
def calculate
yslow_command = "#{PHANTOMJS_BIN}... |
module Closeio
class Client
module IntegrationLink
def list_integration_links
get(integration_link_path)
end
def find_integration_link(id)
get("#{integration_link_path}#{id}/")
end
def create_integration_link(options = {})
post(integration_link_path, options... |
require 'rails_helper'
describe Community do
it 'must have a name' do
community = Community.new
expect(community.valid?).to eq false
end
it 'must have a post_code' do
community = Community.new(name: 'Running team')
expect(community.valid?).to eq false
end
end
|
class CreateProjectDetails < ActiveRecord::Migration[5.2]
def change
create_table :project_details do |t|
t.integer :project_id
t.integer :requirement_id
t.text :desc
t.timestamps
end
end
end
|
module ApplicationHelper
include Pagy::Frontend
def title page
if page.blank?
I18n.t(".base")
else
I18n.t(".base") << " | " << page
end
end
end
|
class ParseCashJob < Struct.new(:attach_id)
def perform
CashFiles.find(attach_id).parse_data
end
end |
shared_examples "column_method" do |mod, expectation={}|
context "when module included before and after #column call" do
let(:row_model_class) { Class.new }
before do
row_model_class.send(:include, CsvRowModel::Model)
row_model_class.send(:column, :string1)
row_model_class.send(:include, mod... |
module SchedyHelper
##INFO:
##USED IN: scheduler-server:task_procedures/task.rb - to get list of robot tests for task creation
def self.parse_robot_tests_list(test_package_name,options=nil)
robot_parser_script =
['python2 '+SCHEDULER_SERVER_ROOT,'project','creator','suite_parser.py'].join('/')
robot_file_p... |
class ChangeColumnToReviews < ActiveRecord::Migration[5.2]
def change
change_column :reviews, :rate, :float, default: 0
add_reference :reviews, :product, foreign_key: true
add_reference :reviews, :user, foreign_key: true
end
end
|
require 'pry'
require 'benchmark'
# @param {Character[][]} board
# @return {Boolean}
def is_valid_sudoku(board)
hash_indexes = {}
board.each do |board_line|
board_line.each_with_index do |board_item, index|
key = board_item.to_i
if hash_indexes.key?(key) && hash_indexes[key] == index
... |
# == Schema Information
#
# Table name: attribution_companies
#
# id :integer not null, primary key
# name :string
# cusip :string
# ticker :string
# code_id :integer
# effective_on :date
# created_at :datetime not null
# updated_at :datetime not ... |
module API
module V1
class Structures < Grape::API
include API::V1::Defaults
resource :structures do
desc "Return all structures"
get "" do
Structure.all
end
desc "Return all pharmacies"
get "/pharmacies" do
type = Str... |
class CartsController < ApplicationController
before_action :authorize, only: [:show, :add]
def show
@products = Product.all
end
def add # adds product to shopping cart
productid = params[:product_id]
line_item = current_customer.cart.line_items.find_by(product_id: productid)
if line_item
... |
require 'test_helper'
require 'generators/ember/view_generator'
class ViewGeneratorTest < Rails::Generators::TestCase
include GeneratorTestSupport
tests Ember::Generators::ViewGenerator
destination File.join(Rails.root, "tmp", "generator_test_output")
setup :prepare_destination
test "create view with temp... |
class Admin::EventsController < AdminController
before_filter :load_event, :except => [ :index, :new, :create ]
def index
@events = Event.all :include => :page
end
def new
@event = Event.new
end
def create
@event = Event.new params[:event]
if @event.save
flash[:notice] = 'Event wa... |
require 'formula'
class SwishE < Formula
homepage 'http://swish-e.org/'
url 'http://swish-e.org/distribution/swish-e-2.4.7.tar.gz'
sha1 '0970c5f8dcb2f12130b38a9fc7dd99c2f2d7ebcb'
depends_on 'libxml2'
def install
system "./configure", "--prefix=#{prefix}", "--mandir=#{man}"
system "make install"
e... |
require 'test/unit'
require './game/logic'
require './game/match'
require './interface/renderer'
class LogicTest < Test::Unit::TestCase
# Called before every test method runs. Can be used
# to set up fixture information.
def setup
@renderer = Renderer.new
end
# Called after every test method runs. Can ... |
class AddUserInfoForInstrumentDetail < ActiveRecord::Migration[5.2]
def change
add_column :users, :rating, :integer
add_column :users, :location, :string
add_column :users, :joined, :string
add_column :users, :maker, :boolean, default: false
end
end
|
require_relative "../spec_helper"
require_relative "../../../libraries/resource_bashrc"
describe Chef::Resource::Bashrc do
let(:resource_name) { "betta" }
it "sets the default attribute to user" do
expect(resource.user).to eq("betta")
end
it "action defaults to :install" do
expect(resource.action).t... |
class AddNetUsersPerHundredPeopleToYears < ActiveRecord::Migration
def change
add_column :years, :net_users_per_hundred_people, :decimal
end
end
|
class MessagesController < ApplicationController
before_filter :require_current_user!
respond_to :json, :html
def outgoing #do this in a transaction??
imply_sender
@message = Message.new(params[:message])
@message.flags.build(user_id: current_user.id)
if @message.save
Abemailer.outgoi... |
module GhBbAudit
class OutputWriter
def initialize(path_to_file)
@fhandle = File.open(path_to_file, 'w+')
end
def repo_name_matched(repo_name,user_name,repo_source)
@fhandle.puts("")
@fhandle.puts("#{repo_source}:: The name of REPO:#{repo_name} for USER:#{user_name} matches keywords")
... |
# gen_db.rb -- drops and creates a postgresql database from the commandline dropdb/createdb commands.
require_relative 'db_access'
module Gen
module DB
def self.create(config)
puts "Gen::DB.create: #{config.name}."
db = DBAccess.connection_from_config_use_postgres_db(config)
sql = "create datab... |
class Photo
attr_reader :image_url,
:location,
:credit
def initialize(photo_data, city)
@image_url = photo_data[:urls]['full']
@location = city
@credit = {author: photo_data[:user]['username'],
author_url: photo_data[:user]['links']['self'],
so... |
# frozen_string_literal: true
require 'base64'
require 'json'
require 'zlib'
require "raven/transports"
module Raven
# Encodes events and sends them to the Sentry server.
class Client
PROTOCOL_VERSION = '5'
USER_AGENT = "raven-ruby/#{Raven::VERSION}"
CONTENT_TYPE = 'application/json'
attr_access... |
class TemplateTasksController < ApplicationController
# GET /template_tasks
# GET /template_tasks.xml
def index
@template_tasks = TemplateTask.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @template_tasks }
end
end
# GET /template_tasks/1
# GE... |
# frozen_string_literal: true
require 'spec_helper'
require_relative 'support/cache'
RSpec.describe Register do
subject(:c) { Cache }
before do
Cache.send(:store).clear
# Various ways of calling #register
Cache.register :planetary, CacheStore.new(:saturn)
Cache << %i[number].push(Math::PI)
Ca... |
# coding: utf-8
require 'mechanize'
require 'logger'
class Mechanize
def print_cookies logger
self.cookie_jar.each do |cookie|
logger.debug cookie.to_s
end
end
end
class InpiScrapper
def initialize
init_logger
init_urls
init_folders
init_agent
init_institutions
end
def... |
class Block
def initialize(options = {})
@client = options[:client] ? options[:client] : Mongo::Client.new(["127.0.0.1:27017"], database: "block")
end
def add(data)
block = {
data: data
}
@client[:blocks].insert_one(block).inserted_ids.first
end
def find_all
@client[:blocks].fin... |
class RentalAddColumns < ActiveRecord::Migration[6.0]
def change
add_column :rentals, :customer_id, :bigint
add_column :rentals, :video_id, :bigint
add_index :rentals, :customer_id
add_index :rentals, :video_id
end
end
|
class Movie < ApplicationRecord
belongs_to :videoble, polymorphic: true
mount_uploader :video, VideoUploader
end
|
require 'fib'
describe FibNumber do
before(:each) do
@fib = FibNumber.new
end
it 'Should return 55 at 10th position of fibonacci' do
expect(@fib.the_fib(10)).to eq(55)
end
it 'Should only contain even numbers' do
expect(@fib.even_fib_arr).to all(be_even)
end
it 'Should equal 44 when even n... |
class SpiderService
HOST = AcmUnionApi::ACM_SPIDER_CONF['host']
PORT = AcmUnionApi::ACM_SPIDER_CONF['port']
API_ROOT = "http://#{HOST}:#{PORT}"
class << self
def get_open_spider_workers
begin
HTTP.get("#{API_ROOT}/api/spider/workers").parse
rescue => err
raise "请求 get_open_spi... |
class ConverterWhisperer
attr_accessor :source_file, :output_folder, :type, :quality
def initialize
@source_file = nil
@output_folder = nil
@type = nil
@quality = nil
end
def convert
system(build_command)
end
def build_command
file_name = extract_file_name
add_righthand_... |
#
# Author:: Noah Kantrowitz <noah@opscode.com>
# Cookbook Name:: postgresql
# Library:: default
#
# Copyright:: 2011, Opscode, Inc <legal@opscode.com>
#
# 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 Li... |
# encoding: utf-8
require 'spec_helper'
describe TTY::Table::Operation::Truncation, '#call' do
let(:object) { described_class.new column_widths }
let(:text) { '太丸ゴシック体' }
let(:field) { TTY::Table::Field.new(text) }
context 'without column width' do
let(:column_widths) { [] }
it "truncates string"... |
class CreateDiscountTypePeriods < ActiveRecord::Migration[5.0]
def change
create_table :discount_type_periods do |t|
t.datetime :start_date, null: false
t.datetime :end_date, null: false
t.belongs_to :discount_type, foreign_key: true, null: false... |
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... |
class AddColumnCategoryIdToCategories < ActiveRecord::Migration
def change
add_reference :categories, :category, index: true, foreign_key: true, after: :id
end
end
|
Gem::Specification.new do |s|
s.name = 'betterment-8949'
s.version = '0.0.1'
s.date = '2019-03-23'
s.summary = 'A tool to parse betterment 1099 CSV files and fill in IRS form 8949'
s.description = 'A tool to parse betterment 1099 CSV files and fill in IRS form 8949'
s.authors = ['M... |
class CompaniesController < ApplicationController
before_action :redirect_signed_in_photographer, only: :new
def new
@company = Company.new
@company.photographers.build
end
def show
@company = Company.find(params[:id])
@locations = @company.locations
@photographers = @company.phot... |
require "employee"
class Startup
attr_reader :name, :funding, :salaries, :employees
def initialize(name, funding, salaries)
@name = name
@funding = funding
@salaries = salaries
@employees = []
end
def valid_title?(title)
@salaries.has_key?(title)
e... |
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "WaznooDeals! | ... |
# Standardized exception handling methods for API controllers. Typically used by
# `rescue_from` directives.
module Api::Concerns::ErrorResponses
extend ActiveSupport::Concern
included do
rescue_from Exception, with: :server_error # Catchall
rescue_from ActionController::ParameterMissing, with: :bad_reques... |
require 'rails_helper'
RSpec.describe Book, type: :model do
it 'has a valid factory' do
expect(build(:book)).to be_valid
end
let(:user) { create(:user) }
let(:attributes) do
{
title: 'Harry Potter',
user: user
}
end
let(:book) { create(:book, **attributes) }
describe 'model... |
require 'test_helper'
class MemberTest < UnitTest
describe "a member" do
it "should save valid member data" do
member = create(:member)
member.save.must_equal true
end
it "fails to save a member without a phone number" do
member = create(:member)
member.cell_phone = nil
m... |
class Admin::LocationsController < AdminController
respond_to :html, :json
before_filter :find_location, :only => [:edit, :update, :destroy]
def index
@location = Location.all
respond_with @location
end
def new
@location = Location.new
end
def create
@location = Location.new(location_pa... |
class StoreController < ApplicationController
skip_before_filter :authorize
def index
@cart = current_cart
@popular_products = Product.popular.limit(4)
@last_products = Product.latest.limit(4)
@latest_posts = Post.latest.limit(3)
end
end
|
class CreateSlides < ActiveRecord::Migration
def change
create_table :slides do |t|
t.timestamps null: false
t.datetime :deleted_at, index: true
t.belongs_to :presentation, index: true
t.integer :sequence
t.string :picture
t.boolean :picture_processing, default: false
t.... |
module RubyPushNotifications
module WNS
describe WNSNotification do
let(:device_urls) { %w(a b c) }
let(:raw_data) { { message: { title: 'Title', message: 'Hello WNS World!'} } }
let(:raw_notification) { build :wns_notification, data: raw_data }
let(:toast_data) { { title: 'Title', message... |
class ApartmentsController < ApplicationController
helper_method :sort_column, :sort_direction, :sort_pending_payment_column, :sort_movement_column, :sort_user_column
before_action :logged_in_user
before_action :apartment_getter, except: [:index, :new, :create]
before_action :permissions, except: [:index, :show... |
class RemoveLoginFromCaseinAdminUsers < ActiveRecord::Migration
def change
remove_column :casein_admin_users, :login, :string
end
end
|
require "spec_helper"
describe ORS::Commands::Runner do
context "#run" do
before do
ORS.config[:name] = 'abc/growhealthy'
ORS.config[:environment] = 'production'
end
it "should require 'ruby code'" do
lambda {subject.setup; subject.execute}.should raise_error
end
it "should b... |
class CardHolderPresenter
def initialize(player)
@player = player
end
def show_cards
(@player.cards.map { |card| "#{card.face}#{card.suit}" }).join(' ')
end
end
|
class Admin::ReportsController < ApplicationController
before_action :require_root
TIME_ZONE_HOUR = 7
def index
end
def show
report_id = params[:id]
# time = Time.now.utc.utc_offset - Time.now.in_time_zone("Hanoi").utc_offset
time_utc = Time.now.utc
time = Time.new(time_utc.year, time_utc.... |
#
# Cookbook:: bender_is_great
# Attibutes:: default
#
default['bender_is_great'].tap do |bender|
bender['user'] = 'root'
bender['group'] = 'root'
bender['system_user'] = true
# bender.html
bender['author'] = 'Patrick Dayton'
bender['html_title'] = 'Bender is Great!'
bender['image_url'] = 'http://www.re... |
class FilmActor < ActiveRecord::Base
belongs_to :film
belongs_to :actor
end |
class EventsController < ApplicationController
def index
events = Event.all.sort_by {|event| event.created_at}.reverse.first(12)
render json: events, include: :game
end
def show
event = Event.find(params[:id])
render json: event, include: [:game, :host, :attendees]
end
def create
event = Event.new(even... |
# Add it up!
# Complete each step below according to the challenge directions and
# include it in this file. Also make sure everything that isn't code
# is commented in the file.
# I worked on this challenge with Benjamin Shpringer.
# 0. total Pseudocode
# make sure all pseudocode is commented out!
# Input: An arra... |
require "spec_helper"
describe AnsiChameleon::TextRenderer do
let(:style_sheet_handler) { stub(:style_sheet_handler, :tag_names => tag_names) }
let(:tag_names) { [] }
describe "each instance" do
let(:style_sheet) { stub(:style_sheet) }
let(:text_rendering) { stub(:text_rendering, :push_opening_tag => n... |
class Article < ActiveRecord::Base
is_impressionable
##############################
# VALIDATIONS
##############################
validates :title, presence: true
validates :text, presence: true
validates :description, presence: true
##############################
# SCOPES
##########... |
class Competition < ActiveRecord::Base
belongs_to :user
validates_presence_of :name
validates_presence_of :user_id
validates_presence_of :email
end
|
class Specinfra::Command::Linux::Base::Selinux < Specinfra::Command::Base::Selinux
class << self
def check_has_mode(mode)
cmd = ""
cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled"
cmd += "getenforce | grep -i -- #{escape(mode)} "
cmd += "&& grep -i -- ^SELINUX=#{escape(mo... |
module Ricer::Plugins::Todo
class Take < Ricer::Plugin
trigger_is 'todo take'
has_usage '<id>'
def execute(id)
take_entry(Model::Entry.find(id))
end
has_usage :take_by_text, '<text>'
def take_by_text(description)
take_entry(Model::Entry.search(description).first)
end
... |
class Api::V1::VideosController < ApplicationController
#! skipping just for testing purposes, please delete after
skip_before_action :authorized
def index
videos = Video.all
render json: videos
end
def show
video = Video.find_by(id: params[:id])
render json: video
... |
class AddSpecialEvents < ActiveRecord::Migration
def self.up
add_column :rsvp_invites, :specialEventsVisible, :boolean
add_column :places, :specialEvent, :boolean
Place.find(:all).each do |p|
p.update_attribute :specialEvent, false
end
RsvpInvite.find(:all).each do |p|
p.... |
# Copyright © 2011-2019 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this l... |
require_relative 'basic_cpu'
class Motherboard
attr_accessor :cpu
attr_accessor :memory_size
def initialize(cpu = BasicCpu.new, memory_size = 1000)
@cpu = cpu
@memory_size = memory_size
end
end
|
#----------------------------------------------------
#
# Script Name: RubyJoke.rb
# Version: 1.0
# Author Prabhash Rathore
# Date: April 1, 2015
#
# Description: This Ruby script tells a series of 5 humorous jokes.
#
#----------------------------------------------------------
class Screen
def cls #Define a method h... |
class Video < ActiveRecord::Base
belongs_to :user
validates :title, uniqueness: { scope: :user_id, message: "of this video already recorded for user"}
end
|
require 'spec_helper'
require_relative '../../app/models/craving'
module LunchZone
describe 'craving' do
let(:date) { Date.today }
let(:craving) { Craving.create(:date => date) }
let(:user) { User.create(:nickname => 'hungryguy',
:email => 'a@example.com'... |
class AddCustomerLabels < ActiveRecord::Migration
def self.up
create_table 'labels', :force => true do |t|
t.string :name
end
create_table 'customers_labels', :id => false, :force => true do |t|
t.references :customer
t.references :label
end
end
def self.down
drop_table 'cus... |
require 'test_helper'
class CompetencyTest < ActiveSupport::TestCase
# Test Relationships
should have_many(:indicators)
# Basic Validations
should validate_presence_of(:name)
should validate_presence_of(:description)
should allow_value("Communication").for(:name)
should_not allow_value("").for(:name)
... |
class ChoiceCategory < ActiveRecord::Base
has_many :choices
validates_presence_of :name
validates_uniqueness_of :name
end
|
class Api::V1::PdfController < ApplicationController
# GET /map
def index
pdf_filename = File.join(Rails.root, "app/assets/pdfs/SpartaHack-Map.pdf")
send_file(pdf_filename, :filename => "SpartaHack-Map.pdf", :type => "application/pdf")
end
# GET /map/dark
def dark
pdf_filename = File.join(Rails.... |
#Пользователь вводит поочередно название товара, цену за единицу и кол-во купленного товара (может быть нецелым числом). Пользователь может ввести произвольное кол-во товаров до тех пор, пока не введет "стоп" в качестве названия товара.
# На основе введенных данных требуетеся:
# Заполнить и вывести на экран хеш, ключам... |
require 'json'
require 'rack/test'
require 'sinatra'
require 'server_api'
RSpec.describe "Server API" do
include Rack::Test::Methods
def app
Sinatra::Application
end
describe "POST /updates" do
it "accepts new update request" do
post '/updates', 'http://localhost:1234/PACKAGES'
expect(l... |
# frozen_string_literal: true
require 'spec_helper'
describe Dotloop::Contact do
let(:client) { Dotloop::Client.new(access_token: SecureRandom.uuid) }
subject(:dotloop_contact) { Dotloop::Contact.new(client: client) }
describe '#initialize' do
it 'exist' do
expect(dotloop_contact).to_not be_nil
e... |
class Student <ApplicationRecord
has_many :professor_students
has_many :professors, through: :professor_students, class_name: 'Professor'
validates_presence_of :name, :age, :house
def professor_count
self.professors.count
end
end
|
module WsdlMapper
module Naming
# Represents a name of a ruby property, consisting of its instance
# variable and its accessors (attribute).
class PropertyName
attr_reader :attr_name, :var_name
# @param [String] attr_name Name for the attribute accessors
# @param [String] var_name Name ... |
#
# Cookbook Name:: appfirst
# Recipe:: default
#
# Copyright 2012, Yipit.com
#
# All rights reserved - Do Not Redistribute
#
appfirst_download = "http://#{node['appfirst']['appfirst_frontend_url']}/#{node['appfirst']['appfirst_account_id']}/#{node['appfirst']['package']}"
appfirst_package = "#{node['appfirst']['tmp_f... |
class Order < ApplicationRecord
validates :amount, presence: true, numericality: {greater_than: 0}
validates :customer_name, presence: true
validates :customer_email, presence: true
end
|
maps_by_type = {
assault: ['Hanamura', 'Temple of Anubis', 'Volskaya Industries', 'Horizon Lunar Colony'],
escort: ['Dorado', 'Route 66', 'Watchpoint: Gibraltar', 'Junkertown', 'Rialto'],
hybrid: ['Eichenwalde', 'Hollywood', "King's Row", 'Numbani', 'Blizzard World'],
control: ['Ilios', 'Lijiang Tower', 'Nepal'... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
def after_sign_in_path_for(resource_or_scope)
provider = Provider.find_by(user_id: current_user.id)
if... |
class Proxy < ActiveRecord::Base
def self.get_proxy
@proxy = Proxy.where(activated:true).order(:updated_at).first
@proxy.touch if @proxy
return @proxy
end
end
|
# Homepage (Root path)
helpers do
def enforce_login
unless session[:username]
redirect '/login'
end
end
# def login?
# if session[:username].nil?
# redirect '/login'
# else
# true
# end
# end
# def username
# return session[:username]
# end
end
get '/' do
erb :i... |
require "formula"
class Wrk < Formula
homepage "https://github.com/wg/wrk"
url "https://github.com/wg/wrk/archive/3.1.1.tar.gz"
sha1 "7cea5d12dc5076fed1a1c730bd3e6eba832a8f61"
head "https://github.com/wg/wrk.git"
revision 1
bottle do
cellar :any
revision 1
sha1 "034ed6c6991064d72aabadec117cedc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.