text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
class AddMembershipTypeToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :membership_type, :integer, default: 0, null: false
remove_column :participations, :participation_type, :integer, default: 0, null: false
end
end
|
class AddBaseUrlToLanguageVersions < ActiveRecord::Migration
def self.up
add_column :language_versions, :base_url, :string
remove_column :redirects, :property_id
end
def self.down
remove_column :language_versions, :base_url
end
end
|
class AddColumnSubjects < ActiveRecord::Migration[6.1]
def change
add_column :subjects, :opening_year, :string
add_column :subjects, :subject_name, :string
add_column :subjects, :date, :date
add_column :subjects, :start_time, :string
add_column :subjects, :target, :string
add_column :subjects,... |
class Review < ActiveRecord::Base
belongs_to :reservation
belongs_to :guest, :class_name => "User"
validates :rating, :description, presence: true
validate :reservation_was_accepted_and_happened
private
def reservation_was_accepted_and_happened
unless !reservation.nil? && reservation.status == "ac... |
class ProfileController < ApplicationController
before_action :authenticate_user!
def show
@user = User.find(params[:id])
@posts = @user.posts
@comments = @user.comments
@tags = @user.tags
end
end |
Rails.application.routes.draw do
root to: 'top#index'
resources :repositories, only: [:index]
resources :users, only: [:index]
resources :users, only: [:show], param: :login, constraint: { login: /[^\/]+/ } do
resources :repositories, only: [:show], param: :name, constraint: { name: /[^\/]+/ }
end
# F... |
require 'spec_helper'
describe Puppet::Type.type(:openvpnas_config) do
let(:default_config) do
{
name: 'key',
value: 'value',
}
end
let(:config) do
default_config
end
let(:resource) do
described_class.new(config)
end
it 'can be added to catalog' do
catalog = Puppet::Res... |
# Модель публичного ключа пользователя
class Credential < ActiveRecord::Base
has_paper_trail
default_scope order("#{table_name}.id desc")
attr_reader :public_key_file
has_many :accesses
belongs_to :user
attr_accessible :public_key, :name, :public_key_file
validates :user, :public_key, :name... |
require 'rails_helper'
feature 'A user adds a place' do
scenario 'by filling all the required fields' do
place = build(:place)
Place.geocoding_service = double('geocoding service', coordinates: nil)
visit new_place_path
fill_in 'Nom', with: place.name
select t('kinds.codes.school'), from: 'Type'... |
# frozen_string_literal: true
class EventInviteeMessagesController < ApplicationController
before_action :admin_required, except: :show
def index
@event_invitee_messages = EventInviteeMessage.order(created_at: :desc).to_a
end
def show
item_id = params[:id].to_i
if item_id >= 0
@event_invite... |
class CreateVisits < ActiveRecord::Migration
def change
create_table :visits do |t|
t.integer :student_id
t.datetime :date_time
t.datetime :end_time
t.string :reason_num # Matches with order of options in dropdown menu.
# For example, 1="Spoke when he/she ... |
class AddAutnumIdToDevice < ActiveRecord::Migration
def change
add_reference :devices, :autnum, index: true
end
end
|
#put arrays of gifs and quotes in this file
#lksdjflksjf.sample is how to randomize from the array
def get_quote(stress)
quotes = {
"Work" => ["The secret to success is to be ready when opportunity comes. -Benjamin Disraeli","Suffering becomes beautiful when anyone bears great calamities with cheerfulness, not ... |
# Copyright (c) 2020 Jian Weihang <tonytonyjan@gmail.com>
# frozen_string_literal: true
module Rfc2047
TOKEN = /[\041\043-\047\052\053\055\060-\071\101-\132\134\136\137\141-\176]+/.freeze
ENCODED_TEXT = /[\041-\076\100-\176]*/.freeze
ENCODED_WORD = /=\?(?<charset>#{TOKEN})\?(?<encoding>[QBqb])\?(?<encoded_text>#... |
class Api::V1::FavoritesController < ApplicationController
before_action :requires_login, only: [:create, :destroy]
def create
user = the_current_user
@favorite = Favorite.new(favorites_params)
@favorite.user_id = user.id
@favorite.save
render json: @favorite
end
def destroy
favorite_i... |
module MorphAnalyzer
TAGS = {
"POST" => "часть речи",
"NOUN" => "имя существительное",
"ADJF" => "имя прилагательное (полное)",
"ADJS" => "имя прилагательное (краткое)",
"COMP" => "компаратив",
"VERB" => "глагол (личная форма)",
"INFN" => "глагол (инфинитив)",
"PRTF" => "прич... |
require 'spec_helper'
require File.join(File.dirname(__FILE__), "../../lib/reward")
describe 'EligibilityService' do
describe 'the service has defined outputs' do
fixtures :all
describe 'the eligibility service outputs to the rewards service' do
let(:account){
accounts(:account2)
}
before(:... |
class GebruikerController < ApplicationController
layout 'wide'
before_filter :redirect_403, only: [:profiel, :avatar, :uploadavatar, :upload, :setdefaultavatar, :deleteavatar]
# hit error if user is not logged in
def redirect_403
return hit_error(403) unless current_user
end
def login
if @logg... |
module ActiveRecord
class Base
# The purpose of these methods is to monkey patch ActiveRecord to track
# each and every ActiveRecord that is instantiated. This is useful when
# you want to figure out how many and which objects are being loaded.
class << self
def clear_instantiated_k... |
class Buyer < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :buyer_requests
has_many :requests, throug... |
FactoryGirl.define do
factory :model do
name { Faker::Internet.user_name }
base_dir { '/models' }
end
factory :model_sibling do
name { Faker::Internet.user_name }
base_dir { '/model_siblings' }
end
end
|
# frozen_string_literal: true
module GitHubPages
VERSION = 106
end
|
require 'util/miq-hash_struct'
require 'util/miq-xml'
require 'metadata/linux/InitProcHash'
module MiqLinux
class InitProcs
INIT_DIRS = ["/etc/rc.d/init.d", "/etc/init.d"]
RC_DIRS = ["/etc/rc.d", "/etc", "/etc/init.d"]
RC_CHECK = ["rc0.d", "runlevels"]
RUN_LEVELS1 = ['0', '1', '2', '3', '4',... |
Rails.application.routes.draw do
# makes devise look in the registrations controller for sign_up and account_update_params
devise_for :users, :controllers => { registrations: 'registrations' }
root 'proposals#index'
# ':user_name' is a dynamic parameter, meaning we can pass in diffferent user_names's
get ... |
class ApiLogsController < ApplicationController
include ActionController::Live
def index
response.headers['Content-Type'] = 'text/event-stream'
sse = SSE.new(response.stream)
api_log_import = ApiLogImport.new log_filename
api_logs = api_log_import.build_api_logs do |builded_api_logs|
sse.wr... |
require 'json'
# Helper methods defined here can be accessed in any controller or view in the application
module ServieSales
class App
module SessionsHelper
def current_user=(user)
@current_user = user
end
def current_user
@current_user ||= User.find_by_id(session[:current_user... |
class ArticleToTag < ActiveRecord::Base
validates_presence_of :article_id
validates_presence_of :tag_id
belongs_to :article
belongs_to :tag
end
|
#!/usr/bin/env ruby
require "pathname"
$LOAD_PATH << Pathname.new(__FILE__).parent + "fixtures"
$LOAD_PATH << Pathname.new(__FILE__).parent.parent + "lib"
require "rubygems"
require "spec"
require "theruck"
include TheRuck
class TestRootController < Controller
route "" do
head "Content-Type", "text/plain"
body... |
require 'rails_helper'
RSpec.describe Category, type: :model do
it "has a valid factory" do
FactoryGirl.create(:category).should be_valid
end
it "is invalid without a name" do
FactoryGirl.build(:category, name: nil).should_not be_valid
end
end
|
class YasaisController < ApplicationController
before_action :set_yasai, only: [:show, :edit, :update, :destroy]
# GET /yasais
# GET /yasais.json
def index
@yasais = Yasai.all
end
# GET /yasais/1
# GET /yasais/1.json
def show
end
# GET /yasais/new
def new
@yasai = Yasai.new
end
# G... |
FactoryGirl.define do
factory :recurring_class do
day_of_week 2
first_date "2016-02-02"
time_of_day "12:00 PM"
number_of_weeks 4
duration 60
association :class_template
association :studio
association :instructor_profile
end
end
|
# Enter your object-oriented solution here!
class Multiples
attr_reader :limit
def initialize(limit)
@limit = limit
end
def collect_multiples
arr = []
(1...@limit).each do |num|
if(num % 3 == 0 || num % 5 == 0)
arr.push(num)
end
end
arr
end
def sum_multiples
sel... |
class UserMailer < ActionMailer::Base
default from: "notifications@example.com"
def password_reset(user, password)
@user = user
@random_password = password
mail(to: @user.email, subject: "Password Reset")
end
def new_memo(building)
@recipients = building.users
emails = @recipients.collect(... |
# frozen_string_literal: true
class ServeEventQueueJob < ApplicationJob
queue_as :default
def perform
Event.active_for(Time.zone.today).each do |event|
QueueService.serve_the_queue(event)
end
end
end
|
class Image < ActiveRecord::Base
validates_presence_of :title
include HasImage
end
|
class Textblock < ActiveRecord::Base
validates_presence_of :content
has_many :block_links, :order => :position, :as => :linked, :dependent => :destroy
# Defines how this model will_paginate
cattr_reader :per_page
@@per_page = 25
end
|
class ChargesController < ApplicationController
before_action :authenticate_user!
def create
charge = Charges::Create.call(amount_cents: charge_params[:amount_cents],
token: charge_params[:token],
user: current_user)
render json: charge, s... |
class Task < ActiveRecord::Base
belongs_to :user
has_one :recurrence, dependent: :destroy
attr_accessible :time_expression, :action, :description, :user_id
validates :time_expression, :action, :user_id, presence: true
scope :by_next_at, -> { joins(:recurrence).order('next_at asc') }
end
|
module TB
module Types
class Type
def signal; self; end
def generic_set(gs); self; end
end
class Directioned < Type
def initialize(value); @value=value; end
def signal; @value; end
def generic_set(gs); self.class.new(@value.generic_... |
module Post::Contract
class Import < Reform::Form
property :file
validates :file, presence: true
end
end |
# Procs Block in Ruby
# Normal block example
a = [1, 2, 3]
b = [4, 5, 6]
c = [7, 8, 9]
a_cubes_block = a.map {|num| num ** 3}
b_cubes_block = b.map {|num| num ** 3}
c_cubes_block = c.map {|num| num ** 3}
p a_cubes_block
p b_cubes_block
p c_cubes_block
# the same example but with a procs
cubes_procs = Proc.new {|... |
shared_examples "between time scope" do |name, difference = 1.second|
subject do
test_class.send("#{prefix}#{name}", *arguments).to_a
end
# In tests top_threshold and bottom_threshold should have time values,
# where the interval includes top_threshold but EXCLUDES bottom_threshold
let(:befor... |
module Utils
class PathHelper
def self.project_root(path)
File.expand_path("../../../#{path}", File.dirname(__FILE__))
end
def self.require_folder(path, file)
files = Dir[File.expand_path(path, file)]
files.each { |file| require file }
end
end
end
|
# +-----+
# |1*3*1|
# |13*3 |
# | 2*2 |
# | |
# +-----+
class ValueError < ArgumentError; end
class Board
def self.transform(input)
new(input).transform
end
def initialize(input)
fail ValueError unless valid?(input)
@input = input
end
def transform
@input.map.with_index do |row, x|
... |
require 'spec_helper'
require 'bstats/winner'
require 'bstats/player'
module BStats
describe Winner do
describe "before being loaded with a player" do
before do
@winner = Winner.new
end
it "should have no player" do
expect(@winner.player).to eq(nil)
end
it "should not report awarde... |
require 'oystercard'
describe Oystercard do
let(:max_balance) { Oystercard::MAX_BALANCE }
let(:min_fare) { Oystercard::MIN_FARE }
let(:entry_station) { double :station }
let(:exit_station) { double :station }
it "show a initial balance of zero" do
expect(subject.balance).to eq(0)
... |
class EventLogJob < ApplicationJob
queue_as :default
# we assume that we have a class CsvImporter to handle the import
def perform(params)
SaveEventLogService.new(params).perform
end
end
|
class FollowersController < ApplicationController
def show
user = User.find(params[:account_id])
@users = user.followers
end
end |
ActiveAdmin.register Initiative do
index do
column :gazette_id
column :title
column :subjects do |initiative|
initiative.subjects.map(&:name).join(', ')
end
column :deputy
column :summary_by
column :presented_at
default_actions
end
filter :gazette_id
filter :title
filte... |
# frozen_string_literal: true
class Users::SessionsController < Devise::SessionsController
def create
user = User.find_by(email: params[:session][:email].downcase)
if user
session[:user_id] = user.id
bypass_sign_in(user)
flash[:alert] = "ログインしました"
redirect_to root_path
else
... |
require_relative '../../lib/modules/method_missing'
###
#
# AccountDebitDecorator
#
# Adds display logic to the debit business object.
#
##
#
class AccountDebitDecorator
include MethodMissing
include DateHelper
include NumberFormattingHelper
attr_accessor :running_balance
def debit
@source
end
def... |
class CapsuleCRM::HistoryItem < CapsuleCRM::Base
attr_accessor :type
attr_accessor :entry_date
attr_accessor :creator
attr_accessor :creator_name
attr_accessor :note
attr_accessor :subject
attr_accessor :attachments
attr_accessor :participants
attr_accessor :opportunity_id
attr_accessor :party_id
... |
require File.dirname(__FILE__) + '/../test_helper'
class ProductTest < Test::Unit::TestCase
fixtures :products, :product_images, :publishers
# Replace this with your real tests.
def test_truth
assert true
end
def test_invalid_with_empty_attributes
product = Product.new
assert !product.valid?
... |
# == Schema Information
#
# Table name: geo_ips
#
# id :integer not null, primary key
# ip_address :inet
# count :integer default(0), not null
# created_at :datetime not null
# updated_at :datetime not null
#
class GeoIp < ApplicationRecord
validates :ip_address, :... |
class Sandwich
attr_accessor :servings, :dairyfree, :readyInMinutes
@@all = []
def initialize(servings, dairyfree, readyInMinutes)
@servings = servings
@dairyfree = dairyfree
@readyInMinutes = readyInMinutes
save
end
def save
@@all << self
end
... |
class CityJob < ApplicationRecord
belongs_to :city
belongs_to :job
end
|
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
gem 'puma'
group :production do
gem 'rails_12factor' # Views
gem 'pg'
end
gem 'less-rails', '~> 2.6.0' # Views
gem 'uglifier', '>= 1.3.0' # Views
gem 'therubyracer', require: 'v8' # Views
gem 'j... |
shared_examples_for "an API command" do
let(:params) { {} }
let(:command) { described_class.new(params) }
subject { command }
it { is_expected.to be_a(Collmex::Api::Line) }
its(:to_a) { is_expected.to eq(output) }
end
|
module SkyMorph
class OrbitRequest < Request
attr_accessor :epoch, :ecc, :per, :per_date, :om, :w, :i, :H
#@@request_url = 'http://skyview.gsfc.nasa.gov/cgi-bin/skymorph/mobssel.pl?target=&NEAT=on&OE_EPOCH=%s&OE_EC=%s&OE_QR=%s&OE_TP=%s&OE_OM=%s&OE_W=%s&OE_IN=%s&OE_H=%s'
@@request_url = 'http://skyview.gs... |
class Message
include Mongoid::Document
include Mongoid::Timestamps
LEVELS = %w[Priority Low Medium High]
field :subject, type: String
field :body, type: String
field :level, type: String
field :read, type: Boolean, default: false
# Relationships
be... |
require 'spec_helper'
describe MailQueue do
let(:message) { double :message }
let(:jmx_queue) { double :jmx_queue }
let(:queue) { MailQueue.new resource: jmx_queue }
it 'shortens the queue name' do
jmx_queue.should_receive(:name).and_return '/queues/mail/success'
expect(queue.name).to eq('success')
... |
class PasswordResetsController < ApplicationController
before_action :get_user, only: [:edit, :update]
before_action :check_valid_user, only: [:edit, :update]
before_action :check_not_expired, only: [:edit, :update]
def new
end
def get_user
@user = User.find_by(email: params[:email])
end
de... |
class CardsController < ApplicationController
# GET /cards
# GET /cards.json
def index
# @q = current_user.cards.ransack(params[:q])
# @cards = @q.result
@cards = Card.all
respond_to do |format|
format.html
format.json {
render json: { "data": { "cards": @cards.as_json(include... |
class AddTopicIdToReferences < ActiveRecord::Migration
def change
add_column :references, :topic_id, :integer
end
end
|
module UsersHelper
def current_user_posts_none?
current_user.posts.empty?
end
def current_user_comments_none?
current_user.comments.empty?
end
def current_user_favorites_none?
current_user.favorites.empty?
end
end
|
FactoryGirl.define do
factory :story do
title "This is a story"
url "http://example.com/foo"
domain "example.com"
author "MyText"
tweet "MyText"
fb_post "MyText"
kinja_id 1398029
publish_at "2015-01-15 14:09:22"
set_to_publish false
end
end
|
require 'presenters/v3/stack_presenter'
require 'actions/stack_create'
require 'messages/stack_create_message'
require 'messages/stacks_list_message'
require 'fetchers/stack_list_fetcher'
class StacksController < ApplicationController
def index
message = StacksListMessage.from_params(query_params)
invalid_pa... |
require 'main/resources/v1/step_pb'
require 'google/protobuf/well_known_types'
class Step < ApplicationRecord
belongs_to :recipe
validates :description, presence: true
validates :position, presence: true
def as_protocol_buffer(request_context: nil)
Main::Resources::V1::Step.new(
description: descri... |
module DoceboRuby
class Course < Resource
self.api = 'course'
class << self
def all
courses = fetch_data('listCourses') do |data|
data.delete_if { |key, value| key == 'success' }
end
courses.map { |key, value| Course.new value['course_info'] }
end
def add... |
# Categories Controller: JSON response through Active Model Serializers
class Api::V1::CategoriesController < MasterApiController
respond_to :json
def index
render json: Category.all
end
def show
render json: category
end
def create
render json: Category.create(category_params)
end
def update
render... |
class DashboardController < ApplicationController
def show
@events = Event.where(id: current_user.contact_requests.select { |cr| cr.status == 'Accepted' }.map(&:event).map(&:id))
@contact_requests = current_user.contact_requests
# authorize @events
# authorize @contact_requests
skip_authorization
... |
require File.dirname(__FILE__) + '/../test_helper'
require 'reports_controller'
# Re-raise errors caught by the controller.
class ReportsController; def rescue_action(e) raise e end; end
class ReportsControllerTest < Test::Unit::TestCase
fixtures :expenses, :categories, :users, :taggings, :tags
def setup
@... |
require_relative 'spec_helper.rb'
require_relative '../helper/app_helper.rb'
describe Helper do
subject { Object.new.extend(Helper) }
it { should respond_to :return_test }
it "can return Test string" do
expect(subject.return_test).to eq("Test")
end
end
|
module Api
module V1
class TournamentSerializer < ::BaseSerializer
attributes :id, :name
has_many :rounds, serializer: Api::V1::RoundSerializer
end
end
end
|
class PassengerBooking < ApplicationRecord
belongs_to :passenger
belongs_to :booking
end
|
# encoding: utf-8
class MpointsReport < Prawn::Document
# ширина колонок
Widths = [25, 60, 60, 60, 60, 60, 60, 140]
# заглавия колонок
Headers = ["№", "Дата актирования","№ счетчика", "A+", "A-", "R+", "R-", "Комментарий"]
def row(d1, d2, d3, d4, d5, d6, d7, d8)
row = [d1, d2, d3, d4, d5, d6, d7, d8]
... |
class AddStatusToOrderProduction < ActiveRecord::Migration[5.0]
def change
add_column :order_productions, :status, :string
end
end
|
class Node
attr_accessor :value
def initialize(value)
@value = value
@edges = []
end
def add_edge(other_node)
@edges << other_node
end
def nodes
@edges
end
def exists?
nodes_to_search = @edges
if yield(self)
return true
end
until nodes_to_search.empty?
node = nodes_to_search.pop
if ... |
class NotificationSenderJob < ApplicationJob
queue_as :default
def perform
send_notification
end
def send_notification
User.pending.find_each do |user|
time = (user.start_time.utc - ActiveSupport::TimeZone.new(user.timezone).utc_offset).strftime('%H%M')
publish_time = Time.now.utc.beginnin... |
#encoding: utf-8
require_relative 'Napakalaki.rb'
require_relative 'Monster.rb'
require_relative 'Player.rb'
require_relative 'CultistPlayer.rb'
require 'singleton'
module Model
class Napakalaki
include Singleton
#Metodo initialize de la clase Napakalaki
def initialize
@currentMonster=nil
@currentPlayer =... |
class Book < ApplicationRecord
validates_presence_of :name
belongs_to :user, optional: true
belongs_to :category, optional: true
has_many :comments, :dependent => :destroy
has_many :book_groupships, :dependent => :destroy
has_many :groups, through: :book_groupships
has_many :user_bookships
has_many :users, t... |
#!/usr/bin/ruby
# Read line by line
def load_sites(path)
sites = {}
File.foreach(path) do |line|
name, url = line.split(",")
sites[name] = url.strip
end
sites
end
s = load_sites("url.txt")
puts s
|
require 'spec_helper'
describe 'Session API' do
before :each do
User.destroy_all
FactoryGirl.create :user
end
after :each do
User.destroy_all
end
let(:request_headers) {
{ "Accept" => "application/json", "Content-Type" => "application/json" }
}
let(:user_params) {
{ email: 'bob@... |
# 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... |
# frozen_string_literal: true
require_relative 'lib/apple_data/version'
Gem::Specification.new do |s|
s.name = 'apple-data'
s.version = AppleData::VERSION
s.licenses = ['MIT']
s.summary = 'Static data files from https://docs.hackdiffe.rent'
s.description = <<-DESC
This package include... |
require "rails_helper"
RSpec.describe Report::SendStateChangeEmails do
subject { described_class.new(report) }
let!(:report) { create(:report, state: state) }
let!(:partner_organisation_users) { create_list(:administrator, 5, organisation: report.organisation) }
let!(:inactive_po_user) { create(:administrator... |
require 'open-uri'
class SetlistsController < ApplicationController
before_filter :is_admin, :except => [:index, :show, :slideshow]
before_filter :get_backgrounds, :only => [:slideshow]
respond_to :html, :json
def new
@setlist = Setlist.new
respond_with @setlist
end
def create
@setlist = Set... |
describe package('nfs-common') do
it { should be_installed }
end
describe package('libdbus-1-3') do
it { should be_installed }
end
describe package('dkms') do
it { should be_installed }
end
describe package('curl') do
it { should be_installed }
end
describe package('unzip') do
it { should be_installed }
e... |
class MigrateAvatarsToUploader < ActiveRecord::Migration
def change
rename_column :reviews, :avatar, :original_avatar
add_column :reviews, :avatar, :string
migrate_avatars
end
def migrate_avatars
reviews = Review.all
reviews.each do |review|
original_avatar = review.original_avatar
... |
# coding: utf-8
module V1
class Oauth < Grape::API
version 'v1', using: :path
format :json
formatter :json, Grape::Formatter::Jbuilder
#helpers do
def authenticate_error!
# 認証が失敗したときのエラー
h = {'Access-Control-Allow-Origin' => "*",
'Access-Control-Request-Method' => %w{GET ... |
class AddEndTimeToPosts < ActiveRecord::Migration
def change
add_column :posts, :end_time, :datetime
end
end
|
class Modulu < ApplicationRecord
belongs_to :project
belongs_to :state
has_many :tasks
validates_presence_of :name
end
|
require 'formula'
class Cweb < Formula
homepage 'http://sunburn.stanford.edu/~knuth/cweb.html'
url 'ftp://ftp.cs.stanford.edu/pub/cweb/cweb.tar.gz'
sha1 'a9828b66b525d7cf91c57b3c4891168caa4af10a'
version '3.64'
def install
ENV.deparallelize
system "mkdir", "-p", "#{man}"
system "mkdir", "-p", "#... |
Rails.application.routes.draw do
devise_for :merchants
root to: 'merchants#index'
resources :merchants do
resources :products
resources :orders, only: [:show, :index]
end
end
|
class AddQtdToExpense < ActiveRecord::Migration[6.0]
def change
add_column :expenses, :qtd, :float
end
end
|
# Reporting - html only (not data extract)
#
# Basic idea is that we're pivoting different metrics about different dimensions.
# This means that the processing can be generalised and only a few methods need
# to be defined where they deviate from the 'standard' metrics for reporting.
#
# Analytics::Model::Reports for... |
#!/usr/bin/env ruby
#
# Collect all unspent outputs for given address and display balance.
# Optionally display list of transactions.
#
# examples/balance.rb <address> [--list]
# examples/balance.rb 1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3
$:.unshift( File.expand_path("../../lib", __FILE__) )
require 'bitcoin'
Bitcoin.... |
class AddScoreToUser < ActiveRecord::Migration
def change
add_column :users, :listening_score, :float, default: 0.5
add_column :users, :reading_score, :float, default: 0.5
add_column :users, :speaking_score, :float, default: 0.5
add_column :users, :vocabulary_score, :float, default: 0.5
add_column... |
require "rubygems"
require "selenium-webdriver"
class Browser
attr_accessor :client
#@@config_path = File.dirname(__FILE__) + "/selenium_firefox.yml"
def self.type=(browser)
@@browser_type = browser
end
def initialize
case @@browser_type
when "Chrome"
@client = Selenium::WebDriver.fo... |
namespace :seed do
desc "Update language column"
task :update_language => :environment do
VimCommand.update_all("language = 'jp'")
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.