code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
| Ruby |
require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'
require 'date'
require 'spec/rake/spectask'
GEM = "yaaft"
GEM_VERSION = "0.0.1"
AUTHOR = "Richard Gould"
EMAIL = "rwgould@gmail.com"
HOMEPAGE = "http://rgould.ca"
SUMMARY = "A collection of tools to help organise an MP3 collection."
spe... | Ruby |
#!/bin/env ruby
require 'yaaft/lookuptag'
| Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
#!/usr/bin/ruby
# == Usage
#
# lookuptag.rb [OPTION]... artistfix FILE...
#
# -h, --help: show this help and exit
# -r, --recursive: recursively parse directories
# -c, --cache=DIRECTORY: specify the directory to be used for the last.fm cache
# defaults to ~/.scrobbleCache
... | Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
#!/usr/bin/ruby
# == Usage
#
# lookuptag.rb [OPTION]... artistfix FILE...
#
# -h, --help: show this help and exit
# -r, --recursive: recursively parse directories
# -c, --cache=DIRECTORY: specify the directory to be used for the last.fm cache
# defaults to ~/.scrobbleCache
... | Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
#!/usr/bin/ruby
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | Ruby |
require 'cgi'
require 'net/http'
require "rexml/document"
require 'rubygems'
require 'mp3info'
require 'jcode'
require 'session'
$KCODE = 'u'
# Copyright 2007, 2008 Richard Gould, rwgould@gmail.com
#
# This file is part of YAAFT.
#
# YAAFT is free software: you can redistribute it and/or modify
# it under the terms o... | Ruby |
#!/bin/env ruby
require 'yaaft/lookuptag'
| Ruby |
puts "\nYABZS :: Loading extensions..."
require 'yabzs/plugins/announcer'
require 'yabzs/plugins/timelimit'
require 'yabzs/plugins/databaselogger'
require 'yabzs/plugins/filelogger'
puts "YABZS :: All extensions loaded."
puts "\nYABZS :: Server started at #{get_date} #{get_time}" | Ruby |
require "rubygems"
require "active_record"
task :default => :migrate
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
task :migrate => :environment do
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
... | Ruby |
require 'rubygems'
require 'active_record'
Dir.glob('../db/models/*.rb').each {|f| require f }
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => "../var/yabzs.sqlite"
)
#tyle minut ze ile kill eventow/ile osob
Dir.glob('logs/*.txt').each do |log_file|
p ... | Ruby |
include Bzflag
class KillJan < Plugin
def initialize(args = nil)
@args = args
@timelimit_cmd = "/killjan"
end
def unknown_slash_command(event_data)
cmd = event_data.message.downcase.split[0]
killer_id = event_data.from
if cmd != @timelimit_cmd
return false
else
killJa... | Ruby |
#require "compile_time"
include Bzflag
require "date"
module BZCommon
def get_team_color(team_id)
if RogueTeam == team_id
team = "Rogue"
elsif RedTeam == team_id
team = "Red Team"
elsif GreenTeam == team_id
team = "Green Team"
elsif BlueTeam == team_id
team = "Blue Team... | Ruby |
require 'yabzs/plugins/bzcommon'
include Bzflag
include BZCommon
$logEnabled = false;
class FileLogger < Plugin
def initialize()
@date = get_date
@time = get_time
@now = @date + "-" + @time
@log = File.new("yabzs/var/stats/_log_#{@now}.txt", "w")
@log_last = File.new("yabzs/var/stats/_log_mat... | Ruby |
include Bzflag
args = "1-30"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"
end
def allowed_times
if @args =~ /^[0-9]+-[0-9]+$/
... | Ruby |
# gem install activerecord
# gem install sqlite3-ruby (sqlite3-ruby 1.2.3 (mswin32))
begin
require 'yabzs/plugins/bzcommon'
require 'rubygems'
require 'active_record'
require 'yabzs/plugins/world_map'
require 'yabzs/db/models/game'
require 'yabzs/db/models/event'
require 'yabzs/db/models/event_type'
require 'yabzs/... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'bit-struct'
require 'zlib'
require 'stringio'
require 'RMagick'
require 'rvg/rvg'
include Magick
class Header < BitStruct
unsigned :size, 16, "Size"
unsigned :id, 16 , "ID"
end
class Style < BitStruct
unsigned :version, 16
unsigned :uncompressed, 32
un... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'bit-struct'
require 'zlib'
require 'stringio'
require 'RMagick'
require 'rvg/rvg'
include Magick
class Header < BitStruct
unsigned :size, 16, "Size"
unsigned :id, 16 , "ID"
end
class Style < BitStruct
unsigned :version, 16
unsigned :uncompressed, 32
un... | Ruby |
require 'yabzs/plugins/bzcommon'
include Bzflag
include BZCommon
class Announcer < Plugin
def initialize()
end
def player_join(data)
ids = bz_get_player_index_list
ids.each do |id|
bz_send_text_message(BZ_SERVER, id ,"Everybody say 'TI-DI-DI', #{data.callsign} has joined!")
end
en... | Ruby |
require 'rubygems'
require 'active_record'
require 'db/models/game'
require 'db/models/event'
require 'db/models/event_type'
require 'db/models/flag'
require 'db/models/player'
class AddMap < ActiveRecord::Migration
def self.up
add_column :games, :map, :binary, :default => nil
end
def se... | Ruby |
require 'rubygems'
require 'active_record'
require 'db/models/game'
require 'db/models/event'
require 'db/models/event_type'
require 'db/models/flag'
require 'db/models/player'
class Init < ActiveRecord::Migration
def self.up
create_table :games do |table|
table.column :datetim... | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: flags
#
# id :integer not null, primary key
# acronym :string(255)
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class Flag < ActiveRecord::Base
has_many :events
end
end | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: players
#
# id :integer not null, primary key
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class Player < ActiveRecord::Base
has_many :events
end
end | Ruby |
# == Schema Information
# Schema version: 2
#
# Table name: events
#
# id :integer not null, primary key
# event_type_id :integer
# datetime :datetime
# game_id :integer
# player_id :integer
# target_id :integer
# flag_id :integer
#
require 'rubygems'
r... | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: event_types
#
# id :integer not null, primary key
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class EventType < ActiveRecord::Base; end
end | Ruby |
# == Schema Information
# Schema version: 2
#
# Table name: games
#
# id :integer not null, primary key
# datetime :datetime
# duration :integer
# flags :boolean
# map :binary
#
require 'rubygems'
require 'active_record'
module DB
class Game < ActiveRecord::Base
has_many... | Ruby |
module AnnotateModels
class << self
MODEL_DIR = "db/models"
FIXTURE_DIRS = ["test/fixtures","spec/fixtures"]
PREFIX = "== Schema Information"
# Simple quoting for the default column value
def quote(value)
case value
when NilClass then "NULL"
when TrueClass ... | Ruby |
include Bzflag
require "date"
module BZCommon
def get_team_color(team_id)
if RogueTeam == team_id
team = "Rogue"
elsif RedTeam == team_id
team = "Red Team"
elsif GreenTeam == team_id
team = "Green Team"
elsif BlueTeam == team_id
team = "Blue Team"
elsif PurpleTeam == t... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
$logEnabled = false;
class FileLogger < Plugin
def initialize()
@date = get_date
@time = get_time
@now = @date + "-" + @time
@log = File.new("stats/_log_#{@now}.txt", "w")
@log_last = File.new("stats/_log_match.txt", "w")
@log_total = Fil... | Ruby |
include Bzflag
args = "1-30"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"
end
def allowed_times
if @args =~ /^[0-9]+-[0-9]+$/
... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
class Announcer < Plugin
def initialize()
end
def player_join(data)
ids = bz_get_player_index_list
ids.each do |id|
bz_send_text_message(BZ_SERVER, id ,"Everybody say 'TI-DI-DI', #{data.callsign} has joined!")
end
end
def pla... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
include Bzflag
name = "Steven Mertens"
class Proto < Plugin
@@countj = 0
@@countp = 0
def player_join(event_data)
@@countj += 1
puts "count => #{@@countj}"
puts "playerID => #{event_data.playerID}"
puts "team => #{event_data.team}"
puts "callsign => #{event_data.callsign}"
puts "email => #{event_da... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Define plugin parms
#args = "1,15,20,30"
args = "10-15"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"... | Ruby |
include Bzflag
# parameter
range = 20
# Airspawn class
class Airspawn < Plugin
def initialize(range = 0)
@range = range
if @range < 0.001
@range = 10.0
end
end
def get_player_spawn_pos(spawn)
tmp = spawn.pos
tmp[2] = @range
spawn.pos = tmp
spawn.handled = true
end
end
# new Airspa... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Helper methods
def get_team_color(team_id)
if RogueTeam == team_id
team = "rogue"
elsif RedTeam == team_id
team = "red"
elsif GreenTeam == team_id
team = "green"
elsif BlueTeam == team_id
team = "blue"
elsif PurpleTeam == team_id
team = "purple"
els... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Test class
class Test < Plugin
def initialize(args = nil)
@args = args
end
def unknown_slash_command(event_data)
cmd = event_data.message.downcase.split[0]
parm = event_data.message.split[1..-1]
if cmd == "/bz_get_group_list"
bz_get_group_list_meth... | Ruby |
# gem install activerecord
# gem install sqlite3-ruby (sqlite3-ruby 1.2.3 (mswin32))
require 'bzcommon'
require 'rubygems'
require 'active_record'
include Bzflag
include BZCommon
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => "yabzs.sqlite"
)
puts 0
ActiveRecord::Schema.... | Ruby |
include Bzflag
require "date"
module BZCommon
def get_team_color(team_id)
if RogueTeam == team_id
team = "Rogue"
elsif RedTeam == team_id
team = "Red Team"
elsif GreenTeam == team_id
team = "Green Team"
elsif BlueTeam == team_id
team = "Blue Team"
elsif PurpleTeam == t... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
$logEnabled = false;
class FileLogger < Plugin
def initialize()
@date = get_date
@time = get_time
@now = @date + "-" + @time
@log = File.new("stats/_log_#{@now}.txt", "w")
@log_last = File.new("stats/_log_match.txt", "w")
@log_total = Fil... | Ruby |
include Bzflag
args = "1-30"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"
end
def allowed_times
if @args =~ /^[0-9]+-[0-9]+$/
... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
class Announcer < Plugin
def initialize()
end
def player_join(data)
ids = bz_get_player_index_list
ids.each do |id|
bz_send_text_message(BZ_SERVER, id ,"Everybody say 'TI-DI-DI', #{data.callsign} has joined!")
end
end
def pla... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
include Bzflag
name = "Steven Mertens"
class Proto < Plugin
@@countj = 0
@@countp = 0
def player_join(event_data)
@@countj += 1
puts "count => #{@@countj}"
puts "playerID => #{event_data.playerID}"
puts "team => #{event_data.team}"
puts "callsign => #{event_data.callsign}"
puts "email => #{event_da... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Define plugin parms
#args = "1,15,20,30"
args = "10-15"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"... | Ruby |
include Bzflag
# parameter
range = 20
# Airspawn class
class Airspawn < Plugin
def initialize(range = 0)
@range = range
if @range < 0.001
@range = 10.0
end
end
def get_player_spawn_pos(spawn)
tmp = spawn.pos
tmp[2] = @range
spawn.pos = tmp
spawn.handled = true
end
end
# new Airspa... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Helper methods
def get_team_color(team_id)
if RogueTeam == team_id
team = "rogue"
elsif RedTeam == team_id
team = "red"
elsif GreenTeam == team_id
team = "green"
elsif BlueTeam == team_id
team = "blue"
elsif PurpleTeam == team_id
team = "purple"
els... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Test class
class Test < Plugin
def initialize(args = nil)
@args = args
end
def unknown_slash_command(event_data)
cmd = event_data.message.downcase.split[0]
parm = event_data.message.split[1..-1]
if cmd == "/bz_get_group_list"
bz_get_group_list_meth... | Ruby |
puts "\nYABZS :: Loading extensions..."
require 'yabzs/plugins/announcer'
require 'yabzs/plugins/timelimit'
require 'yabzs/plugins/databaselogger'
require 'yabzs/plugins/filelogger'
puts "YABZS :: All extensions loaded."
puts "\nYABZS :: Server started at #{get_date} #{get_time}" | Ruby |
require "rubygems"
require "active_record"
task :default => :migrate
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
task :migrate => :environment do
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
... | Ruby |
require 'rubygems'
require 'active_record'
Dir.glob('../db/models/*.rb').each {|f| require f }
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => "../var/yabzs.sqlite"
)
#tyle minut ze ile kill eventow/ile osob
Dir.glob('logs/*.txt').each do |log_file|
p ... | Ruby |
include Bzflag
class KillJan < Plugin
def initialize(args = nil)
@args = args
@timelimit_cmd = "/killjan"
end
def unknown_slash_command(event_data)
cmd = event_data.message.downcase.split[0]
killer_id = event_data.from
if cmd != @timelimit_cmd
return false
else
killJa... | Ruby |
#require "compile_time"
include Bzflag
require "date"
module BZCommon
def get_team_color(team_id)
if RogueTeam == team_id
team = "Rogue"
elsif RedTeam == team_id
team = "Red Team"
elsif GreenTeam == team_id
team = "Green Team"
elsif BlueTeam == team_id
team = "Blue Team... | Ruby |
require 'yabzs/plugins/bzcommon'
include Bzflag
include BZCommon
$logEnabled = false;
class FileLogger < Plugin
def initialize()
@date = get_date
@time = get_time
@now = @date + "-" + @time
@log = File.new("yabzs/var/stats/_log_#{@now}.txt", "w")
@log_last = File.new("yabzs/var/stats/_log_mat... | Ruby |
include Bzflag
args = "1-30"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"
end
def allowed_times
if @args =~ /^[0-9]+-[0-9]+$/
... | Ruby |
# gem install activerecord
# gem install sqlite3-ruby (sqlite3-ruby 1.2.3 (mswin32))
begin
require 'yabzs/plugins/bzcommon'
require 'rubygems'
require 'active_record'
require 'yabzs/plugins/world_map'
require 'yabzs/db/models/game'
require 'yabzs/db/models/event'
require 'yabzs/db/models/event_type'
require 'yabzs/... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'bit-struct'
require 'zlib'
require 'stringio'
require 'RMagick'
require 'rvg/rvg'
include Magick
class Header < BitStruct
unsigned :size, 16, "Size"
unsigned :id, 16 , "ID"
end
class Style < BitStruct
unsigned :version, 16
unsigned :uncompressed, 32
un... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'bit-struct'
require 'zlib'
require 'stringio'
require 'RMagick'
require 'rvg/rvg'
include Magick
class Header < BitStruct
unsigned :size, 16, "Size"
unsigned :id, 16 , "ID"
end
class Style < BitStruct
unsigned :version, 16
unsigned :uncompressed, 32
un... | Ruby |
require 'yabzs/plugins/bzcommon'
include Bzflag
include BZCommon
class Announcer < Plugin
def initialize()
end
def player_join(data)
ids = bz_get_player_index_list
ids.each do |id|
bz_send_text_message(BZ_SERVER, id ,"Everybody say 'TI-DI-DI', #{data.callsign} has joined!")
end
en... | Ruby |
require 'rubygems'
require 'active_record'
require 'db/models/game'
require 'db/models/event'
require 'db/models/event_type'
require 'db/models/flag'
require 'db/models/player'
class AddMap < ActiveRecord::Migration
def self.up
add_column :games, :map, :binary, :default => nil
end
def se... | Ruby |
require 'rubygems'
require 'active_record'
require 'db/models/game'
require 'db/models/event'
require 'db/models/event_type'
require 'db/models/flag'
require 'db/models/player'
class Init < ActiveRecord::Migration
def self.up
create_table :games do |table|
table.column :datetim... | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: flags
#
# id :integer not null, primary key
# acronym :string(255)
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class Flag < ActiveRecord::Base
has_many :events
end
end | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: players
#
# id :integer not null, primary key
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class Player < ActiveRecord::Base
has_many :events
end
end | Ruby |
# == Schema Information
# Schema version: 2
#
# Table name: events
#
# id :integer not null, primary key
# event_type_id :integer
# datetime :datetime
# game_id :integer
# player_id :integer
# target_id :integer
# flag_id :integer
#
require 'rubygems'
r... | Ruby |
# == Schema Information
# Schema version: 1
#
# Table name: event_types
#
# id :integer not null, primary key
# name :string(255)
#
require 'rubygems'
require 'active_record'
module DB
class EventType < ActiveRecord::Base; end
end | Ruby |
# == Schema Information
# Schema version: 2
#
# Table name: games
#
# id :integer not null, primary key
# datetime :datetime
# duration :integer
# flags :boolean
# map :binary
#
require 'rubygems'
require 'active_record'
module DB
class Game < ActiveRecord::Base
has_many... | Ruby |
module AnnotateModels
class << self
MODEL_DIR = "db/models"
FIXTURE_DIRS = ["test/fixtures","spec/fixtures"]
PREFIX = "== Schema Information"
# Simple quoting for the default column value
def quote(value)
case value
when NilClass then "NULL"
when TrueClass ... | Ruby |
include Bzflag
require "date"
module BZCommon
def get_team_color(team_id)
if RogueTeam == team_id
team = "Rogue"
elsif RedTeam == team_id
team = "Red Team"
elsif GreenTeam == team_id
team = "Green Team"
elsif BlueTeam == team_id
team = "Blue Team"
elsif PurpleTeam == t... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
$logEnabled = false;
class FileLogger < Plugin
def initialize()
@date = get_date
@time = get_time
@now = @date + "-" + @time
@log = File.new("stats/_log_#{@now}.txt", "w")
@log_last = File.new("stats/_log_match.txt", "w")
@log_total = Fil... | Ruby |
include Bzflag
args = "1-30"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"
end
def allowed_times
if @args =~ /^[0-9]+-[0-9]+$/
... | Ruby |
require 'bzcommon'
include Bzflag
include BZCommon
class Announcer < Plugin
def initialize()
end
def player_join(data)
ids = bz_get_player_index_list
ids.each do |id|
bz_send_text_message(BZ_SERVER, id ,"Everybody say 'TI-DI-DI', #{data.callsign} has joined!")
end
end
def pla... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
#!/usr/bin/env ruby
require "fileutils"
@verbose = true
def list_patches()
Dir.glob("patches/[0-9][0-9][0-9][0-9]-*").collect{|x| x[8..-1] }.sort
end
def list_applied_patches
if File.exist?(".applied_patches")
File.open(".applied_patches").collect{|x| x.strip!}
else
[]
end
end
def apply_patches( patches_t... | Ruby |
include Bzflag
name = "Steven Mertens"
class Proto < Plugin
@@countj = 0
@@countp = 0
def player_join(event_data)
@@countj += 1
puts "count => #{@@countj}"
puts "playerID => #{event_data.playerID}"
puts "team => #{event_data.team}"
puts "callsign => #{event_data.callsign}"
puts "email => #{event_da... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Define plugin parms
#args = "1,15,20,30"
args = "10-15"
class TimeLimit < Plugin
def initialize(args = nil)
@args = args
@save = bz_get_time_limit
@allowed = allowed_times
@timelimit_cmd = "/timelimit"
@usage = "Usage : /timelimit <minutes>|show|reset"... | Ruby |
include Bzflag
# parameter
range = 20
# Airspawn class
class Airspawn < Plugin
def initialize(range = 0)
@range = range
if @range < 0.001
@range = 10.0
end
end
def get_player_spawn_pos(spawn)
tmp = spawn.pos
tmp[2] = @range
spawn.pos = tmp
spawn.handled = true
end
end
# new Airspa... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Helper methods
def get_team_color(team_id)
if RogueTeam == team_id
team = "rogue"
elsif RedTeam == team_id
team = "red"
elsif GreenTeam == team_id
team = "green"
elsif BlueTeam == team_id
team = "blue"
elsif PurpleTeam == team_id
team = "purple"
els... | Ruby |
# Include the BZFlag ruby module
include Bzflag
# Test class
class Test < Plugin
def initialize(args = nil)
@args = args
end
def unknown_slash_command(event_data)
cmd = event_data.message.downcase.split[0]
parm = event_data.message.split[1..-1]
if cmd == "/bz_get_group_list"
bz_get_group_list_meth... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
#!/usr/bin/env ruby -wKU
#
# Dxdiag wine version
# English language support
#
# Copyright (C) 2011 Drew Wilder-Goodwin
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version ... | Ruby |
#!/usr/bin/env ruby -wKU
#
# Dxdiag wine version
# English language support
#
# Copyright (C) 2011 Drew Wilder-Goodwin
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version ... | Ruby |
#REXML
require "rexml/document"
#RubyTree
require 'rubygems'
require 'tree'
#Standard error message output
def error(msg = nil)
if msg then
puts "Error: #{msg}"
else
puts "Compare two files output by DxDiag"
puts "Usage: test_output.rb file1 file2"
end
exit
end
#Given the curren... | Ruby |
$:.unshift File.join(File.dirname(__FILE__))
require 'test_helper'
class TestDice < Test::Unit::TestCase
def test_keys
d = Yahtzee::Dice.new
d.roll
assert_equal([1,2,3,4,5,6], d.to_hash.keys.sort)
end
def test_roll_randomness
count = {}
roll = 1000
1..roll.times ... | Ruby |
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
require 'yahtzee'
require 'test/unit'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.