text stringlengths 10 2.61M |
|---|
# -*- coding: utf-8 -*-
require 'mechanize'
require 'csv'
module Hellowork
class Core
cattr_accessor :start_page_url, :request_interval
def initialize(params={})
config = params.merge({
start_page_url: 'https://www.hellowork.go.jp/servicef/130020.do?action=initDisp&screenId=130020',
re... |
# create_table "book_items", force: :cascade do |t|
# t.integer "shelf_id"
# t.integer "book_id"
# t.integer "quantity"
# t.integer "available_count"
# t.datetime "created_at", null: false
# t.datetime "updated_at", null: false
# t.index ["book_id"], name: "index_book_items_on_book_id", usin... |
require 'nenv/builder'
RSpec.describe Nenv::Builder do
describe '#build' do
before do
allow(ENV).to receive(:[]).with('FOO')
end
it 'returns a class with the given methods' do
FooEnv = Nenv::Builder.build do
create_method(:foo?)
end
FooEnv.new.foo?
end
context 'w... |
require 'rubygems' if RUBY_VERSION < "1.9"
require 'sinatra/base'
require 'erb'
require 'pry'
PREAMBLE_FOR_GRAPHICS = "\\newif\\ifpdf
\\ifx\\pdfoutput\\undefined
\\pdffalse
\\else
\\pdfoutput=1
\\pdftrue
\\fi
\\ifpdf
\\usepackage{graphicx}
\\usepackage{epstopdf}
\\DeclareGraphicsRule{.eps}{pdf}{.pdf}{... |
require './lib/fizz_buzz/noizer'
module FizzBuzz
class Buzzer < Noizer
def initialize number=1, rule=nil, message="Buzz"
rule ||= lambda{|n| n % 3 == 0}
super number,rule, message
end
def message_for number
@number = number
message
end
end
end
|
require File.dirname(__FILE__) + '/../spec_helper'
describe PrefectosController do
describe "handling GET /prefectos" do
before(:each) do
@prefecto = mock_model(Prefecto)
Prefecto.stub!(:find).and_return([@prefecto])
end
def do_get
get :index
end
it "should be successful"... |
require 'spec_helper'
describe Fn::Salesforce::Transaction do
let(:client) { double("Client") }
let(:plan) { double("Plan") }
let(:logger) { Logger.new(nil) }
context '#initialize' do
let(:transaction) { described_class.new(client, plan) }
context '#plan' do
subject { transaction.plan }
... |
##### FAKEARRAY SPEC
require './FakeArray.rb'
describe "FakeArray" do
it "should create a new object" do
test = FakeArray.new
expect(test).to be_a(FakeArray)
end
end |
class FontImWritingNerdFont < Formula
version "2.3.3"
sha256 "e2bc697900b7b66f34e5a3e4fe0b8b93193b2ccfdf34937afd855e0c8d447d05"
url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/iA-Writer.zip"
desc "IMWriting Nerd Font families (iA Writer)"
desc "Developer targeted fonts with a high n... |
class Location < ApplicationRecord
validates :name, :latitude, :longitude, presence: true
validates :name, uniqueness: true
validate :timezone_exists, unless: 'time_zone.blank?'
private
def timezone_exists
if ActiveSupport::TimeZone[time_zone].blank?
errors.add(:time_zone, "Incorrect name, use one... |
class Edge < ApplicationRecord
validates :src_id, presence: true
validates :dest_id, presence: true
validates :cost, presence: true
has_and_belongs_to_many :stations
end
|
require "application_system_test_case"
class SpotsTest < ApplicationSystemTestCase
setup do
@spot = spots(:one)
end
test "visiting the index" do
visit spots_url
assert_selector "h1", text: "Spots"
end
test "creating a Spot" do
visit spots_url
click_on "New Spot"
fill_in "Descriptio... |
# 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 UserSerializer < ActiveModel::Serializer
attributes :id, :username
# Using the AR macros tells the UserSerializer to call on the OrderSerializer
has_many :orders
end
|
require_relative "weather"
class Airport
include Weather
CAPACITY = 20
def initialize(planes = [])
@planes = planes
end
def has_plane?
@planes.any?
end
def full?
@planes.count >= CAPACITY
end
# allow landing sounds like a question.
def allow_landing(plane)
raise "This Airport is full" if full?
... |
class ChangeNameInListsToCuisine < ActiveRecord::Migration
def self.up
rename_column :lists, :name, :cuisine
end
def self.down
rename_column :lists, :cuisine, :name
end
end
|
class ApplicationController < ActionController::API
# protect_from_forgery with: :exception
helper_method :current_user, :log_in, :logged_in?
def current_user
@current_user ||= Family.find_by(id: session[:user_id])
end
def log_in family
session[:user_id] = family.id
end
def logged_in?
!!curr... |
require 'sumac'
# make sure it exists
describe Sumac::Objects::Reference::Scheduler do
# will will test by setting it to all possible states and sending all possible (valid) directives for each state
# states (chronological order):
# tentative
# active
# forget_initiated
# stale
# directives (... |
require 'json'
require 'date'
class Runner
def initialize(input_file)
data = JSON.parse(File.read(input_file))
@cars = data['cars']
@rentals = data['rentals'].map do |rental|
Rental.new(
rental['id'],
@cars,
rental['car_id'],
rental['start_date'],
rental['end... |
require 'rails_helper'
RSpec.describe FacilitiesManagement::Upload, type: :model do
describe 'create' do
let(:supplier_name) { Faker::Name.unique.name }
let(:supplier_id) { SecureRandom.uuid }
let(:contact_name) { Faker::Name.unique.name }
let(:contact_email) { Faker::Internet.unique.email }
let(... |
module Ruby
module HL7
VERSION = "0.5.1"
def self.ParserConfig
@parser_cfg ||= { :empty_segment_is_error => true }
end
end
end
|
class LoginController < ApplicationController
def create
if user = User.find_by(:username => params[:username]).try(:authenticate , params[:password])
session[:user_id] = user.id if user.id
redirect_to root_url, :notice => 'You have been successfully logged in!!!'
else
redirect_to root_url, ... |
module Badgeable
module Subject
# Award a named badge to this object. If the badge doesn't exist
# in the database already, it's created by name.
def award_badge(*args)
options = args.extract_options!
name = args[0]
badge = Badge.find_or_create_by_name(name, options)
badges << badg... |
class AddPhoneAndNameAndProfileAndProfessionalizedToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :phone, :string
add_column :users, :name, :string
add_column :users, :profile, :text
add_column :users, :professionalized, :boolean
end
end
|
RSpec.describe "Partners", type: :request do
let(:default_params) do
{ organization_id: @organization.to_param }
end
before do
sign_in(@user)
end
describe "GET #index" do
subject do
get partners_path(default_params.merge(format: response_format))
response
end
let!(:partner) ... |
require "zero_formatter/serializer/int"
require "zero_formatter/serializer/uint"
require "zero_formatter/serializer/fp"
require "zero_formatter/serializer/bool"
require "zero_formatter/serializer/string"
require "zero_formatter/serializer/time"
require "zero_formatter/serializer/object"
module ZeroFormatter
class Se... |
class Ability
include CanCan::Ability
def initialize(user)
@user = user || User.new
@user.roles.each { |role| send(role.name.downcase)}
if @user.roles.size == 0
# Not logged in
end
end
def registered
end
def member
registered
can :read, :all
end
def manager
member
... |
class CalculableAttrs::Utils::SqlParser
def initialize(sql)
@sql = sql
@masked_sql = mask_sql(sql)
end
def first_select_snippet
match = @masked_sql.match(/SELECT (?<select>.*?) FROM/)
from, to = *match.offset(:select)
@sql[from..to-1]
end
def last_where_snippet
last_where_start_at = ... |
a = "Hello world"
b = "Hi, my name is Ruby!"
c = " "
d = ""
p a.length
p b.length
p c.length
p d.length
puts
p a.size
p b.size
p c.size
p d.size
puts
p a.length.class
p a.length.next
p a.length.odd?
p a.length.odd?.class
|
class OrganizationUniquenessValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
Team.all.each do |team|
if value == team.name &&
record.organization_id == team.organization_id
record.errors[attribute] << (options[:message]) ||
'is already a team nam... |
# r* --> expresion regular que se transforma en una lambda. Para cada expresion regular definimos unos metodos
# rs --> seq(r,s) (concatenación) --> concatenar tres: seq(seq(r,s),t)
# hola --> char(metodo que representa esa expresion regular)
# Los metodos reciben una lambda y devbuelven otra lamba
# Ejemplo: c(a|d)+... |
require 'spec_helper'
describe Api::V1::Users::GroupMembershipsController do
render_views
describe "#index" do
let(:user) { FactoryGirl.create :user, role: "agent" }
let(:resource_list) { FactoryGirl.create_list :group_membership, 3, user: user }
let(:action) { get :index, user_id: user.id }
... |
# frozen_string_literal: true
class Importer
class_attribute :path
class_attribute :slice_index, default: 0
attr_accessor :raw_json_data, :object_data
def initialize
self.raw_json_data = JSON.parse(IO.read(Rails.root.join('dumps', "#{path}.json")))
self.object_data = {}
transform!
end
def tr... |
require 'test_helper'
class PublicationsControllerTest < ActionDispatch::IntegrationTest
setup do
@publication = publications(:one)
end
test "should get index" do
get publications_url
assert_response :success
end
test "should get new" do
get new_publication_url
assert_response :success
... |
class AddMissingLocalesInAgents < ActiveRecord::Migration[5.1]
def up
ActiveRecord::Base.record_timestamps = false
begin
Agent.all.each do |agent|
if agent.locales.empty?
agent.locales = [Locales::ANY]
agent.save!
end
end
ensure
ActiveRecord::Base.reco... |
require 'active_support/concern'
module Letsrate
extend ActiveSupport::Concern
def rate(rating, user_id, dimension=nil)
if can_rate? user_id, dimension
rate = rates(dimension).where(:rater_id => user_id).first_or_initialize do |r|
r.dimension = dimension
r.rater_id = user_id
end
... |
class CaptureHistoriesController < ApplicationController
before_action :set_capture_history, only: [:show, :edit, :update, :destroy]
# GET /capture_histories
# GET /capture_histories.json
def index
@capture_histories = CaptureHistory.all
end
# GET /capture_histories/1
# GET /capture_histories/1.json... |
module ActiveModelBehavior
module ClassMethods
def model_name
@_model_name ||= ActiveModel::Name.new(self)
end
end
def self.included(base)
base.extend ClassMethods
end
end
|
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'EC2.describe_key_pairs' do
describe 'success' do
before(:each) do
AWS[:ec2].create_key_pair('fog_key_name')
end
after(:each) do
AWS[:ec2].delete_key_pair('fog_key_name')
end
it "should return proper attributes with ... |
class ActionView::Base
# スラッシュがエスケープしないのでエスケープする
def json_escape(obj)
json = ActiveSupport::JSON.encode(obj).html_safe
result = json.to_s.gsub('/', '\/')
json.html_safe? ? result.html_safe : result
end
# <%= json obj %> で使えるように
alias json json_escape
end
# 自動でJSON内のHTMLエスケープをする
Samepot::Applicat... |
module ApplicationHelper
def convert_to_lisp_case(string)
string.downcase.gsub(" ", "-")
end
def titlize(string)
string.split.map {|w| w.capitalize}.join(" ")
end
def friendly_est_datetime(datetime)
datetime.in_time_zone('Eastern Time (US & Canada)').strftime("%m/%d/%Y @ %I:%M%P %Z")
end
end
|
# Attributes
# Shields
# Blasters
# Speed
# Name
# Backburner
# Pilots
# Power Level
# Action
# Speed
# Power Level
# Damage
class SpaceShip
@@space_ship_counter = 0
attr_accessor :shield
attr_accessor :name
def initialize(name, shield, blasters, speed, damage)
#instance variables related to one... |
# frozen_string_literal: true
module UnitTestPrinciples
VERSION = "0.1.0"
end
|
require 'builder'
namespace :mamashai do
desc "create sitemap.xml for seo"
task :create_sitemap => [:environment] do
time_begin = Time.new
file_name = File.join(RAILS_ROOT,"public","sitemap.xml")
posts = Post.find(:all,:conditions=>['title is not null'],:order=>"created_at desc",:limit=>40000)
... |
module HBase
module Request
class TableRequest < BasicRequest
attr_reader :name
attr_reader :body
def initialize(name)
super("")
@name = CGI.escape(name) if name
end
def show
@path << "/#{name}"
end
def regions(start_row = nil, end_row = nil)
... |
class Node < ActiveRecord::Base
before_save :confirm_child_type
after_save :update_child_type
belongs_to :parent, class_name: 'Node', foreign_key: 'parent_id'
belongs_to :expressible, polymorphic: true
has_one :left,
class_name: 'Node',
dependent: :destroy,
foreign_key: '... |
When /^I create set$/ do
#Click Library
find('.library').click
sleep 5
#Click Add Set
all('div.actions-block .button')[1].click
# Wizard Step 1: Define set title
@set_title = Faker::Lorem.word
page.find(:css, "div.wizard-step-1 input.name").set @set_title
page.execute_script("$('.ok').click();")
... |
class AddDateTimeColumns < ActiveRecord::Migration[6.0]
def change
add_column :test_models, :date, :date
add_column :test_models, :time, :time
end
end
|
json.array!(@doctor_adds) do |doctor_add|
json.extract! doctor_add, :id, :from, :to, :total, :used, :docName, :docFamily, :speciality
json.url doctor_add_url(doctor_add, format: :json)
end
|
require 'test_helper'
class EmailAddressTest < ActiveSupport::TestCase
test "should reject invalid email addresses" do
email = EmailAddress.new
%w(john john@example -john@example.com _john@example.com john!@example.com
john(smith)doe@example.com john+doe@example.com john%doe@example.com john.@example... |
# Define a node in the list
class Node
attr_accessor :value, :next, :prev
def initialize(value)
@value = value
@next = nil
@prev = nil
end
end
# A Class for double linked lists (each element links to the next one, and to the previous one)
class DoubleList
include Enumerable
attr_accessor :head, ... |
# -*- coding: utf-8 -*-
module DashboardsHelper
def up_arrow_link_to_unless(condition, args={})
project = args[:project]
category = args[:category]
sub_category = args[:sub_category]
story = args[:story]
unless condition
if story.present?
path = move_higher_project_category_sub_categ... |
class CreateHides < ActiveRecord::Migration
def change
create_table(:hides, index: false) do |t|
t.timestamps null: false
t.integer :uid
t.integer :post
t.timestamp :time
end
end
end
|
# encoding: utf-8
require 'sinatra'
require 'sinatra/reloader' if development?
require 'sinatra/content_for'
require 'json'
require 'yaml'
require 'haml'
require 'omniauth'
require 'omniauth-github'
require 'faraday'
require 'faraday_middleware'
set :haml, { :format => :html5 }
set :cacheDir, "cache"
enable :session... |
class UserMailer < ApplicationMailer
default from: Settings.mail_from
def asign_to_course user, course
@user = user
@course = course
mail to: @user.email, subject: t("mail.asign_to_course",
name: @course.name)
end
def reject_from_course user, course
@user = user
@course = course
... |
module CloudCapacitor
class Capacitor
include Log
attr_accessor :deployment_space
attr_accessor :executor, :strategy
attr_accessor :current_workload, :workloads, :current_category
attr_reader :candidates_for, :candidates, :rejected_for, :executed_for, :current_config, :current_result
attr_... |
class CompletedTalent
def initialize(talent)
@talent = talent
end
def completed_profil
count = 0
value_input = stat(8)
@talent.firstname.present? ? count += value_input : count
@talent.last_name.present? ? count += value_input : count
@talent.photo? || @talent.display_linkedin? ? count... |
# 2 thread-safe stack implementations
# Written by Alex Dowad
# Bug fixes contributed by Alex Kliuchnikau and Remus Rusanu
# Usage:
# stack.push(1)
# stack.peek => 1 (1 is not removed from stack)
# stack.pop => 1 (now 1 is removed from stack)
require 'rubygems' # for compatibility with MRI 1.8, JRuby
... |
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def auth
unless session[:user_id]
flash[:plzsign] = "Please sign in with facebook!"
re... |
class CreatePullRequests < ActiveRecord::Migration[6.0]
def change
create_table :pull_requests do |t|
t.integer :status, default: 0, null: false
t.string :external_id
t.references :locale_file, index: true, foreign_key: true, null: false
t.references :project, index: true, foreign_key: tru... |
class User < ActiveRecord::Base
has_many :events
has_many :events_users
# has_many :events, through: :users
validates_presence_of :first_name, :last_name, :email, :password, :password_confirmation, :address
validates_uniqueness_of :email
validates_presence_of :password_confirmation, on: :create
validates_confir... |
class ArticlesController < ApplicationController
before_action :set_article, only: [:show, :edit, :update, :destroy]
skip_before_action :authenticate_user!, only: [:index]
before_action :require_permission, only: [:edit, :update, :destroy]
# GET /articles
# GET /articles.json
def index
@articles=A... |
require 'test_helper'
class PlayerTest < ActiveSupport::TestCase
def setup
CardDeck.startTest(0)
end
test "init should clear all cards and get two cards from CardDeck" do
Player.init
assert_equal 2, Player.all.size
assert_equal 13, Player.getSum
Player.init
assert_equal 2, Player.all.siz... |
class CreateTaskRecords < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.references :user
t.string :type
t.datetime :created_on
t.datetime :completed_on
end
add_index :tasks, :user_id
end
end
|
require 'spec_helper'
describe ApiController, type: :controller do
class InheritsFromApiController < described_class
def foo
ActionController::Parameters.new(params).permit([:q])
render text: 'ok', status: :ok
end
def new_query
Query.new(params)
end
end
describe InheritsFromAp... |
module ActiveRecord
module Acts
module Optionable
module OptionMethods
def self.included(option_model)
option_model.extend Finders
end
module Finders
def find_options_for_optionable(optionable_str, optionable_id)
all(:conditions => { :optionab... |
#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 ... |
FactoryBot.define do
factory :chat_message do
user_id { 1 }
room_type { "GroupChatRoom" }
room_id { 1 }
message { Faker::Books::Lovecraft.sentences }
end
end |
Rails.application.routes.draw do
namespace :api do
get "/top_stories" => "top_stories#index"
end
end
|
class Employee < ApplicationRecord
has_many :batteries
end
|
class Cow < ActiveRecord::Base
has_many :orders
validates :chuck_total,
:rib_total,
:brisket_total,
:shank_total,
:plate_total,
:short_loin_total,
:sirloin_total,
:top_sirloin_total,
:bottom_sirloin_total,
:... |
require 'rails_helper'
RSpec.feature 'Listing sections' do
before do
@admin = create(:admin)
login_as(@admin, scope: :admin)
@section1 = create(:section)
@section2 = create(:section)
visit admin_sections_path
end
scenario 'should has list of sections' do
expect(page).to have_content(@sec... |
# frozen_string_literal: true
# Reads lines from STDIN, writing them to Kafka.
#
# You need to define the environment variable KAFKA_BROKERS for this
# to work, e.g.
#
# export KAFKA_BROKERS=localhost:9092
#
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
require "kafka"
logger = Logger.new($stderr)... |
require 'spec_helper'
describe "Create a facility review" do
it "saves a review" do
facility = Facility.create!(facility_attributes)
visit facility_path(facility)
click_on "Submit Review"
expect(current_path).to eq(new_facility_review_path(facility))
fill_in "Name", with: "Warren S"
fill_... |
##
# ItunesReceiptDecoder
module ItunesReceiptDecoder
##
# ItunesReceiptDecoder::Decode
module Decode
##
# ItunesReceiptDecoder::Decode::Base
class Base
##
# The raw receipt, i.e. not base64 encoded
attr_reader :raw_receipt, :receipt, :options, :environment
##
# Initiali... |
require 'rails_helper'
feature 'add a motorcycle' do
scenario 'signed in user adds a motorcycle' do
user = FactoryGirl.create(:user)
style = FactoryGirl.create(:style)
visit root_path
click_link 'Sign In'
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
click_butt... |
# EDSC-102 As a user, I want to view my contact information
# so that I may verify it is correct
require 'spec_helper'
describe 'Contact Information', reset: false do
before :all do
load_page :search, overlay: false
login
click_link 'Manage user account'
# TODO: Both of these fail to get me to the ... |
class AddSocialInfoToTeamAndAffiliation < ActiveRecord::Migration
def up
change_table :teams do |t|
t.references :social_info
end
change_table :affiliations do |t|
t.references :social_info
end
Team.all.each do |team|
theSocialInfo = SocialInfo.create(twitter_name: team... |
require 'legacy_obitfinder'
describe LegacyObitFinder do
it "should have class LegacyObitFinder" do
LegacyObitFinder.new({})
end
it "should return date range" do
expect(LegacyObitFinder.new(date_range: "new_range").date_range_option).to eql('&daterange=new_range')
end
it "should return keyword" d... |
class DropChallengeDeliveryGroups < ActiveRecord::Migration
def change
drop_table :challenge_delivery_groups
end
end
|
module EventsHelper
def datetime(d)
I18n.localize(d, :format => "%B %d, %Y %l:%M %p")
end
def date(d)
I18n.localize(d, :format => "%B %d, %Y")
end
def time(d)
I18n.localize(d, :format => "%l:%M%p")
end
def month_link(date)
link_to(I18n.localize(date, :format => "%B"), {:date => date})
... |
class Title < ActiveRecord::Base
include PgSearch
pg_search_scope :search_by_name,
:against => :name,
:using => {
:tsearch => { :prefix => true }
}
attr_accessible :name, :song_id, :primary
belongs_to :song
validates :name, :presence => true
end
|
# Copyright (c) 2016 Scott O'Hara, oharagroup.net
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ApplicationController, type: :controller do
controller do
def index
case params['context']
when 'internal error' then raise StandardError, params['context']
when 'record invalid' then rais... |
Given(/^I am on the Sign up screen$/) do
signup_screen = page(SignupScreen).await
end
Given(/^I am on the Login screen$/) do
login_screen = page(LoginScreen).await
end
Given(/^I am on the Home screen in Customer app$/) do
homecustomer = page(HomeCustomerScreen).await
end
Given(/^I am on the Home screen by Lo... |
require 'spec_helper'
require_relative '../../lib/models/pricing_rule_order.rb'
RSpec.describe PricingRuleOrder, type: :model do
it "should be valid if instantiated with the correct attributes" do
expect(FactoryBot.build(:pricing_rule_order)).to be_valid
end
it "should have an pricing rule ID" do
expect... |
require 'spec_helper'
module Naf
describe ApplicationSchedule do
let!(:schedule) { FactoryGirl.create(:schedule) }
# Mass-assignment
[:application_id,
:application_run_group_restriction_id,
:application_run_group_name,
:run_interval,
:priority,
:visible,
:enabled,
:app... |
class RemoveColumnFromUserInfos < ActiveRecord::Migration
def change
remove_column :user_infos, :bill_phone
rename_column :user_infos, :phone, :primary_phone
end
end
|
# Copyright 2015 Ride Connection
#
# 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 required by applicable law or agreed to in writi... |
cask 'evernus' do
name 'Evernus'
version '1.47'
sha256 'df130ac06121e3ac5d7d164e14fb664a280090ab4dac9ff76f749b3d641f5508'
url "https://bitbucket.org/krojew/evernus/downloads/Evernus-#{version}.dmg"
homepage 'http://evernus.com/'
license :gpl
app 'Evernus.app'
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
private
def after_sign_in_path_for(resource)
stored_location_for(resource) || landing_path
end
end
|
require 'date'
module SqlPostgres
# This class creates and executes an SQL select statement.
#
# Example (assuming the values 1, 2 and null are in the database):
#
#** Example: select
# select = Select.new(connection)
# select.select('i')
# select.from('foo')
# select.order_by('i')
# p s... |
# frozen_string_literal: true
require "graphql"
require "jazz"
require "benchmark/ips"
require "stackprof"
require "memory_profiler"
require "graphql/batch"
module GraphQLBenchmark
QUERY_STRING = GraphQL::Introspection::INTROSPECTION_QUERY
DOCUMENT = GraphQL.parse(QUERY_STRING)
SCHEMA = Jazz::Schema
BENCHMARK... |
class Chatroom < ApplicationRecord
has_many :messages, dependent: :destroy
has_many :chatroom_users, dependent: :destroy
has_many :users, through: :chatroom_users
before_destroy :destroy_users
validates :title, presence: true, uniqueness: true
def to_slug
title.downcase.parameterize
... |
require "rails_helper"
feature "Raids" do
given(:chaaartz) do
FactoryBot.create(:user,
name: "Chaaartz",
level: 40,
trainer_phone_number: "9511234567",
password: "MyP@ssword1",
password_confirmation: "My... |
require 'yaml'
module VCR
class Cassette
class Serializers
module YAML
extend self
def file_extension
"yml"
end
def serialize(hash)
::YAML.dump(hash)
end
def deserialize(string)
::YAML.load(string)
end
end
en... |
require 'grape'
require_relative 'helpers/session_helpers'
require_relative 'helpers/vulnerability_helpers'
require_relative 'entities/vulnerability_entity.rb'
module Versioneye
class VulnerabilitiesApi < Grape::API
helpers SessionHelpers
helpers VulnerabilityHelpers
resource :vulnerabilities do
... |
class AdminsController < ApplicationController
# before_filter :authenticate_admin!, :except => [:forgot_password, :reset_password]
layout "admin"
# Shows the landing/main page for admin
def index
if current_admin.present?
@clients = Client.all
@client = Client.new
#Total Visits
... |
require 'tackle_box/email/template/extensions'
require 'tackle_box/email/template/filters'
require 'tackle_box/email/template/tags'
require 'mail'
require 'liquid'
require 'nokogiri'
module TackleBox
module Email
class Template
# The email to be rendered.
#
# @return [String]
attr_reade... |
# yeah, it's fugly but juggernaut is temporary :)
namespace :juggernaut do
desc "Install a patched version of juggernaut"
task :install do
on roles(:app) do
execute :sudo, "npm install -g juggernaut"
upload! File.expand_path("vendor/juggernaut.tar.gz"), "/tmp/juggernaut.tar.gz"
execute :sudo, "mkdir -p /... |
class Asset < ActiveRecord::Base
belongs_to :post
def self.upload(file, options = {})
original_filename = file.respond_to?(:original_filename) ? file.original_filename : Time.now.to_i.to_s
original_filename.gsub!(/\//, '_')
file = ensure_temp_file(file)
now = Time.now
relative_destination_pat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.