text stringlengths 10 2.61M |
|---|
#!/usr/bin/env ruby
require 'bundler/setup'
require 'multi_json'
require 'twitter'
require 'yaml'
require_relative 'server'
require_relative 'retweeter'
config = YAML.load(File.read('config/config.yml'))
twitter = Twitter::Client.new(Hash[config.map { |k, v| [k.to_sym, v] }])
retweeter = Retweeter.new(twitter)
comma... |
class CreateAudioContents < ActiveRecord::Migration
def change
create_table :audio_contents do |t|
t.string :title
t.string :url
t.integer :content_fragment_id
t.string :audioMp3_file_name
t.string :audioMp3_content_type
t.integer :audioMp3_file_size
t.datetime :audioMp3_... |
# /usr/bin/ruby
require 'pry'
require 'json'
require 'jsonapi/parser'
require 'json-schema'
SCHEMA_PATH = './station_schema.json'
STATION_FILES = [
'./station_with_area.json',
# './station_without_area.json'
]
WRONG_STATION_FILES = [
'./wrong_station.json'
]
schema = JSON.parse(File.read(SCHEMA_PATH))
begin
... |
module Faceter
module Nodes
# The node describes exclusion of the field from a tuple
#
# @api private
#
class Unfold < AbstractMapper::AST::Node
attribute :key
# Transformer function, defined by the node
#
# @return [Transproc::Function]
#
def transproc
... |
module DeviceProfileHelper
def select_device_profile(search_params)
label_tag('search[profile_id_equals]', '<strong>and/or device profile:</strong>') + ' ' +
select_tag('search[profile_id_equals]', build_device_profile_options(search_params))
end
private
def build_device_profile_options(search_para... |
class RelationshipsController < ApplicationController
before_action :authenticate_user!
def create
@manga = Manga.find_by id: params[:followed_id]
current_user.follow(@manga)
respond_to do |format|
format.html {redirect_to @manga}
format.js
end
end
def destroy
@manga = Relation... |
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: activitylog 1.6.0 ruby lib
Gem::Specification.new do |s|
s.name = "activitylog"
s.version = "1.6.0"
s.required_rubygems_version = Gem::Requirement.new(">= ... |
require File.expand_path(File.dirname(__FILE__) + "/../../ui/base_page")
class AdminAffiliatePage<BasePage
def initialize
@create_new_affiliate_button = "//input[@value='New affiliate program']"
@affiliate_name_txt = "affiliate_program_name"
@start_date_combobox = "affiliate_program_start_date_1i... |
class YoutubeSource < Source
validates :url, presence: true, format: { with: %r{\Ahttps://www.youtube.com/(user|channel)/[^ ]+\z} }
def download_thumb
doc = Nokogiri.parse(open(url))
img = doc.at('img.channel-header-profile-image')
return if img.blank? or img['src'].blank?
update_attributes logo: d... |
require "rails_helper"
RSpec.describe Admin::FacilityGroupsController, type: :controller do
let(:organization) { create(:organization) }
let(:protocol) { create(:protocol) }
let(:valid_attributes) do
attributes_for(
:facility_group,
organization_id: organization.id,
state: "New York",
... |
class RemoveIdFromAssetsRentals < ActiveRecord::Migration
def change
remove_column :assets_rentals, :id
end
end
|
require 'forwardable'
require 'shellwords'
require 'yaml'
module Twigg
# The Config class mediates all access to the Twigg config file.
#
# First, we look for a YAML file at the location specified by the TWIGGRC
# environment variable. If that isn't set, we fallback to looking for a config
# file at `~/.twig... |
FactoryGirl.define do
factory :change_order do
co_num 1
gc_co_num 1
title "MyString"
date_sent "2016-12-12"
date_receive "2016-12-12"
initial_co_value 1.5
approved_co_value 1.5
labor_value 1.5
action "MyString"
notes "MyText"
end
end
|
require 'pathname'
require_relative 'definitions'
class Chekku::Checker < Thor
include Thor::Actions
desc 'checks', 'Check your software dependencies'
default_task :checks
method_option :chekkufile, type: :string, desc: 'Chekkufile Path', default: 'Chekkufile'
# Checks the software dependencies based on ... |
# encoding: utf-8
require File.dirname(__FILE__) + '/../spec_helper'
module SendGrid4r::Factory
describe SegmentFactory do
describe 'unit test', :ut do
before do
Dotenv.load
end
let(:condition) do
ConditionFactory.new.create(
field: 'last_name',
value: 'Mill... |
module AdminLte
class StudentsController < AdminLte::ApplicationController
respond_to :json, :html
before_action :set_student, only: [:show, :edit, :update, :destroy]
# GET /students
# GET /students.json
def index
@students = Student.all
end
# GET /students/1
# GET /students/1.... |
require 'spec_helper'
describe Admin::VideosController do
describe "GET new" do
it_behaves_like 'require_sign_in' do
let(:action) { get :new }
end
it_behaves_like 'require_admin' do
let(:action) { get :new }
end
it 'sets @video to a new video' do
set_current_admin_user
g... |
class Page < ActiveRecord::Base
has_paper_trail
has_permalink
has_many :tags
belongs_to :categories
validates_presence_of :title, :category
mount_uploader :image, ImageUploader
define_index do
indexes :title, sortable: true
indexes :body
set_property :group_concat_max_len => 8192
end
def... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable , :confirmable
has_many :user_auths, :dependent => :de... |
class CitiesController < ApplicationController
def show
@city=City.find(params[:id])
end
def create
@city = City.new(city_params)
if @city.save
redirect_to @city
else
render 'new'
end
end
def new
@city=City.new
end
private
def city_... |
FactoryGirl.define do
factory :event do
sequence(:name) { |i| "Event #{i + 1}" }
start_date { DateTime.new(2016, 12, 29) }
end_date { DateTime.new(2016, 12, 31) }
capacity { Faker::Number.between(100, 1000) }
owner
trait :with_pricing_period do
transient do
ro... |
class ShouterController < ApplicationController
before_action :authenticate_user!, only: [:new, :create, :like, :unlike, :show, :feed]
def show
end
def feed
@shouts = Shout.includes(:badge, :likes, :receiver, :sender, badge: [:badge_category] )
.order('id DESC')
.limit(10)
get_likes_fo... |
class UserFeed < ActiveRecord::Base
validates :user_id, :feed_id, presence: true
belongs_to :user
belongs_to :feed
end
|
# encoding: utf-8
require 'spec_helper'
describe OgpContext do
let(:authentication) { Fabricate(:authentication, provider: PROVIDER_FACEBOOK) }
let(:oauth_token) { authentication.oauth_token }
subject do
user = Fabricate(:user).extend(OgpContext)
%w(twitter github google).each do |provider|
user.... |
module GapIntelligence
# @see https://api.gapintelligence.com/api/doc/v1/ad_shares
module AdShares
# Requests and returns ad shares
#
# @param params [Hash] parameters of the http request
# @param options [Hash] the options to make the request with
# @yield [req] The Faraday request
# @retur... |
class AddCustomerNameToProjectHistory < ActiveRecord::Migration
def change
remove_column :project_histories, :customer_name
add_reference :project_histories, :customer_name, index: true
change_column :ranks, :code, :string, null:false, limit: 32
change_column :clearance_levels, :code, :string, null: ... |
class ChangeTitleToNullFalsePosts < ActiveRecord::Migration[5.2]
def up
change_column_null :posts, :title, false, 0
change_column :posts, :title, :string, default: 0
end
end
|
# encoding: utf-8
class AuthenticationsController < ApplicationController
def callback
# raise request.env["omniauth.auth"].to_yaml
if auth.authenticated?
# warden.set_user auth.user
session[:user_id] = auth.user.id
redirect_to root_url, notice: "Logged in."
elsif user_signed_in?
... |
require 'spec_helper'
describe GroupDocs::Signature::Envelope::Log do
it_behaves_like GroupDocs::Api::Entity
it { should have_accessor(:id) }
it { should have_accessor(:date) }
it { should have_accessor(:userName) }
it { should have_accessor(:action) }
it { should have_acc... |
class TripsController < ApplicationController
def destroy
trip = Trip.find(params[:id])
trip.destroy
redirect_to flights_path
end
end
|
require "spec_helper"
describe Api::ExerciseSetsController, type: :controller do
before do
coach = create(:coach)
login(coach)
exercise_plan = create(:exercise_plan,
user: coach)
@exercise_session = create(:exercise_session,
exercise_plan: ex... |
module Arcane
module Parameters
extend ActiveSupport::Concern
included do
attr_accessor :user, :object, :action
def dup
self.class.new(self).tap do |duplicate|
duplicate.user = user
duplicate.object = object
duplicate.action = action
duplic... |
require 'rails_helper'
require 'byebug'
RSpec.describe AttractionsController, type: :controller do
before(:all) do
@fake_api_response = File.read('spec/data/fake_api.json')
end
context "shows a list of attractions" do
it "retrieves attractions if city hasn't been loaded before" do
expect(Attracti... |
# Написать метод multiply_numbers(inputs),
# который вернет произведение цифр,
# входящих в inputs.
def multiply_numbers(inputs = 0)
nums = inputs.to_s.scan(/[1-9]/)
return nil if nums.empty?
nums.map(&:to_i).inject(:*)
end
# TESTS
# #1
# if multiply_numbers() == nil
# puts "true"
# els... |
class RequestsController < ApplicationController
before_action :set_request, only: [:show, :destroy, :update, :edit]
def show
@job = Job.find(params[:job_id])
end
def new
@request = Request.new
@job = Job.find(params[:job_id])
end
def create
@request = Request.new(request_params)
@req... |
require 'rails_helper'
feature 'About page' do
scenario 'Page shows number of Projects, Tasks, Users, Members, Comments' do
visit '/'
click_on 'About'
expect(page).to have_content('0 Projects, 0 Tasks, 0 Users, 0 Members, 0 Comments')
project1 = create_project
project2 = create_project
proje... |
class Disclosure
include PageObject
include DataMagic
page_url :login_page_url
paragraph(:cl_text, :id => 'credit_limit')
paragraph(:apprmsg, :id => 'welcomemsg')
span(:disclosureheader, :class => 'head_large ng-binding')
paragraph(:timemsg, :id => 'deliverytime')
h3(:purintapr, :id => 'purchaselabel')... |
#!/usr/bin/env rspec
# Encoding: utf-8
require 'spec_helper'
provider_class = Puppet::Type.type(:package).provider(:portagegt)
describe provider_class do
describe '#install' do
describe 'repository' do
before :each do
# Stub some provider methods to avoid needing the actual software
# ins... |
LocallyApp::Application.routes.draw do
resources :users, :sites, :trips, :sessions
root 'sites#index'
delete '/signout' => 'sessions#destroy', via: :delete
get'signin' => 'sessions#new', as: :signin
get '/signup' => 'users#new', as: :signup
post '/trips/:id/activities' => 'activities#create', as: :acti... |
# Calculate the factorial recursively
def factorial(n)
if n == 0
return 1
else
n * factorial(n-1)
end
end
# Calculate the factorial iteratively
def iterative(n)
(1..n).inject { |product, n| product * n }
end
|
class AddActiveStateFieldToCampaigns < ActiveRecord::Migration
def change
add_column :campaigns, :active_state, :boolean, :default => false
end
end
|
class AddCustomStatusToEvents < ActiveRecord::Migration[4.2]
def change
change_table :events do |t|
t.string :custom_status
t.boolean :manager, default: false
end
end
end
|
require 'json'
require 'open-uri'
class GamesController < ApplicationController
def new
@letters = (0...10).map { ("a".."z").to_a[rand(26)] }
end
def call_api
@attempt = params[:word]
url = "https://wagon-dictionary.herokuapp.com/#{@attempt}"
attempt_serialized = open(url).read
JSON.parse(at... |
require 'test_helper'
class CliquesControllerTest < ActionDispatch::IntegrationTest
setup do
@clique = cliques(:one)
end
test "should get index" do
get cliques_url
assert_response :success
end
test "should get new" do
get new_clique_url
assert_response :success
end
test "should cre... |
# Service Object that gets user level data from Canvas API
class GetUserLevelDataFromCanvas
def initialize(params_for_api)
@canvas_api = params_for_api.canvas_api
@canvas_token = params_for_api.canvas_token
@course_id = params_for_api.course_id
@data = params_for_api.data
end
def call
student... |
class Entry < ActiveRecord::Base
belongs_to :user
belongs_to :task
named_scope :active, :conditions => ["`active` = ? ", true]
named_scope :find_by_task_group, lambda { |group| { :conditions => ["tasks.`group` = ? ", group], :include => :task } }
named_scope :find_within_task_id_set, lambda { |ids | { ... |
class Room < ApplicationRecord
belongs_to :coworking_unit
has_many :images, dependent: :destroy
accepts_nested_attributes_for :images
validates_presence_of :name, :capacity, :description
paginates_per 10
scope :bookable, -> { where.not(lega_object_id: [nil, ""]) }
scope :ten, -> { where("capacity <= 10... |
module Spree
module Admin
class ProductContributorsController < ResourceController
before_filter :load_product
append_before_filter :adjust_deleted_at, only: [:edit, :update]
def index
@product_contributors = @product.product_contributors.order("rank asc").page(params[:page]||1)
e... |
class Product < ApplicationRecord
validates :productphotos, :name,:description,:price,:category_id,:productcondition_id,:prefecture_id,:postagepayer_id,:shippingdate_id, presence: true
extend ActiveHash::Associations::ActiveRecordExtensions
belongs_to_active_hash :productcondition
extend ActiveHash::Association... |
module RailsLogConverter
class Configuration
class << self
attr_accessor :in_stream, :out_stream, :debug
def debug?
@debug || false
end
end
end
end |
class CreateOrderItemOptions < ActiveRecord::Migration
def change
create_table :order_item_options do |t|
t.integer :order_item_id
t.integer :wesell_item_option_id
t.string :name
t.decimal :price, :precision => 8, :scale => 2, default: 0
t.timestamps
end
end
end
|
class FixMissingColumnInHeroku < ActiveRecord::Migration
def change
change_column :leads, :aquisition_source, :text
end
end
|
class UsersController < ApplicationController
def show
@phone = Phone.new
end
def create_phone
@phone = current_user.phones.create(phone_params)
if @phone.save
flash[:success] = "¡Número Agregado!"
redirect_to profile_path
else
render 'show'
end
end
def destroy... |
require 'spec_helper'
require 'kintone/command/records'
require 'kintone/api'
describe Kintone::Command::Records do
let(:target) { Kintone::Command::Records.new(api) }
let(:api) { Kintone::Api.new("example.cybozu.com", "Administrator", "cybozu") }
describe "#get" do
subject { target.get(app, query, fields) ... |
require 'test_helper'
class SecrateCodesControllerTest < ActionController::TestCase
setup do
@secrate_code = secrate_codes(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:secrate_codes)
end
test "should get new" do
get :new
assert_res... |
class Board
attr_reader :size
def initialize(number)
@grid = Array.new(number) {Array.new(number, :N)}
@size = number*number
end
def [](array)
@grid[array[0]][array[1]]
end
def []=(position, value)
@grid[position[0]][position[1]] = value
end
def num_s... |
FactoryGirl.define do
total_architectures = Metasploit::Model::Architecture::ABBREVIATIONS.length
total_platforms = Metasploit::Model::Platform.fully_qualified_name_set.length
targets_module_types = Metasploit::Model::Module::Instance.module_types_that_allow(:targets)
sequence :metasploit_model_module_target_m... |
FactoryGirl.define do
factory :page do
name { Faker::Lorem.words(2).join(' ').capitalize }
title { Faker::Lorem.word }
content { (Faker::Lorem.words(7).join(' ') + '.').capitalize }
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_locale
before_action :sign_out_if_inactive, if: -> { current_user.present? && !current_user.active }
rescue_from ActionControl... |
require 'rails_helper'
context 'logged out' do
before { Restaurant.create(name: 'Ledbury', cuisine: 'French') }
it 'cannot delete restaurants' do
visit '/restaurants'
expect(page).to have_content 'Ledbury'
expect(page).not_to have_link 'Delete Ledbury'
end
end
context 'logged in as the restaurant cr... |
class Congregation < ActiveRecord::Base
belongs_to :region
has_many :members
end
|
class Task < ApplicationRecord
before_create :init
has_many :tag_tasks, dependent: :destroy
has_many :tags, through: :tag_tasks
def init
self.completed = false if self.completed.nil?
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(resource)
messages_path(resource)
end
end
|
class Admin::CompaniesController < Admin::ApplicationController
def index
@companies = Company.all
end
end
|
#!/usr/bin/env ruby
# Yaml parser via https://gist.github.com/johncarney/7332f7b2075b86ea52177a4a82453806
require "psych"
require "pp"
ValueWithLineNumbers = Struct.new(:value, :line)
class Psych::Nodes::ScalarWithLineNumber < Psych::Nodes::Scalar
attr_reader :line_number
def initialize(*args, line_number)
... |
class NumberCollection < Array
def initialize(collection)
collection.each{|element|
self << element.to_i if is_number? element
}
end
def negatives
self.select{|number| number < 0}
end
def is_number?(number)
number.match(/\A[+-]?\d+?(_?\d+)*(\.\d+e?\d*)?\Z/) == nil ? false : true
end
end |
#==============================================================================
# ** RPG::UsableItem
#------------------------------------------------------------------------------
# Autor: zh99998
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
d... |
class ChangeVictorIdToWinnerIdInMatches < ActiveRecord::Migration[5.2]
def change
rename_column :matches, :victor_id, :winner_id
end
end
|
require 'spec_helper'
describe 'Users SO' do
let(:parameters) do
{
provider: 'test_provider',
uid: 36_315_066,
name: 'test',
avatar_url: 'test.jpg'
}
end
describe 'create' do
before { Users::Create.run parameters }
it { byebug; expect(User.count).to eq 1 }
describe ... |
namespace :events do
desc "Update events with empty coordinates"
task :update_coordinates => :environment do
events = Event.where(latitude: nil, longitude: nil)
events.each do |event|
event.geocode
if event.save
puts "#{event.title} was successfully updated"
else
puts "ERROR: #{event.ti... |
class ActivitiesController < ApplicationController
# GET /activities
# GET /activities.xml
def index
@activities = Activity.all
# respond_to do |format|
# format.html # index.html.erb
# format.xml { render :xml => @activities }
# format.json do
# render :json => {
# :co... |
class User < ApplicationRecord
validates_presence_of :password,
:first_name,
:last_name,
:street_address,
:city,
:state,
:zip
validates :user_name, uniqueness: true, presence: true
ha... |
class Ship
attr_reader :size, :hits
DEFAULT_SIZE = 2
def initialize options = {}
@size = options.fetch(:size, DEFAULT_SIZE)
@hits = 0
end
def hit
fail 'It is already sunk!' if sunk?
@hits += 1
end
def sunk?
@hits == @size
end
end
|
# Add the deploy directory to the load path
$:.unshift File.join(File.dirname(__FILE__),'deploy')
require 'hesburgh/common'
require 'hesburgh/git'
require 'hesburgh/vm'
require 'hesburgh/rails'
require 'hesburgh/rails_db'
require 'hesburgh/jenkins'
set :application, 'freshwriting'
set :repository, "https://github.com... |
class Location < ActiveRecord::Base
geocoded_by :full_street_address
after_validation :geocode
def full_street_address
address
end
end
|
# == Schema Information
# Schema version: 20110328133929
#
# Table name: facts
#
# id :integer not null, primary key
# user_id :integer
# ftype :string(255)
# question :string(255)
# header :string(255)
# text :text
# created_at :datetime
# updated_at :datetime
#
class Fact... |
class HellaserversController < ApplicationController
def index
@hellaservers = Hellaserver.find(:all)
respond_to do |format|
format.html
format.xml { render :xml => @hellaservers }
end
end
def show
@hellaserver = Hellaserver.find(params[:id])
@status = @hellaserver.call('status'... |
class MP3Importer
attr_reader :path, :files
def initialize(path)
@path = path
@files = Dir["#{@path}/*.mp3"]
@files = @files.collect { |file| file.gsub("#{@path}/", "") }
end
def import
@files.each do |file|
artist = Song.new_by_filename(file)
end
end
end
|
module I18nMultisite
module Fallbacks
def translate(locale, key, options = {})
return super if ::I18n.namespace.blank?
default = extract_non_symbol_default!(options) if options[:default]
scope = Array.wrap(options.delete(:scope))
namespace = Array.wrap(::I18n.namespace)
(name... |
# This file is part of PacketGen
# See https://github.com/sdaubert/packetgen for more informations
# Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net>
# This program is published under MIT license.
# frozen_string_literal: true
require 'rasn1'
module PacketGen
module Header
# @abstract Base clas... |
Pod::Spec.new do |s|
s.name = "SwiftRLP"
s.version = "1.1"
s.summary = "RLP implementation in vanilla Swift for iOS ans macOS"
s.description = <<-DESC
RLP implementation in vanilla Swift, intended for mobile developers of wallets, Dapps and Web3.0
DESC
s.homepage = "https://... |
module Backend
class ChargesController < BackendController
before_filter :find_charge, only: [:show, :edit, :update, :destroy]
def index
@charges = Charge.all.order(created_at: 'DESC')
end
def new
@charge = Charge.new
end
def create
@charge = Charge.create(charge_params)
... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
require 'helper'
describe Trellohub::Form::Card do
describe '#valid_attributes' do
it 'returns valid_attributes' do
expect(Trellohub::Form::Card.valid_attributes).to eq %i(
closed
desc
idBoard
idList
name
idMembers
)
end
end
describe '#accessib... |
class Admin::ImagesController < AdministrativeController
load_and_authorize_resource
# Save image for the product
def create
@image = Image.new(params[:image])
if @image.save
flash[:notice] = "Image uploaded"
redirect_to :back, :notice => "Image successfully uploaded"
else
redire... |
WIN_COMBINATIONS =[
[0,1,2],
[3,4,5],
[6,7,8],
[0,3,6],
[1,4,7],
[2,5,8],
[0,4,8],
[6,4,2]
]
#display_board Method
def display_board(board)
puts " #{board[0]} | #{board[1]} | #{board[2]} "
puts "-----------"
puts " #{board[3]} | #{board[4]} | #{board[5]} "
puts "-----------"
puts " #{board[6]... |
class AddContestIdToPasswordTiers < ActiveRecord::Migration[5.2]
def change
add_reference :password_tiers, :contest, foreign_key: true
end
end
|
languages = {
:oo => {
:ruby => {:type => "interpreted"},
:javascript => {:type => "interpreted"},
:python => {:type => "interpreted"},
:java => {:type => "compiled"}
},
:functional => {
:clojure => {:type => "compiled"},
:erlang => {:type => "compiled"},
:scala => {:type => "compil... |
module Kuhsaft
class AccordionBrick < ColumnBrick
def user_can_delete?
true
end
def to_style_class
[super, 'accordion'].join(' ')
end
def allowed_brick_types
%w(Kuhsaft::AccordionItemBrick)
end
end
end
|
class UsersController < ApplicationController
def new
@post = Post.find(params[:post_id])
@comment = @post.comments.new(parent_id: params[:parent_id])
end
def create; end
def edit
@user = User.find_by('LOWER(user_name)= ?', params[:user_name].downcase)
end
def update
@user = User.find(par... |
class StylistAdmin::Assigns::ProductsController < StylistAdmin::Assigns::BaseController
def update
@product = Product.find(params[:id])
roomtype = @product.showroom_type # returns bedroom or livingroom root
showroom = user.send(roomtype.name.downcase.to_sym)
if showroom && !ShowroomProduct.where(:pr... |
class Zombie
attr_reader :name, :x, :y
def initialize(name = nil, posx = nil, posy = nil)
@name = name || 'Come cerebro'
@x = posx || rand(10)
@y = posy || rand(10)
end
def walk
@x += rand(-1..1) unless @x > 10 || @x > 1
@y += rand(-1..1) unless @y > 10 || @y > 1
end
def to_s
puts "El zombie #{@na... |
class Sights < ActiveRecord::Migration
def change
create_table :sights do |t|
t.string :sight_name
t.string :category
t.string :feature
t.references :locations
end
end
end
|
class PostsController < ApplicationController
# before_action :authenticate_user!, except: [:index, :show]
before_action :set_post, only: %i[edit update destroy]
def index
@posts = if current_user && current_user.role != 'user'
Post.all
else
Post.all.where(published... |
Given 'the package prefix is {string}' do |package_prefix|
@package_prefix = package_prefix
end
Given 'a key called {string} has a known value' do |name|
@stored_known_values[name] = Helpers.get_env(name) || name + "_" + SecureRandom.uuid
end
Given 'the value {int} is saved in a key called {string}' do |value, na... |
require_relative 'application_record'
class Session < ApplicationRecord
belongs_to :course
validates :date, presence: true
end
|
class LeagueEdition < ActiveRecord::Base
belongs_to :league
belongs_to :champion, class_name: 'Club', foreign_key: :champion_id
has_many :participants
has_many :clubs, through: :participants
validates :league, presence: true
validates :edition_at, presence: true
has_enumeration_for :status, with: Leagu... |
class UsersController < ApplicationController
before_action :authenticate_user!, only: [:edit, :update]
before_action :user_info, only: [:show, :edit, :update]
before_action :user_verification, only: [:edit, :update]
def show
posts = Post.all.order(created_at: :desc)
@rooms = @user.rooms
end
def e... |
#encoding: utf-8
class Tourreportworkcontent < ActiveRecord::Base
# 班报的工作内容实体
#coresamplelength : 岩心长度
#drillbit : 钻头
#drillfootage : 进尺
#finishtime : 结束时间
#starttime: 开始时间
#pumppressure: 泵压
#pumpquantity: 泵量
#rotatespeed: 转速
#tourreport : 班报
#workcontent : 工作内容
attr_accessible :coresamplelengt... |
module RailsPipeline
module SubscriberHandler
class Logger < BaseHandler
def handle_payload
# We'll need to GPG encrypt this
# Maybe it should encrypt using a public key set in environment variable
# Then the subscriber app would set it when installing the pipeline
# Would ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.