text stringlengths 10 2.61M |
|---|
class MoviesController < ApplicationController
before_action :logged_in?, :except => [:show, :index]
#before_action :admin_only, :except => [:show, :index]
def index
#@movies = Movie.all
@genres = Genre.all
if !params[:genre].blank?
@movies = Movie.by_genre(params[:genre])
@search_genre ... |
# frozen_string_literal: true
module GraphQL
VERSION = "1.9.17"
end
|
module GemBench
class GemfileLineTokenizer
GEM_REGEX = /\A\s*gem\s+([^#]*).*\Z/.freeze # run against gem lines like: "gem 'aftership', # Ruby SDK of AfterShip API."
GEM_NAME_REGEX = /\A\s*gem\s+['"]{1}(?<name>[^'"]*)['"].*\Z/.freeze # run against gem lines like: "gem 'aftership', # Ruby SDK of AfterShip API."... |
source "http://rubygems.org"
#
# Chef + Vagrant
#
gem 'chef', "~> 10.12.0"
gem 'ironfan', "~> 3.1.6"
gem 'vagrant', "~> 1.0"
gem 'veewee', "~> 0.2"
#
# Test drivers
#
gem 'rake'
gem 'bundler', "~> 1"
gem 'rspec', "~> 2.5"
gem 'cucumber'
gem 'cuken', :path => 'vend... |
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '~> 3.2.0'
# CORE SYSTEM
gem 'unicorn' # Multi-process rack server
gem 'pg' # Postgres
gem 'seed-fu', '~> 2.1' # Database seeding plans
gem 'dalli' # Memcached integrati... |
Shipshop::Application.routes.draw do
resources :orders
resources :customers
root to: 'customers#index'
end
|
# The list of available API method names:
# (16/22)
#
# [-] activateDeactivateService
# [+] callMeBack
# [+] changeLanguage
# [+] changeSuperPassword
# [-] changeTariff
# [+] getAvailableTariffs
# [+] getBalances
# [+] getExpensesSummary
# [+] getLanguages
# [+] getPaymentsHistory
# [-] getSeparateBalances
# [+] getSer... |
class CreateShips < ActiveRecord::Migration
def change
create_table :ships do |t|
t.integer :game_id
t.integer :player_n
t.integer :sunken
t.integer :x
t.integer :y
end
end
end
|
template '/etc/sysctl.conf' do
source 'ip_forwarding/sysctl.conf.erb'
owner 'root'
group 'root'
mode '0644'
end
bash 'enable ip forwarding' do
code <<-CODE
sysctl net.ipv4.ip_forward=1
CODE
not_if 'grep "net.ipv4.ip_forward=1" /etc/sysctl.conf'
end
|
#!/usr/bin/env ruby
require_relative "load_path"
LoadPath.initialize!(__FILE__)
require "outputs/executor"
require "outputs/fifo_writer"
require "outputs/stdout_writer"
require "rspec_commands/entire_file"
require "rspec_commands/specific_line"
require "formatting/colors"
require "formatting/presented_time"
requi... |
require "application_system_test_case"
class ProductosTest < ApplicationSystemTestCase
setup do
@producto = productos(:one)
end
test "visiting the index" do
visit productos_url
assert_selector "h1", text: "Productos"
end
test "creating a Producto" do
visit productos_url
click_on "New Pr... |
Models::Output::UserOutput = GraphQL::ObjectType.define do
name 'User'
field :id, types.Int
field :name, types.String
field :email, types.String
field :username, types.String
field :endorsees do
type types[Models::Output::UserOutput]
resolve ->(obj, args, ctx) {
obj.endorsees.map(&:endorsee)
... |
get '/profile' do
if session[:user_id]
user = User.find(session[:user_id])
if user
erb :profile, :locals => {:name => user.name,
:username => user.username,
:tweets => user.tweets,
:user => user,
:current_user => true,
:logged_in_user => true,
... |
# encoding: UTF-8
# frozen_string_literal: true
FactoryGirl.define do
factory :post, class: Monologue::Post do
published true
association :user
association :site
sequence(:title) { |i| "post title #{i}" }
content 'this is some text with accents éàöûù and even html tags <br />'
sequence(:url) {... |
module ProfileImageable
extend ActiveSupport::Concern
included do
mount_uploader :profile_image, ProfileImageUploader
mount_base64_uploader :profile_image, ProfileImageUploader, base_filename: :profile_picture
# create dinamic methods to handle cropping
crop_uploaded :profile_image
process_i... |
require 'spec_helper'
describe User do
let(:user) {FactoryGirl.create(:user)}
let(:other_user) { FactoryGirl.create(:user) }
subject { user }
it { should respond_to(:name) }
it { should respond_to(:email) }
it { should respond_to(:username)}
it { should respond_to(:password_digest) }
it {... |
module Feeder
module Concerns::Models::Item
extend ActiveSupport::Concern
included do
include Feeder::Concerns::Helpers::Filter
scope :unblocked, -> { where blocked: false }
scope :blocked, -> { where blocked: true }
belongs_to :feedable, polymorphic: true
def type
... |
class BookingStatus < ActiveRecord::Base
has_many :guide_posts
has_many :property_posts
has_many :angler_posts
def to_s
status
end
end
|
require "test_helper"
describe Orderitem do
let(:one) { orderitems(:one) }
it "has an order" do
one.order.must_be_kind_of Order
end
it "has a product" do
one.product.must_be_kind_of Product
end
it "quantity must be present" do
one.valid?.must_equal true
one.quantity = nil
one.valid?.... |
require 'rails_helper'
RSpec.describe "Tasks", type: :system do
let(:user) { create(:user) }
let(:other_user) { create(:user) }
let(:task) { create(:task, user: user) }
describe 'ログイン前' do
describe 'ページ遷移' do
context '新規登録画面に遷移' do
it '新規登録画面に遷移できない' do
visit new_task_path
... |
=begin
filename = ARGV[0]
abort("Please provide a filename") if filename.nil?
def count_words(document)
document.split(" ").reduce(Hash.new(0)) { |hash, word| hash[word] += 1 and hash }.sort_by { |key, val| [-val, -key.length] }
end
count = count_words(File.read(filename))
puts "Word counts for #{filename}"
count... |
class RemoveUserColumnFromAnnouncement < ActiveRecord::Migration[5.1]
def change
remove_column :announcements, :user_id
end
end
|
class Admin::HitsController < ApplicationController
skip_after_action :track_action
layout "admin"
def index
@hits = VisitEvent.group_by_day(:created_at).count
end
end
|
class FontNotoSansGujarati < Formula
head "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansGujarati-unhinted.zip", verified: "noto-website-2.storage.googleapis.com/"
desc "Noto Sans Gujarati"
homepage "https://www.google.com/get/noto/#sans-gujr"
def install
(share/"fonts").install "NotoSansGujara... |
require 'RMagick'
class User < ActiveRecord::Base
attr_accessible :image, :name, :provider, :screenname, :uid, :saiyan_on, :saiyan_state, :smiley_on, :smiley_state, :last_tweet
def self.find_or_create_with_omniauth(auth)
the_user = self.find_by_screenname auth[:info][:nickname]
if the_user
return t... |
class AddDrawRefToPicks < ActiveRecord::Migration
def change
add_reference :picks, :draw, index: true
end
end
|
module VCloudAPI
module Wrappers
class SupportedVersions
pattr_initialize :doc
def login_url(version)
version_info = version_infos.find { |vi| vi["Version"] == version.to_s }
version_info.try(:[], "LoginUrl")
end
def to_a
version_infos.map { |vi| vi["Version"] }
... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
skip_before_filter :verify_authenticity_token
def append_info_to_payload(payload)
super
case
when payload[:status] < 300
payload[:level] = 'INFO'
when payload[:status] < 400
payload[:lev... |
require_relative 'db_connection'
require 'active_support/inflector'
# NB: the attr_accessor we wrote in phase 0 is NOT used in the rest
# of this project. It was only a warm up.
class SQLObject
def self.columns
# ...
return @columns if !@columns.nil?
data = DBConnection.execute2(<<-SQL)
SELECT
... |
class ArtsController < ApplicationController
skip_before_action :authenticate_user!, only: [:index, :show]
def index
@arts = policy_scope(Art).order(created_at: :desc)
end
def show
@art = Art.find(params[:id])
authorize @art
end
def new
@art = Art.new
authorize @art
end
def cre... |
require 'ostruct'
module Zxcvbn
class Match < OpenStruct
def to_hash
hash = @table.dup
hash.keys.sort.each do |key|
hash[key.to_s] = hash.delete(key)
end
hash
end
end
end |
require 'spec_helper'
describe Player do
self.instance_exec &$test_vars
it "should have many event_prompts" do
player.should respond_to(:event_prompts)
end
it "should have many prompts" do
player.should respond_to(:prompts)
end
it "should have one event" do
player.should respond_to(:event)
... |
class AddStatusToOffers < ActiveRecord::Migration[5.0]
def change
add_column :offers, :status, :binary, limit: 1, default: 1
end
end
|
class CRM
def main_menu
#puts "\e[H\e[2J"
print_main_menu
@user_selected = gets.to_i
call_option(@user_selected)
while @user_selected != 6
main_menu
end
end
def print_main_menu
puts "\e[H\e[2J"
puts IO.readlines('crm_logo.txt')
puts "[1] Add a new contact"
puts "[... |
json.array!(@messages) do |message|
json.extract! message, :user_id, :type, :content, :read, :text
json.url message_url(message, format: :json)
end
|
require 'spec_helper'
RSpec::Matchers.define :require_presence_of do |attribute|
match do |actual|
object = actual.is_a?(Class) ? actual.new : actual
object.send(:"#{attribute}=", nil)
not_valid_for_nil_value = !object.valid?
errors_on_validated_attribute = object.errors[attribute].any?
not_vali... |
require 'test_helper'
class CustomersessionsControllerTest < ActionDispatch::IntegrationTest
setup do
@customersession = customersessions(:one)
end
test "should get index" do
get customersessions_url
assert_response :success
end
test "should get new" do
get new_customersession_url
asser... |
module Africansms
class Configuration
attr_accessor :api_key, :username, :shortcode
def initialize
@api_key = nil
@username = nil
@shortcode = nil
end
def api_key!
api_key || raise(AfricansmsError, 'No api key specified.')
end
def username!
username || raise(Af... |
# Print all odd numbers from 1 to 99, inclusive. All numbers should be printed on separate lines.
=begin
(1..99).each do |number|
p number if number.odd?
end
=end
1.upto(99) do |num|
p num if num % 2 == 1
end |
module UtilityMethods
def create_new_player(player_name=nil, role_cd=User.roles[:player],logger=Logger.new(STDOUT))
unless player_name
logger.info 'Please enter player name'
player_name = gets.chomp().strip().humanize
end
User.new({ :name => player_name, :role_cd => role_cd})
end
def fetch_player_respo... |
class AddPeopleRefToTeams < ActiveRecord::Migration[6.0]
def change
add_reference :teams, :people, null: false, foreign_key: true
end
end
|
class CharacteristicsController < ApplicationController
# GET /characteristics
# GET /characteristics.xml
def index
@characteristics = Characteristic.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @characteristics }
end
end
# GET /characteristics... |
# frozen_string_literal: true
RSpec.describe I18nDefScanner::YAML::Visitors::ToRuby do
let(:instance) { described_class.create }
describe '#revive_hash' do
subject(:result) do
stub_instance_accept_method
instance.revive_hash(hash, obj)
end
let(:hash) { Hash[some_key: :some_value] }
le... |
class VideoSerializer < ActiveModel::Serializer
#embed :ids
attributes :id, :url, :thumb
has_many :annotations, embed: :ids
has_many :tags, embed: :objects
end |
class Person < ActiveRecord::Base
belongs_to :social_info, :dependent => :destroy
belongs_to :team
validates :first_name, presence:true
validates :last_name, presence:true
accepts_nested_attributes_for :social_info
def name
"#{first_name} #{last_name}"
end
attr_accessible :first_name... |
class TicketdetailsController < ApiController
before_action :require_login
def update
ticketDetail = TicketDetail.find(params[:id])
#test route
if ticketDetail.return_date == nil
#increase book in lib
book = Book.find(params[:book_id])
check = true
if params[:book_is_good] == "tr... |
class Platform < ActiveRecord::Base
has_many :ports, :dependent => :nullify
has_many :platform_aliases, :dependent => :destroy
has_many :games, :through => :ports
belongs_to :manufacturer, :counter_cache => true
validates_length_of :name, :minimum => 1
validates_uniqueness_of :name
validate :name_not_i... |
module Sec
module Entities
class ExerciseRepresenter < Grape::Roar::Decorator
include ::Roar::JSON
property :uuid
property :name
property :repetitions
property :weight
property :time
property :distance
property :main_muscle
property :cardio
property :is_... |
require 'rails_helper'
RSpec.describe "welcome/index.html.erb", type: :view do
describe 'with no current user signed in' do
it 'should have a nav element' do
visit '/'
page.has_css?('nav')
end
it 'should have a navbar with a login link' do
visit '/'
find_link('Sign in With Reddit... |
class AddsCountersToCities < ActiveRecord::Migration
def change
add_column :cities, :places_count, :integer, default: 0
end
end
|
require 'erb'
require_relative 'params'
require_relative 'session'
require 'active_support/core_ext'
class ControllerBase
attr_reader :params
def initialize(req, res, route_params = {})
@request = req
@response = res
@params = Params.new(req, route_params).params
@already_built_response = false
... |
FactoryGirl.define do
factory :financial_third do
association :financial_third_service
association :financial
association :third_type
association :third
association :lawyer
name {Faker::Name.name}
fantasy_name {Faker::Company.buzzword}
social_name {Faker::Company.name}
quantity {Faker::Number.number... |
class CreateMailMessages < ActiveRecord::Migration
def self.up
create_table :mail_messages do |t|
t.string :subject
t.text :body
t.integer :sender_id
t.boolean :has_template, :default => false
t.text :additional_info
t.integer :school_id
t.timestamps
end
add_ind... |
class CreateCommits < ActiveRecord::Migration
def change
create_table :commits do |t|
t.string :sha, null: false
t.text :payload, null: false
t.timestamps
end
add_index :commits, :sha, unique: true
# Forgot to do null: false on this one.
change_column :comments, :payload, :tex... |
def letter_count(str)
letters = str.gsub(' ', '').downcase.chars #get all the letters in the string
#inject letters with an initial value of an empty hash
#then set the name, value pair to be the letter and the
#number of times that letter appears. Pass the hash back
#to the enumerator
letters.inject( ... |
ONES = {1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine'}
TENS = {1 => 'ten', 2 => 'twenty', 3 => 'thirty', 4 => 'forty', 5 => 'fifty', 6 => 'sixty', 7 => 'seventy', 8 => 'eighty', 9 => 'ninety'}
TEENS = {11 => 'eleven', 12 => 'twelve', 13 => 'thi... |
require 'spec_helper'
describe DynamicRecord::Class do
before do
@blog = FactoryGirl.create :blog
end
it "should've create the class" do
@blog.new_record?.should be_false
@blog.attribute_names.should == ["title", "author", "publication_date", "body_text"]
end
it "should create a constant when m... |
set :rails_env, "production"
# Primary domain name of your application. Used in the Apache configs
set :domain, "unepwcmc-014.vm.brightbox.net"
## List of servers
server "unepwcmc-014.vm.brightbox.net", :app, :web, :db, :primary => true, :jobs => true
set :application, "carbon-benefits"
set :server_name, "carbon-b... |
=begin
A name generator for RPG characters.
=end
class NameGenerator
def initialize
@syllables = ["fo", "ra", "dok", "lok", "sha", "ma", "ka", "si", "ju", "nu"]
end
def generate
max_syllables = 3
rng = Random.new
num_syllables = rng.rand(1..max_syllables)
name = ""
(1..num_syllables).each do |x|
s... |
class Ability
include CanCan::Ability
def initialize(user)
@user = user ? user : User.new
@user ? user_rules : guest_rules
end
def user_rules
@user.roles.each { |role| send("#{role}_rules") }
default_rules
end
def admin_rules
can :manage, :all
end
def member_rules
can :read, ... |
require 'rails_helper'
describe 'Posts' do
context 'visitor' do
it 'sees the content of a post' do
owner = create :user
post = create :post, user: owner, title: 'Post Title', body: 'This is a blog post'
visit root_path
click_link 'Blog posts'
click_link 'Post Title'
expect... |
class AddPasswordToUsers < ActiveRecord::Migration
def self.up
add_column :users, :encrypted_password, :string
end
def self.down
remove_column :users, :encrypted_password
end
end
|
# frozen_string_literal: true
require "test_helper"
class UserTest < ActiveSupport::TestCase
%i[admin].each do |user|
test "users(:#{user}) is valid" do
model = users(user)
assert model.valid?, "Expected users(:#{user}) to be valid, got errors: #{model.errors.full_messages.to_sentence}"
end
en... |
class ScoreSerializer < ActiveModel::Serializer
attributes :id, :score, :player_id, :round_id
end
|
module MiniAether
MAVEN_CENTRAL_REPO = 'http://repo1.maven.org/maven2'.freeze
class LoggerConfig
attr_reader :level
def initialize
@level = 'INFO'
end
def level=(level)
@level = case level
when Symbol, String
level.to_s.upcase
when Logger... |
class Null
def to_s
"I don't exist"
end
def !
true
end
def nil?
true
end
def falsey?
true
end
def method_missing(name, *args, &block)
self
end
end |
class AddPowerSupplyCountToHardwareProfile < ActiveRecord::Migration
def self.up
add_column "hardware_profiles", "power_supply_count", :integer, :default => 0
end
def self.down
remove_column "hardware_profiles", "power_supply_count"
end
end
|
require "rails_helper"
module WasteExemptionsShared
RSpec.describe EnrollmentsController, type: :controller do
# vital when testing an isolated engine
routes { Engine.routes }
describe "EnrollmentsController - State management and Navigation" do
let(:valid_session) { {} }
describe "GET #b... |
module Cucumber
module PathsAndPageElementsCore
def self.exec_block(input, type)
exec_put.exec_block(input, type)
end
def self.Put(regexp, type, &proc)
exec_put.Put(regexp, type, &proc)
end
def self.exec_put
@paths_and_page_elements ||= PathsAndPageElements.new
end
... |
class HomeController < ApplicationController
def index
end
def redeem
voucher_uuid = params.permit(:voucher)[:voucher]
voucher = Voucher.find_by_uuid(voucher_uuid)
if not voucher or voucher.used?
flash[:error] = 'Please provide a valid voucher code.'
return redirect_to root_path
end
... |
module Refinery
module Caststone
class ProductView
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
include ActiveSupport::Configurable
include Refinery::ImageHelper
attr_accessor :context, :id, :product,... |
class Api::GamesController < ApiController
def update
@game = Game.find(params[:id])
if @game.update(minutes_booked: params[:minutes_booked])
success_json @game
else
error_json @game.errors, 422
end
end
end |
class Todo
include Mongoid::Document
include Mongoid::Paranoia
include Mongoid::Timestamps
field :title
referenced_in :user
end
|
class AddKnowledgeLevelToWorkshops < ActiveRecord::Migration
def self.up
add_column :events, :knowledge_level, :string unless column_exists?(:events, :knowledge_level)
end
def self.down
Profile.reset_column_information
remove_column :events, :knowledge_level, :string if column_exists?(:events, :knowl... |
class Flat < ApplicationRecord
belongs_to :user
has_many :bookings
has_many :reviews
has_many_attached :photos
geocoded_by :address
after_validation :geocode, if: :will_save_change_to_address?
include PgSearch::Model
pg_search_scope :search_by_name_and_address,
against: %i[name addr... |
module BigToe
class Stub
def initialize
@invocations = {}
@expectations = {}
end
def method_missing(method, *args)
@invocations[method.to_sym] = args
expectation_for(method.to_sym).return_value_for(args)
end
def has_received?(method)
@invocations.key?(method.to_sym)... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
# 强制登录重定向
before_action :authenticate_user!
# 用户登陆后重定向到修改密码页面
def after_sign_in_path_for(resource_or_scope)
if current_user.password_resetting == true
current_user.password_resetting = false
current_u... |
module Docks
class Parser
include FromHash
attr_accessor :filename, :list
fattr(:body) do
open(filename).read
end
fattr(:lines) do
body.split("\n").map { |x| Line.new(:raw => x, :parser => self) }
end
def to_s
lines.join("\n")
end
end
end |
class ApiClient
attr_accessor :end_point, :conn
def initialize(end_point:)
@end_point = end_point
@conn = Faraday.new
end
def get_ip_details(ip:)
url = end_point+"#{ip}"
_get(url: url)
end
private
def _get(url:)
Rails.logger.info "Get Details for: #{url}"
response = conn.get u... |
class ApplicationController < ActionController::Base
def after_sign_in_path_for(resource)
stored_location_for(resource) || home_dashboard_path
end
private
#def current_user
# token = request.headers["Authorization"].to_s
# User.find_for_database_authentication(authentication... |
class CreateBlogPostAdditions < ActiveRecord::Migration
def change
create_table :blog_post_additions do |t|
t.string :emotions
t.references :section
t.references :blog_post
end
end
end
|
require 'spec_helper'
RSpec.describe Tuxedo do
let(:view_class) { Struct.new(:view) { include Tuxedo::ActionView::Helpers } }
let(:view) { view_class.new }
let(:dummy) { Dummy.new }
let(:presenter_instance) { OverwriteNamePresenter.new(dummy, view) }
it 'addes an alias to the original object using the class... |
class FontReadexPro < Formula
head "https://github.com/google/fonts/raw/main/ofl/readexpro/ReadexPro%5BHEXP%2Cwght%5D.ttf", verified: "github.com/google/fonts/"
desc "Readex Pro"
desc "Family of variable fonts"
homepage "https://fonts.google.com/specimen/Readex+Pro"
def install
(share/"fonts").install "Re... |
class Post < ActiveRecord::Base
acts_as_taggable # Alias for acts_as_taggable_on :tags
belongs_to :user
belongs_to :category
has_many :comments
end
|
module Hijack
class OutputReceiver
def self.pid
@pid
end
def self.start(remote)
@started = true
@instance = new(remote)
@pid = fork do
@instance.start
end
end
def self.started?
@started
end
def self.stop
if started?
P... |
class DeviceLocation < ActiveRecord::Base
validates :location_id, :presence => true
belongs_to :device
belongs_to :location
end
|
# Write the numbers from 50 to 15 using downto
# Write the letters from "B" to "O" using upto
puts "50 to 15 using downto:"
50.downto(15) {|x| print "#{x} "}
puts "\n"
puts "B to O using upto:"
"B".upto("O") {|y| print "#{y} "}
|
# -*- encoding: utf-8 -*-
module Brcobranca
module Boleto
class Credisis < Base # CrediSIS
attr_accessor :codigo_cedente
validates_presence_of :codigo_cedente, message: 'não pode estar em branco.'
validates_length_of :agencia, maximum: 4, message: 'deve ser menor ou igual a 4 dígitos.'
v... |
module RegularizationTreatment
class KinsController < ApplicationController
before_action :set_requeriment
before_action :set_step
before_action :set_cadastre
def new
@kin = @cadastre.kins.new
end
def create
@kin = @cadastre.kins.new(set_params)
@kin.save
end
def... |
class ValidateStep
def validate_post_step(step_params)
errors = []
params = JSON.parse(step_params.to_json)
return { error: "Deve possuir um JSON" } if params == {} or params == "{}" or params.nil?
return { error: "Deve possuir o campo Nome" } unless params.include?("nome")
return { error: "Deve p... |
require 'HTTParty'
require 'nokogiri'
require 'pry'
require 'json'
module Tacomber
module Listing
def self.fetch_and_parse url
html = fetch url
parse html
end
def self.fetch url
HTTParty.get url
end
def self.parse html
doc = Nokogiri::HTML html
title = doc.css('sp... |
require File.dirname(__FILE__) + '/../spec_helper'
describe User, "with fixtures loaded" do
fixtures :users
it "should have a non-empty collection of users" do
User.find(:all).should_not be_empty
end
it "should have six records" do
User.should have(6).records
end
it "should find an activated u... |
versions = [node[:pkg_build][:passenger][:version]]
versions += node[:pkg_build][:passenger][:versions] if node[:pkg_build][:passenger][:versions]
versions.uniq!
if(node[:pkg_build][:isolate])
node[:pkg_build][:passenger][:ruby_versions].each do |r_ver, pass_vers|
Array(pass_vers).each do |passenger_version|
... |
class UsersController < ApiController
load_and_authorize_resource
before_action :authenticate_user!, except: [:by_external_id, :confirm]
before_action :set_user, only: [:update]
# PATCH/PUT /users/1
# PATCH/PUT /users/1.json
def update
if @user.update(user_params)
if user_params[:password]
... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :tweets
has_many :comments
# 能動的関係
has_ma... |
# PHASE 2
def convert_to_int(str)
Integer(str)
rescue ArgumentError => e
p "Cannot convert #{str} to an integer!"
p "Error was #{e.message}"
end
# PHASE 3
FRUITS = ["apple", "banana", "orange"]
class CoffeeError < StandardError
def message
puts "Oh I love Coffee! ... |
class RemoveFieldsInProducts < ActiveRecord::Migration
def change
remove_column :products, :colour
remove_column :products, :size
end
end
|
class FixTypeColumnToDiet < ActiveRecord::Migration[7.0]
def change
rename_column :animals, :type, :diet
end
end
|
require 'sinatra'
require 'json'
require 'haml'
require 'yaml'
Dir[File.dirname(__FILE__) + '/lib/*.rb'].each {|file| require file }
CONFIG = YAML::load_file 'config.yml'
helpers do
def forward_action (payload, team, channel = nil)
channel = "##{channel ? channel : default_channel(team)}"
bot = channel.del... |
module MotionBuild ; module Rules
class LinkObjectsRule < MultifileRule
def input_extension
'.o'
end
def output_extension
''
end
def run
project.builder.notify('ld', sources, destination)
project.builder.run('clang++', ['-o', destination, *sources, *project.config.get(:l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.