text stringlengths 10 2.61M |
|---|
class Zombie
@@horde = []
@@plague_level = 10
def self.plague_level?
@@plague_level
end
#following variables do not change in value
@@max_speed = 5
@@max_strength = 8
@@default_speed = 1
@@default_strength = 3
def initialize(speed, strength)
if speed > @@max_speed
@speed = @@max_spe... |
class Rent < ApplicationRecord
include Concerns::SearchFilters
belongs_to :user
belongs_to :book
validates_associated :user, :book
validates :start_date_rent, :end_date_rent, presence: true
scope :rent_expires_today, -> { where(end_date_rent: Date.current).pluck(:id) }
end
|
require 'spec_helper'
module Fakes
describe MethodStub do
let(:args) { [1, 2, 3] }
let(:argument_set) { Object.new }
context 'when specifying a set of arguments it should be called with' do
let(:arg_sets) { [] }
let(:sut) { MethodStub.new(arg_sets) }
before(:each) do
ArgSet.st... |
# frozen_string_literal: true
module Ios
module Devices
# Represents an iOS device model. Every device has a type and name and some
# of them also have extra information (Revision, Wi-fi, etc.)
class Model
attr_accessor :device_type, :name, :extra
def initialize(device_type, name, extra = ni... |
class Api::Public::UsersController < Api::Public::BaseController
before_filter :load_business
def index
@users = @business.users
respond_with @users
end
private
def load_business
@business = Business.find(params[:business_id])
end
end |
require 'ruble'
# FIXME: this file is rife with textmate-isms!!!
command t(:call_generate_script) do |cmd|
cmd.key_binding = 'CONTROL+SHIFT+\\'
cmd.scope = "source.ruby.rails, source.yaml, project.rails"
cmd.output = :discard
cmd.input = :none
cmd.invoke do |context|
require 'rails_bundle_tools'
r... |
class Client < ApplicationRecord
# has_one :user
validates :name, :phone, :address, presence: true
has_many :orders
end
|
require "byebug"
def first_anagram?(first_word, second_word)
perm = first_word.chars.permutation(first_word.length)
perm.any? do |chars|
chars.join == second_word
end
end
def second_anagram?(first_word, second_word)
second_word_chars = second_word.chars
first_word.each_char do |letter|
index = sec... |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
if html_tag =~ /<(input|textarea|select)/
first_whitespace = html_tag =~ /\s/
html_tag[first_whitespace] = " style='margin-bottom: 3px;' "
if html_tag =~ /class=/
class_attribute = html_tag =~ /class=['"]/
html_tag.insert(... |
#!/usr/bin/env ruby
# _ _ _ by_stephan.com_ _
# | |__ __ _| |_| |_| | ___ ___| |__ (_)_ __
# | '_ \ / _` | __| __| |/ _ \/ __| '_ \| | '_ \
# | |_) | (_| | |_| |_| | __/\__ \ | | | | |_) |
# |_.__/ \__,_|\__|\__|_|\___||___/_| |_|_| .__/
# |_|
require 'meth... |
class AddDetailsToMedications < ActiveRecord::Migration
def change
add_column :medications, :dosage, :string
add_column :medications, :schedule, :string
add_column :medications, :starts_on, :date
add_column :medications, :ends_on, :date
add_column :medications, :patient_id, :integer
end
end
|
require 'spec_helper'
module ChefSpec
module Matchers
describe :be_owned_by do
describe "#match" do
let(:matcher) { be_owned_by('user', 'group') }
it "should not match when the file is nil" do
matcher.matches?(nil).should be false
end
it "should not match when both... |
# frozen_string_literal: true
module Decidim
module Opinions
# A form object to be used when public users want to create a Collaborative Draft.
class CollaborativeDraftForm < Decidim::Opinions::OpinionForm
def map_model(model)
super
return unless model.categorization
self.cate... |
#! /usr/bin/ruby
class VideoRandomPlay
@@TRY_TIMES = 15
def initialize( player, videoDir )
@player = player
@videoDir = videoDir
@files = Dir.glob( File.expand_path(videoDir) + "/**/*" )
raise "Empty Directory #{videoDir} ..." if @files.count == 0
end
def choose
@@TRY_TIMES.times do
... |
class Api::PropertiesController < ApplicationController
def index
render json: Property.avaliable
end
end
|
class AddSummaryColumnsToPosts < ActiveRecord::Migration
def change
add_column :posts, :he_summary, :string
add_column :posts, :she_summary, :string
end
end
|
module Fog
module TerremarkEcloud
class Compute
class Real
require 'fog/compute/parsers/terremark_ecloud/instantiate_vm_template'
# Instantiate a VM template
#
# ==== Parameters
# * options<~Hash>:
# * 'vdc_uri'<~String>: URI of the VDC to place the VM in... |
# -*- encoding : utf-8 -*-
class ChangeUsernameToName < ActiveRecord::Migration
def change
rename_column :users, :username, :name
add_column :users, :email, :string
end
end
|
require 'test_helper'
class QueryTest < ActiveSupport::TestCase
obj = self
# module SphinxHelpers
# def index
# ThinkingSphinx::Test.index
# # Wait for Sphinx to finish loading in the new index files.
# sleep 0.25 until index_finished?
# end
# def index_finished?
... |
require 'rails_helper'
RSpec.describe User, type: :model do
let!(:user) { create(:user) }
it {expect(subject).to validate_presence_of(:firstname) }
it {expect(subject).to validate_presence_of(:lastname) }
it {expect(subject).to validate_presence_of(:username) }
end
|
class CommentSerializer < ActiveModel::Serializer
attributes :id, :user_id, :design_id, :comment
has_one :user
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources :cities
resources :gossips
resources :users do
resources :gossips
end
resources :gossips do
resources :coms
end
resources :sessions, only: [:new... |
class Libjpeg < Package
desc "JPEG image manipulation library"
homepage "http://www.ijg.org"
url "http://www.ijg.org/files/jpegsrc.v${version}.tar.gz"
release version: '9b', crystax_version: 3
build_copy 'README'
def build_for_abi(abi, _toolchain, _release, _host_dep_dirs, _target_dep_dirs, _options)
... |
require_relative 'memento'
class SalesProspect
attr_reader :name, :phone, :budget
def name=(value)
@name = value
puts "Name: #{@name}"
end
def phone=(value)
@phone = value
puts "Phone: #{@phone}"
end
def budget=(value)
@budget = value
puts "Budget: #{@budget}"
end
def save_m... |
# frozen_string_literal: true
module GraphQL
module Language
module Nodes
NONE = GraphQL::EmptyObjects::EMPTY_ARRAY
# {AbstractNode} is the base class for all nodes in a GraphQL AST.
#
# It provides some APIs for working with ASTs:
# - `children` returns all AST nodes attached to thi... |
class ComponentsController < ApplicationController
def index
@q = Component.search(params[:q])
@q.sorts = 'combo_code asc' if @q.sorts.empty?
@components = @q.result
respond_to do |format|
format.html # index.html.erb
format.json { render json: @components }
end
end
def... |
# lib/controllers/mixins/callback_helpers.rb
require 'controllers/abstract_controller'
require 'controllers/mixins/mixins'
require 'errors/callback_error'
require 'ingots/ingots'
module Mithril::Controllers::Mixins
module CallbackHelpers
extend ActionMixin
include Mithril::Errors
def controlle... |
class CheesesController < ApplicationController
before_action :set_cheese, only: [:show, :update, :destroy]
# GET /cheeses
def index
@cheeses = Cheese.all
render json: @cheeses
end
# GET /cheeses/1
def show
render json: @cheese
end
# POST /cheeses
def create
@cheese = Cheese.new(ch... |
class ApplicationController < ActionController::Base
layout :layout_by_resource
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
end
... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'ユーザー登録' do
before do
@user = FactoryBot.build(:user)
end
it '全ての項目が存在すれば登録できること' do
expect(@user).to be_valid
end
it 'nicknameが空だと登録できない' do
@user.nickname = ''
@user.valid?
expect(@user.errors.f... |
# frozen_string_literal: true
module RefileImages
VERSION = "0.0.3"
end
|
class Employee < ActiveRecord::Base
has_and_belongs_to_many :departments
has_many :trainings
has_many :documents, :through => :trainings
validates_presence_of :first_name, :last_name, :username,
:message => "Can not be empty."
validates_uniqueness_of :username
validates_format_of :first_name, :last_... |
# 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... |
class AddItemTypeToOrder < ActiveRecord::Migration[5.0]
def change
add_reference :orders, :item_type, index: true, foreign_key: true
add_column :orders, :expected_arrival_time, :datetime
add_column :orders, :arrived_at, :datetime
end
end
|
class ArticlesController < ApplicationController
before_action :signed_in_user
load_and_authorize_resource
def index
@articles = Article.order('created_at DESC')
end
def show
@article = Article.find(params[:id])
@comments = @article.comments.order('created_at DESC')
end
def new
@articl... |
class AddUsersColumnCurrentTest < ActiveRecord::Migration[5.2]
def change
add_column :users, :current_test, :integer, :default => 0
end
end
|
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/calendarios/index.html.erb" do
include CalendariosHelper
before(:each) do
calendario_98 = mock_model(Calendario)
calendario_98.should_receive(:fecha).and_return(Date.today)
calendario_98.should_receive(:tipo).and_return("MyString")
... |
# Class taken from StackOverflow
# http://stackoverflow.com/questions/22052473/best-flexible-rails-password-security-implementation
class CheckPasswordComplexityService
attr_reader :password
def initialize(password)
@password = password
end
def valid?
valid = true
needs_uppercase = !Setting.find... |
# This file is part of the sinatra-sse ruby gem.
#
# Copyright (c) 2011, 2012 @radiospiel
# Distributed under the terms of the modified BSD license, see LICENSE.BSD
Dir.chdir File.dirname(__FILE__)
require "bundler/setup"
require "rack"
require "sinatra/base"
require "sinatra/sse"
class TimeServer < Sinatra::Base
... |
class CartsController < ApplicationController
def index #カート内の書品一覧
@carts = Cart.all
@fee = 360 #送料
@total_price = 0
@carts.each do |cart|
if current_user.id == cart.user_id
@total_price += cart.item.price*cart.count
end
end
@random = Item.order("RANDOM()").first
end
def c... |
require 'active_support/configurable'
require 'action_view/helpers/tag_helper'
require 'action_view/helpers/url_helper'
module Spina
module Pages
class MenuPresenter
include ActionView::Helpers::TagHelper
include ActionView::Helpers::UrlHelper
include ActiveSupport::Configurable
config_a... |
# calculate the number of letters that would be used if all numbers
# from 1 to 1000 (inclusive) were written out in English
# e.g. 115 uses 20 letters to write "one hundred and fifteen"
# approach: create a method that convers each number from numeral to English
# create an array of all number from 1 to 1000 and then... |
require 'docking_station.rb'
require 'bike'
describe DockingStation do
it { is_expected.to respond_to :release_bike }
it 'bikes have a working? method' do
bike = Bike.new
expect(bike).to respond_to :working?
end
it 'docking station has a dock_bike(bike) method' do
expect(subject).to respond_to ... |
class FixAcademicActivityInfoColumnName < ActiveRecord::Migration
def change
rename_column :academic_activity_infos, :type, :activity_type
end
end
|
module Specmon
class BuildsController < ApplicationController
def index
@builds = Build.where(project_id: @project.id).order(created_at: :desc).page(params[:page]).per(params[:per])
end
def show
@build = Build.find_by_id(params[:id])
if @build
examples_for_build
owners_f... |
class Vendors::ShowSerializer < ApplicationSerializer
object_as :vendor
identifier :slug
attributes(
:id,
:slug,
:name,
:url,
:created_at,
:updated_at,
)
type "{
items: number
accessories: number
consumables: number
components: number
licenses: number
contrac... |
#
# Adapted from https://github.com/progit/progit/blob/master/latex/makepdf
#
require "rubygems"
require "bundler/setup"
require "guard"
require "guard/shell"
require "terminal-notifier-guard"
def replace(string, &block)
string.instance_eval do
alias :s :gsub!
instance_eval(&block)
end
string
end
def pr... |
class RenameSongCeremoniesTable < ActiveRecord::Migration
def change
rename_table :song_ceremonies, :ceremony_songs
end
end
|
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :user, 'admin'
set :deploy_to, '/home/admin/apps/slc-a'
set :repository, 'git@github.com:fiverr/slc-a.git'
set :keep_releases, "20"
set_default :bundle_path, '../vendor/bundle'
if ENV['branch'].nil? || ENV['branch'].empty?
set ... |
# frozen_string_literal: true
require 'rails_helper'
describe Session do
it { is_expected.to belong_to(:user) }
describe '#generate_token callback' do
subject(:session) { build(:session) }
specify do
expect { session.save }.to change { session.token }.from(nil)
end
end
describe '#expire!' ... |
module ET3
module Test
class YourRepresentativesDetailsPage < BasePage
set_url '/respond/your_representatives_details'
element :error_header, :error_titled, 'errors.header', exact: true
section :type_of_representative_question, :single_choice_option, 'questions.type_of_representative.label', e... |
require 'rails_helper'
RSpec.describe User, type: :model do
before do
@user = FactoryBot.build(:user)
end
describe 'ユーザー新規登録' do
context 'ユーザー登録が出来る' do
it '全ての項目を入力すれば登録出来る' do
expect(@user).to be_valid
end
end
context 'ユーザー登録が出来ない' do
it 'emailが空では登録出来ない' do
... |
require 'rails_helper'
describe 'PlayerStatsController' do
let(:request_path) { player_stat_path player_id }
describe 'GET /player_stats/:id' do
context 'player exists' do
let!(:player) { Player.create! name: 'john' }
let!(:player_id) { player.id }
it 'should return a 200' do
get re... |
require('spec_helper')
describe(City)do
describe('#initialize')do
it("initializes new instances of the class") do
new_city = City.new(id:nil,name:"San Francisco")
expect(new_city).to(be_an_instance_of(City))
end
end
describe("#id")do
it("It allows ids to be selected from the instances") ... |
module Hobbie
def build_talent_array
@talents = []
plays_guitar?
wakeboards?
has_hedge_fund?
return @talents
end
private
def plays_guitar?
@talents << "Plays Guitar"
end
def wakeboards?
@talents << "Wakeboards"
end
def has_hedge_fund?
@talents << "Has Hedge Fu... |
json.groups do
json.partial! 'api/v1/groups/show', collection: @groups, as: :group
end
|
module Spree
module Search
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Spree::Search::Configuration.new
yield configuration
end
class Configuration
attr_accessor :price_ranges,:facets
def initialize
self.price_ra... |
class RemoveSubCategoryReferenceFromCampaigns < ActiveRecord::Migration[5.0]
def change
remove_reference(:campaigns, :sub_category, index: true, foreign_key: true)
end
end
|
class AddCodeNameToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :code_num, :bigint
end
end
|
require 'remote_file_proxy/version'
require 'remote_file_proxy/api'
require 'digest/md5'
require 'socket'
module RemoteFileProxy
class IORFile
def initialize(filename, filepath, mode, host, port)
@filename = filename
@filepath = filepath
@internal = File.open filepath, mode
@md5_before =... |
class AddColumnsToStudent < ActiveRecord::Migration[5.2]
def change
add_column :students, :cca, :string
add_column :students, :promoter_name, :string
add_column :students, :promoter_email, :string
end
end
|
class NotificationResult
include Datapathy::Model
service_type :escalation
links_to :escalation
links_to :address
persists :notification_at, :result, :success, :created_at
end
|
module ApplicationHelper
BOOTSTRAP_FLASH_CLASSES = {notice: 'alert-success', alert: 'alert-danger'}.freeze
def bootstrap_class_for_flash(type)
BOOTSTRAP_FLASH_CLASSES.fetch type.to_sym, type.to_s
end
end
|
require 'rmega/nodes/uploadable'
require 'rmega/nodes/expandable'
require 'rmega/nodes/downloadable'
require 'rmega/nodes/deletable'
require 'rmega/nodes/traversable'
require 'rmega/nodes/node_key'
require 'rmega/nodes/node'
require 'rmega/nodes/file'
require 'rmega/nodes/folder'
require 'rmega/nodes/inbox'
require 'rm... |
class AddFacultySponsorToClubs < ActiveRecord::Migration[5.2]
def change
add_column :clubs, :faculty, :string
end
end
|
json.array!(@movie_suggestions) do |movie_suggestion|
json.extract! movie_suggestion, :id, :user_id, :name, :details, :status, :is_deleted
json.url movie_suggestion_url(movie_suggestion, format: :json)
end
|
require 'socket'
require './lib/request_handler'
require "./lib/response_handler"
class Server
attr_reader :request_handler, :response_handler
def initialize
@request_handler = RequestHandler.new
@response_handler = ResponseHandler.new
connect
end
def connect
until request_handler.close_s... |
json.array!(@routines) do |routine|
json.extract! routine, :id, :polyclinic_id, :post_id, :schedule_id, :timing
json.url routine_url(routine, format: :json)
end
|
class MetrcDestroyImmaturePlant
include Sidekiq::Worker
sidekiq_options queue: 'low'
def perform(plant_id)
plant = Inventory::Plant.find(plant_id)
facility = plant.facility_strain.facility
license = facility.site_license
params = [
{
"PlantBatch": plant.plant_batch_name,
"Co... |
require "bundler/setup"
Bundler.require(:default)
require "minitest/autorun"
require "minitest/pride"
require "dexter"
$url = ENV["DEXTER_URL"] || "postgres:///dexter_test"
$conn = PG::Connection.new($url)
$conn.exec <<-SQL
SET client_min_messages = warning;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF N... |
class Status
include Datapathy::Model
service_type :measurements
persists :value, :last_updated, :status
links_to :metric
end
|
# class UI
# def initialize
# end
require_relative 'game'
class UserInterface
attr_accessor :game
def get_answer(num1, num2)
puts "#{@game.current_player.player_name}: What does #{num1} plus #{num2} equal?"
answer = gets.chomp
if @game.answer_is_number(answer)
puts "Please enter a number!"
... |
# encoding: utf-8
#
# © Copyright 2013 Hewlett-Packard Development Company, L.P.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
class CreateRuns < ActiveRecord::Migration[5.2]
def change
create_table :runs do |t|
t.datetime :start
t.datetime :expire
t.integer :instance
t.text :description
t.integer :min_raider_io_score
t.integer :min_item_level
t.timestamps
end
end
end
|
require_relative 'selection_menu'
class ListMenu < SelectionMenu
def initialize(hash)
hash[:index_template] = hash[:index_template] || ->(index) { "№#{index}\r\n" }
super(hash)
@line_render = hash[:line_render] || ->(item) { item.to_s }
@sorting = hash[:sorting]
end
def add(item)
new_item = ... |
require 'json'
require_relative './tfc'
module CallObserver
class Recorder
class Delivery < Struct.new(:sender, :message, :receiver, :notes)
def to_s
"#{sender || "MAIN"} sent #{message} to #{receiver}"
end
end
def initialize(filter=nil)
@filter = filter || ->(e) { true }
e... |
require 'rails_helper'
RSpec.describe "LoginPages", type: :request do
describe "GET /login_pages" do
subject { page }
it "should have Sign in" do
visit login_path
should have_selector('h1', text: "Homework Helper Login")
end
end
end
|
require 'rubygems'
require 'bundler'
require 'rack'
# Setup load paths
$LOAD_PATH << File.expand_path('../', __FILE__)
module MyApplication
class App
# Run initializers
require 'config/initializers'
require 'app/base'
require 'app/cors'
require 'app/models'
require 'app/routes'
attr_ac... |
class ManagerSerializer < ActiveModel::Serializer
attributes :id, :firstName, :lastName, :email, :username
has_many :companies
end
|
FactoryBot.define do
factory :email do
email { Faker::Internet.email }
contact
category
end
end
|
class Customer < ActiveRecord::Base
attr_accessible :account_number, :address, :customer_email,
:customer_photo, :customer_remarks, :director_id,
:first_name, :is_active, :last_name, :loans_cleared,
:loans_taken, :loans_uncleared, :middle_name, :partner_id,
... |
# RPG Maker sprite-sheet extractor
require 'fileutils'
target_file = File.basename(ARGV[0], File.extname(ARGV[0]))
output_dir = "#{File.dirname(ARGV[0])}/#{target_file}"
FileUtils.mkdir_p(output_dir)
# extract player sprites
%x(convert #{ARGV[0]} -crop 24x32 #{output_dir}/sprite-%03d.png)
num_player = 0
players = 8
... |
require_relative 'bike_container'
class DockingStation
include BikeContainer
DEFAULT_CAPACITY = 10
def initialize(options = {})
@capacity = options.fetch(:capacity, DEFAULT_CAPACITY)
@bikes = []
end
def release_broken_bikes_to(van)
if van.class == Van
broken_bikes.each do |bike|
release(bike)
... |
class AddContactsToOrder < ActiveRecord::Migration
def change
add_column :spree_orders, :name, :string
add_column :spree_orders, :phone, :string
end
end
|
class UsersController < ApplicationController
def profile
@title = text('account', 'account_title')
end
end
|
class Region < ApplicationRecord
has_many :plot_files
has_many :transactions
validates_presence_of :title
end
|
class MetrcPlantBatchSerializer
include FastJsonapi::ObjectSerializer
attributes :lot_no,
:count,
:strain,
:room,
:metrc_tag,
:metrc_tag_verified,
:metrc_id
attribute :id do |object|
object.id.to_s
end
end
|
=begin
Glassomium - web-based TUIO-enabled window manager
http://www.glassomium.org
Copyright 2012 The Glassomium Authors
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
h... |
require 'rails_helper'
RSpec.feature "ProducerSessions", type: :feature do
let!(:area) { create(:area_2) }
let(:producer) { create(:producer) }
scenario "chenge content in header after signin and signout" do
visit producer_login_path
fill_in "メールアドレス", with: producer.email
fill_in "パスワード", with: pr... |
require './binary_search_tree'
require 'securerandom'
require 'set'
require 'active_support/all'
require 'pry'
RSpec.describe 'BinarySearchTree (BST) - display in JRuby/Java Swing' do
it 'should search for an element stored in BST' do
total_num_of_items = 15
randomness_range = 100
edge = [
Array.n... |
=begin
class Fixnum
def +(outro)
self - outro
end
end
puts 5 + 4
=end
#obj = "ola"
#obj.puts
=begin
class NilClass
def puts(arg)
arg+"aa"
end
end
puts("a")
=end
class Pessoa
def initialize(nome)
puts "criado pessoa #{nome}"
nome=nome
... |
# frozen_string_literal: true
require 'fastlane/action'
require 'fastlane'
require 'colorize'
fastlane_require 'dotenv'
Dotenv.load
Fastlane.load_actions
import 'Base/AppExtensions.rb'
import 'Base/Helpers/FirebaseHelper.rb'
import 'Base/Helpers/ProjectHelper.rb'
import 'Base/Helpers/AppCenterHelper.rb'
import 'Base... |
class FontArchivoNarrow < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/archivonarrow"
desc "Archivo Narrow"
homepage "https://fonts.google.com/specimen/Archivo+Narrow"
def install
(share/"fonts").install "ArchivoNarrow-Italic[wght].... |
require 'mechanize'
class User < ApplicationRecord
HOMEPAGE = 'https://courses.uit.edu.vn/'
CALENDER_PAGE = 'https://courses.uit.edu.vn/calendar/view.php?lang=en'
MILESTONES = [1.week, 3.days, 1.day, 2.hours, 30.minutes]
has_secure_token
has_many :reminders, dependent: :delete_all
has_many :events, throu... |
# frozen_string_literal: true
class CommentsController < ApplicationController
before_action :friend_user, only: %i[new create]
before_action :blocking?, only: %i[create]
def create
@cordinate = Cordinate.find(params[:id])
@comment = Comment.new(comment_params)
# 自分にはコメントできないようにする。
if current_us... |
#!/usr/bin/env ruby
require 'rubygems'
require 'yaml'
require 'active_support/core_ext'
require 'active_record'
require 'action_mailer'
require 'fileutils'
require 'daemon_spawn'
require 'sys/proctable'
%w(
../../lib
../../app
).each do |dir|
libdir = File.expand_path(dir, __FILE__)
$LOAD_PATH.unshift(libdir)... |
FactoryGirl.define do
factory :transcript, class: Transcript do |transcript|
association :user, factory: :user
association :transcript_user, factory: :user
transcript.start_time 5.hours.ago
transcript.end_time 1.minute.ago
end
end
|
#
# Cookbook Name:: hdfsdu
# Recipe:: fetch_data
#
# Copyright 2017, 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
#
# ... |
class AddProfileToClprs < ActiveRecord::Migration[5.0]
def change
add_column :clprs, :profile_id, :integer
end
end
|
require 'hdfs_jruby/file'
begin
f = Hdfs::File.open("test_a.txt", "a")
p f.print "test..\ntest\n"
f.close()
rescue org.apache.hadoop.security.AccessControlException => e
STDERR.print "permission denied\n"
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.