text
stringlengths
10
2.61M
class Monster < Character def attack(brave) puts "#{name}の攻撃!" damage = (offense - brave.defense) / 2 brave.hp = brave.hp - damage brave.hp = 0 if brave.hp < 0 puts "#{brave.name}は#{damage}のダメージを受けた!" end end
class CreateAcessos < ActiveRecord::Migration def self.up create_table :acessos do |t| t.integer :empresa_id, :null => false t.integer :direito_id, :null => false t.integer :perfil_id, :null => false t.timestamps end end def self.down drop_table :acessos end end
require 'spec_helper' RSpec.describe CliController do let(:controller) { CliController.new } describe "#call" do it "starts the command-line interface" do expect(controller).to receive(:start) controller.call end end describe "#start" do before do allow($stdout).to receive(:puts) expe...
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe EducationsController, "POST create" do before(:each) do # @account = mock_model(Account, :save => nil) # @school = mock_model(School, :save => nil) # @account = Account.create!(:account_name => ...
# 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 #...
module ActionView module Helpers module FormOptionsHelper # Return select and option tags for the given object and method, using state_options_for_select to generate the list of option tags. def state_select(object, method, country = Carmen.default_country, options={}, html_options={}) In...
require 'test_helper' class HomeworksControllerTest < ActionDispatch::IntegrationTest setup do @homework = homeworks(:one) end test "should get index" do get homeworks_url, as: :json assert_response :success end test "should create homework" do assert_difference('Homework.count') do p...
# frozen_string_literal: true module CandleTask extend Rake::DSL module_function def arguments raise 'Please specify START_AT and FINISH_AT' if ENV['START_AT'].blank? || ENV['FINISH_AT'].blank? { start: ENV['START_AT'].to_time, finish: ENV['FINISH_AT'].to_time, count: ENV.fetch('COUN...
class Tracker < ActiveRecord::Base belongs_to :user belongs_to :batch validates :batch_id, :start_datetime, :end_datetime, :description, presence: true end
class FriendsController < ApplicationController def index user = User.find_by(id: params[:id]) friends = user.leaders render json: friends end end
class CreateSurveys < ActiveRecord::Migration def change create_table :surveys do |t| t.references :company, index: true t.string :name t.string :secret_login_key t.timestamps null: false end add_foreign_key :surveys, :companies end end
# config valid only for Capistrano 3.1 lock '3.1.0' set :application, 'test_app' set :repo_url, 'git@github.com:TalkingQuickly/throwaway1.git' set :deploy_user, 'deploy' set :rbenv_type, :system set :rbenv_ruby, '2.1.1' set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:...
require 'rails_helper' RSpec.feature 'Deleting role' do before do @admin = create(:admin) login_as(@admin, scope: :admin) @role = create(:role) visit admin_roles_path end scenario 'should has list of subjects' do expect(page).to have_content(@role.name) find('.delete-link').click ex...
class RegistrationsController < Devise::RegistrationsController private #Modified Devise Params for user login def sign_up_params params.require(:user).permit(:username, :email, :password, :password_confirmation, :remember_me, :type) end # devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:us...
require_relative 'spec_helper' describe Robot do before :each do Robot.class_variable_set :@@robot_list, [] @robot_array = [] 5.times {@robot_array << Robot.new} #[0] at (0,1) 1.times {@robot_array[0].move_up} #[1] at (0, -1) 1.times {@robot_array[1].move_down} #[2] at (-1, 0) ...
class CreateFunds < ActiveRecord::Migration def change create_table :funds do |t| t.datetime :date_of_record t.integer :money t.references :company t.timestamps end add_index :funds, :company_id end end
class AddAnswerTypeToEvaluationQuestion < ActiveRecord::Migration def change add_column :evaluation_questions, :answer_type, :string end end
class SopSpecimen < ActiveRecord::Base belongs_to :specimen belongs_to :sop before_save :check_version #always returns the correct versioned asset (e.g Sop::Version) according to the stored version, or latest version if version is nil def versioned_asset s=self.sop s=s.parent if s.class.name....
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins 'http://localhost:8080' resource "*", methods: :any, headers: :any, credentials: true end end
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def is_authenticated? # if current_user is not valid, create flash message and redirect to home page unless cu...
class ChallengesController < ApplicationController before_filter :authorize # GET /challenges # GET /challenges.json def index @challenges = Challenge.all respond_to do |format| format.html # index.html.erb format.json { render json: @challenges } end end # GET /challenges/1 #...
FactoryGirl.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } password "12121212" sequence(:first_name) { |n| "John#{n}" } last_name "Smith" factory :contractor do contractor true end factory :admin do admin true end end end
module Admin::PagesHelper def pages_tree(page, current_page_id) html = page_row page, current_page_id if page.children.any? children_html = '' page.children.each do |child| children_html += pages_tree child, current_page_id end html += content_tag :ul, children_html, :id => "ch...
class CreateWagers < ActiveRecord::Migration[6.0] def change create_table :wagers do |t| t.string :selected_team t.string :opponent t.integer :spread t.integer :bet_user_id t.integer :taker_of_bet_id t.string :result t.integer :game_id t.timestamps end end en...
module MangoPayV1 # Use the User class for any operations related to the user class User < MangoPayV1::Ressource # Create a new user # # * *Args* : # - +data+ -> A JSON with the following attributes (Square brackets for optionals): # * [Tag] # * [Email] ...
require 'spec_helper' describe Event do before do mock_geocoding! @event = FactoryGirl.create(:event) end subject { @event } it { should respond_to(:name) } it { should respond_to(:event_date) } it { should respond_to(:event_time) } it { should respond_to(:home_team) } it { should respond_t...
class CreateContracts < ActiveRecord::Migration[5.2] def change create_table :contracts do |t| t.belongs_to :user t.string :title t.text :description t.integer :period_in_months t.integer :amount t.timestamps end end end
# Design an algorithm and write code to find the first common ancestor # of two nodes in a binary tree. Avoid storing additional nodes in a data structure. NOTE: This is not # necessarily a binary search tree # a = (0..10).to_a.shuffle # blah = Node.new(a.pop) # a.each do |num| # blah.insert(Node.new(num)) # end # ...
# import fio_people.csv file from # https://github.com/jacoblurye/bpd-fio-data class Importer::FioPeople < Importer::Importer def self.import_all parser = Parser::FioPeople.new("data/fio_people.csv.gz") new(parser).import end def import # for most record types, we try to update any existing record ba...
class CreateRests < ActiveRecord::Migration def change create_table :rests do |t| t.references :report t.string :location t.float :latitude t.float :longitude t.datetime :started_at t.datetime :ended_at t.datetime :deleted_at t.timestamps end add_index :res...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Translation need to be set to ASV once we load users FastSeeder.seed!(Book, :book_number, :name) do record 1 , "G...
class CorporaController < ApplicationController before_filter :authenticate_user! # GET /corpora # GET /corpora.json def index @corpora = Corpus.all respond_to do |format| format.html # index.html.erb format.json { render json: @corpora } end end # GET /corpora/1 # GET /corpora...
class Location include Datapathy::Model service_type :webwalk resource_name :Locations persists :name, :description, :active links_to_collection :configurations end
class MediaType < ActiveRecord::Base CD = 1 DVD = 2 has_many :genres has_many :products validates_presence_of :name default_scope :order => 'name' end
require 'platodsl' class Menudsl attr_accessor :nombre, :platos, :desc, :precios def initialize(nombre, &block) @nombre = nombre @desc = "" @platos = [] @precios = [] if block_given? if block.arity == 1 yield self else ...
FactoryGirl.define do factory :roadblock_permission, class: 'Roadblock::Permission' do action "MyString" subject_class "MyString" description "MyText" end end
RSpec.describe "Bongloy::Customer" do it "creates a card" do customer = Bongloy::Customer.create( email: "user@example.com", description: "Bongloy customer", source: token.id ) card = Bongloy::Customer.create_source( customer.id, source: token.id ) expect(card.custo...
require 'delegate' module Graphlient class Schema < SimpleDelegator PATH_ERROR_MESSAGE = 'schema_path is missing. Please add it like this: `Graphlient.new(url, schema_path: YOUR_PATH)`'.freeze class MissingConfigurationError < StandardError; end alias graphql_schema __getobj__ attr_reader :http, :...
#! /usr/bin/env ruby require "m2x" KEY = ENV.fetch("KEY") DEVICE = ENV.fetch("DEVICE") FROM_TIMESTAMP = ENV.fetch("FROM") END_TIMESTAMP = ENV.fetch("END") client = M2X::Client.new(KEY) device = client.device(DEVICE) puts "Deleting location from #{FROM_TIMESTAMP} to #{END_TIMESTAMP}" res = devic...
# frozen_string_literal: true module Api::V1 class ApiController < ::ApplicationController def current_resource_owner User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end end end
Rails.application.routes.draw do root 'welcome#index' get '/about', to: 'about#index' get '/contact', to: 'contact#index' get '/skills', to: 'skills#index' get '/projects', to: 'projects#index' end
class RemoveColumnFromInventories < ActiveRecord::Migration[5.0] def change remove_column :inventories, :food end end
class Diary < ActiveRecord::Base belongs_to :author has_many :excerpts attr_accessible :about, :author_id, :source end
class ControllerAction < ActiveRecord::Base has_many :controller_actions has_and_belongs_to_many :roles end
include ActionView::Helpers::NumberHelper # to pass a display value to a javascript function that adds characters to view require 'tempfile' require 'open-uri' require 'fileutils' require 'net/http' require Rails.root.join('app', 'uploaders', 'binary_uploader.rb') class RecordfilesController < ApplicationController ...
module Yandex module Market class Offer def self.params(options = {}) raise OfferArgumentError unless (options[:geo_id] && options[:remote_ip]).nil? options end end end end
class AddRelationsToQuizzes < ActiveRecord::Migration def up add_column :quizzes, :student_id, :integer, index: true add_column :quizzes, :teacher_id, :integer, index: true end def down remove_column :quizzes, :student_id, :teacher_id end end
# frozen_string_literal: true $LOAD_PATH << './' require 'getter' require 'test/unit' # BearerGetterのテスト class TestGetter < Test::Unit::TestCase def setup api_key = ENV['TWITTER_API_KEY'] api_secret = ENV['TWITTER_API_SECRET'] @bearer_getter = BearerGetter.new(api_key, api_secret) @tweets_getter = Tw...
class CommentsController < ApplicationController before_action :authenticate_user! def create @topic = Topic.find(params[:topic_id]) @comment = @topic.comments.create(comment_params) if @comment.valid? redirect_to topic_path(@topic), notice: "Comment successfully created!" else redirect...
namespace :db do namespace :clone do # For now, one environment to rule them all # desc "Clones staging database for use in local development" # task :staging => :environment do # # TODO: Parameterise the heroku app and local db to use # Rake::Task["db:drop"].invoke # Rake::Task["db:cr...
require_relative 'return_calculator' class YourReturnCalculator < ReturnCalculator def calculate! # Write your code here. # You have access to the `snapshots` variable. # # You can access the following properties of a snapshot: # snapshot.date # snapshot.cash_flow # snapshot.market_value ...
# encoding: UTF-8 require_relative 'writer' module Creq class DocWriter < Creq::Writer def self.call(req, stream = $stdout) writer = new(req.is_a?(Array)? req.first.root : req.root) writer.write(req.inject([], :<<), stream) end def write(req, stream) req.delete_at(0) ...
class CreateTableTaxons < ActiveRecord::Migration[5.0] def change create_table :taxons do |t| t.string :name, :default => "" t.integer :shop_id, :default => 0 t.integer :parent_id, :default => 0 t.string :url, :default => "" t.string :permalink, :default => "", :index => true t.st...
# # Author:: Lamont Granquist (<lamont@opscode.com>) # Copyright:: Copyright (c) 2013 Opscode, Inc. # License:: Apache License, Version 2.0 # # 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 # #...
#!/usr/bin/env ruby require 'aws-sdk' require 'yaml' require 'trollop' require 'securerandom' require 'rubygems' require 'byebug' opts = Trollop::options do opt :instance_type, "Instance type", :type => :string, :default => "c4.large", :short => "-t", :multi => false opt :num_instances, "Number of instances", :typ...
# When done, submit this entire file to the autograder. # Part 1 def sum(arr) arr.inject(0,:+) end def max_2_sum(array) return 0 if array.empty? return array.first if array.length == 1 array.sort.reverse.take(2).reduce(:+) end def sum_to_n?(arr, n) return false if arr.empty?||arr.length == 1 arr.sort.co...
Rails.application.routes.draw do namespace :api do namespace :v1 do get :projects, to: 'projects#get_projects' get :emails, to: 'emails#send' end end get '*path', to: "application#fallback_index_html", constraints: ->(request) do !request.xhr? && request.format.html? end end
class LawsController < ApplicationController before_action :set_law, only: [:show, :upvote, :downvote, :for, :against] before_action :authenticate_user!, only: [:upvote, :downvote] skip_before_action :authenticate_user!, only: [:index, :show] # Pagy include Pagy::Backend def index @laws = Law.order(dat...
# frozen_string_literal: true class ApplicationController < ActionController::Base include DeviseTokenAuth::Concerns::SetUserByToken before_action :configure_permitted_parameters, if: :devise_controller? protect_from_forgery with: :null_session protected def configure_permitted_parameters devise_param...
require_relative 'piece'; require_relative '../sliding_piece'; class Bishop < Piece include SlidingPiece def initialize(position, color) @symbol = color == :white ? "♗" : "♝" super end def move_dirs [:diag_ul, :diag_ur, :diag_dl, :diag_dr] end end
class AddWorkPlaceAndSelfHistoryAndFamilyHistoryAndDrugHistoryToProfiles < ActiveRecord::Migration[5.0] def change add_column :profiles, :work_place, :text add_column :profiles, :self_history, :text add_column :profiles, :family_history, :text add_column :profiles, :drug_history, :text end end
require 'rails_helper' RSpec.describe Course, type: :model do describe 'attributes' do it 'respond to name' do expect(Course.new).to respond_to(:name) end end describe 'validations' do context 'registration should be invalid if we already had two teachers in the same course' do let!(:co...
# Common files require 'pesamoni_ruby/api_client' require 'pesamoni_ruby/api_error' require 'pesamoni_ruby/version' require 'pesamoni_ruby/configuration' # Models require 'pesamoni_ruby/models/inline_response_200' # APIs require 'pesamoni_ruby/api/default_api' module Pesamoni class << self # Customize default ...
class Litres < BookStore def initialize(value) @base_url = "http://www.litres.ru/pages/biblio_search" @options = {"q" => value} @results = ".result-series .row" @item = '.name a' end end
class CorrectChangeDefaultInFriendshipTable < ActiveRecord::Migration[6.1] def change change_column_default :friendships, :confirmed, false end end
require "rbooks/version" require "rbooks/book" module Rbooks ENDPOINT_URL = "https://app.rakuten.co.jp/services/api/BooksBook/Search/20170404" APPLICATION_ID = ENV["APPLICATION_ID"] end
require 'colorize' require_relative 'piece' class Board def initialize @grid = Array.new(8) { Array.new(8) { NullPiece.new } } fill_board end def fill_board 0.upto(2) do |i| 0.upto(7) do |j| pos = [i, j] self[pos] = Piece.new(self, pos, :top) if (i+j).odd? end end ...
class AddRateToProviders < ActiveRecord::Migration def change add_column :providers, :rate, :decimal, precision: 8, scale: 2 end end
require 'csv' require 'json' module CDI module Services class CreateDefaultDataService < BaseService def initialize(options={}) super(options) @verbose = options.fetch(:verbose, true) @actions = [options.delete(:actions) || :all_actions].flatten end def execute ...
require 'csv' require 'rails_helper' require 'fm_calculator/calculator' # rubocop:disable all RSpec.describe FMCalculator::Calculator do subject(:calculator) do end let(:json_test_data) { JSON.parse(file_fixture('fm-calculator-test-specifications.json').read, symbolize_names: false) } let(:csv_test_data) {...
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "forwarded_port", guest: 80, host: 80 config.vm.network "forwarded_port", guest: 5432, host: 5432 config.vm.network "forwarded_port", guest: 443, host: 443 config.vm.network "private_network", ip: "192.168.33.10" con...
class PicturesScreen < BaseClass require_relative '../../lib/keyevents' element(:picture_in_project) { 'projectListContextMenuPicture' } element(:attach_picture_icon) { 'attachPictureMenuTakePhoto' } element(:upload_picture_icon) { 'locationPicturesUploadMenuItem' } element(:picture_view_location) { 'lo...
ENV['RACK_ENV'] = 'test' require 'minitest/autorun' require_relative 'app.rb' class TestApp < MiniTest::Test def setup @db = SQLite3::Database.new "microblog.db" @posts = Posts.new @post = Post.new("Ivan", "This is Ivan's post.\nHave some #tags , #tag1 , #tag2\n") end def test_save_post @post.s...
class KidsController < ApplicationController before_action :authorize def index @kids = current_user.kids end def show @kid = Kid.find(params[:id]) end end
class Dialy < ApplicationRecord attachment :image belongs_to :patient enum color: ["ちゃいろ", "うすちゃいろ","くろ","オレンジ","きいろ","しろ","あか","みどり"] enum amount: ["いつもと同じ", "少ない","多い"] enum feeling: ["いい", "ふつう","まあまあ","わるい","つかれてる"] end
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module MobileCenterApi module Models # # Model object. # # class SessionsPerDevice # @return [Float] average seesion per ...
class Post < ActiveRecord::Base include Translatable acts_as_taggable has_attached_file :image, :styles => { :medium => "667x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png" validates_attachment_content_type :image, :content_type => /\Aim...
require_relative "Pass_train" include Pass_train class RailwayStation def initialize(rs_options = {}) @title = rs_options[:title] @city = rs_options[:city] @trains = [] @total_tracks = rs_options[:total_tracks] end def get_train (train) if @trains.count < @total_tracks ...
# -*- coding: UTF-8 -*- # utils.rb # 作者:王政 # 描述:本单元定义了一些实用工具函数,有些是直接调用了utils.dll,的有些用ruby实现更方便的,就直接用ruby实现。 # 深圳市金溢科技股份有限公司版权所有, 保留一切权利 require "fiddle" def adddllpath return unless @addbinfile.nil? @addbinfile = 1 binpath = File.dirname(__FILE__) pos = binpath.rindex("/") binpath=binpath[0..pos-1...
require 'rake' Gem::Specification.new do |s| s.name = 'rails3_sequel' s.version = '0.3.0' s.date = '2010-06-13' s.author = 'Rachot Moragraan' s.email = 'janechii@gmail.com' s.homepage = 'http://github.com/mooman/rails3_sequel' s.summary = 'Rails 3 integration with Sequel' s.description = 'Rails 3 integ...
module Exchanges module Exodus extend ExchangeMethods extend self def configured? !!settings["addresses"] || !!settings["coins"] end def addresses settings["addresses"] end def fetch_balance coin, address response = Faraday.get("https://chainz.cryptoid.info/#{coin}/api...
json.is_more_comments_available @is_more_available json.comments @comments do |comment| json.id comment.id json.description comment.description json.updated_at comment.updated_at.to_s(:short) json.abused_count comment.abused_count json.spam comment.spam json.admin_user_id comment.admin_user_id if @ad...
class FontLxgwWenkaiLite < Formula version "1.250" sha256 "1a4a9049a37c2b868c8333749cf2f72b038d14e12082727bb8fccc702899b621" url "https://github.com/lxgw/LxgwWenKai-Core/releases/download/v#{version}/lxgw-wenkai-lite-v#{version}.zip" desc "LXGW WenKai Lite" desc "霞鹜文楷 轻便版" desc "Open-source Chinese font der...
require 'rails_helper' describe 'weather api' do it 'can log in a user' do user = User.create( email: 'whatever@example.com', password: 'password', password_confirmation: 'password') post '/api/v1/sessions', params: { "email": "whatever@examp...
require 'google_cloud_vision/version' require 'base64' require 'net/http' require 'json' require "open-uri" # simple wrapper for Google Cloud Vision API module GoogleCloudVision # classifier for face, text and label detection class Classifier attr_reader :response def initialize(api_key, images) @ur...
Pod::Spec.new do |s| s.name = "FlowKit" s.version = "0.0.2" s.summary = "Provides base structure for navigation and combining screens together." s.license = { } s.homepage = "https://github.com/214alphadev/flowkit" s.author = { "Andrii Selivanov" => "seland@214alpha.co...
#!/usr/bin/env ruby begin require "config/environment" rescue LoadError puts "Could not load rails environment, running standalone" end require_relative "../lib/stormtroopers" Stormtroopers::Manager.instance.manage
Pod::Spec.new do |s| s.name = 'LMDistanceCalculator' s.version = '1.0.0' s.summary = 'LMDistanceCalculator is a simple wrapper for calculating geometry and real distance between locations on Earth.' s.homepage = 'https://github.com/lminhtm/LMDistanceCalculator' s.platform ...
require_relative './spec_helper' describe 'Fortune' do def app FortuneApp end let!(:base_url){'/fortune'} context 'API route' do it '/fortune/ returns random single fortune' do get "/" last_response.status.should == 200 end it '/fortune/ returns plain text fortune' do get "/...
require 'json' # Helper methods to format values going into solr for xfacet fields module BlacklightSolrplugins::Indexer # namespace for our 'private' methods module Validators # @param [Hash] h def self.validate_hash(h) if h.is_a?(Hash) h.keys.each do |key| ok = (key == "filing"...
class GamesController < ApplicationController def index @games = Game.all.order(name: :asc) if params[:search] @search = params[:search] @games = Game.where('name ~* ?', "#{@search}").order(name: :asc) else @games = Game.all.order(name: :asc) end end def show @game = Game....
module Synchronisable class Import < ActiveRecord::Base belongs_to :synchronisable, polymorphic: true if Gem.loaded_specs['activerecord'].version < Gem::Version.create(4) attr_accessible :synchronisable_id, :synchronisable_type, :remote_id, :unique_id, :attrs end serialize :attrs, Hash sc...
class ApplicationController < ActionController::API rescue_from SQLite3::ConstraintException, ArgumentError, with: :on_database_validation rescue_from ActiveModel::UnknownAttributeError, with: :unknown_attribute_handler ERROR_MAPPER = { "UNIQUE constraint failed: contacts.email" => "Email already in use!",...
class Animal < ApplicationRecord CATEGORIES = %w(cat dog fish mouse lion) validates :name, presence:true validates :category, inclusion: { in: CATEGORIES } end
class UsersController < ApplicationController # Security action, lock down controller unless user is logged in before_action :authenticate_user! def index @users = User.includes(:profile) end # GET request to /user/:id to show user profile def show @user = User.find(params[:id]) end end
# frozen_string_literal: true class AddIndexToCategories < ActiveRecord::Migration[6.0] def change add_index :categories, %i[name company_id], unique: true end end
class ApplicationController < ActionController::Base protect_from_forgery with: :exception helper_method :current_user, :logged_in?, :goto_root def current_user @user ||= User.find_by_id(session[:user_id]) end def logged_in? !!current_user && @user.loginname end def goto_root session[:dial...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
#!/usr/bin/env ruby # Walks up and down revisions in a git repo. # Usage: # git walk next # git walk prev case ARGV[0] when "next" rev_list = `git rev-list --children --all` refs = rev_list.scan(/[a-z0-9]{40}(?= )/) refs.unshift(rev_list[/[a-z0-9]{40}/]) refs.reverse! head = `git rev-parse HEAD`.chomp ...
class Match < ActiveRecord::Base belongs_to :competitor1, class_name: "Competitor" belongs_to :competitor2, class_name: "Competitor" belongs_to :winner, class_name: "Competitor" belongs_to :loser, class_name: "Competitor" validates_presence_of :competitor1, :competitor2, :start_time, :season, :location de...