code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
module RecentHelper
end
| Ruby |
module ApplicationHelper
def relative_time(from_time)
from_time = from_time.to_time if from_time.respond_to?(:to_time)
distance_in_minutes = (((Time.now - from_time).abs)/60).round
case distance_in_minutes
when 0..1 then (distance_in_minutes == 0) ? '< 1 min ago' : '1 min ago'
when 2..45 then "#{d... | Ruby |
class Recent
def name
"Recent Changes"
end
def recent_items(options)
Page.recent_items(options)
end
def last_modified
Page.last_modified
end
end | Ruby |
module SearchHelper
end
| Ruby |
module PageHelper
def show_errors
if @page && !@page.errors.empty?
content_tag(
"div",
content_tag("ul", @page.errors.full_messages.collect { |msg| content_tag("li", msg) }),
:class => "errorExplanation"
)
end
end
def comparing?
controller.action_name == "compare"
end
def editing?
cont... | Ruby |
module FeedHelper
end
| Ruby |
module TagHelper
end
| Ruby |
class Comment < ActiveRecord::Base
belongs_to :revision
belongs_to :user
def page
revision.page
end
def content
comment
end
end
| Ruby |
class User < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
def self.find_or_create(name)
u = User.find_by_name(name)
return u if u
u = User.new(:name => name)
u.save
return u
end
def key
unless self.key?
self[:key] = MD5.hexdigest((object_id + rand(255)).to_s)
sa... | Ruby |
class Revision < ActiveRecord::Base
belongs_to :page
belongs_to :user
has_many :comments
# get the revision number as displayed on the page
def rid
return 1 if self.page.nil?
revs = self.page.index_revisions
n = 0
until n >= revs.length || revs[n] == self
n += 1
end
revs.length - n
end
def earl... | Ruby |
class Page < ActiveRecord::Base
has_many :index_revisions, :class_name => "Revision", :order => "created_at DESC", :select => 'id, created_at', :include => :user
has_many :revisions, :exclusively_dependent => true, :order => "created_at DESC", :include => :user
has_many :comments, :through => :revisions, :order => "... | Ruby |
class TagController < ApplicationController
def index
if params[:tag]
@tag = Tag.find_or_new(params[:tag])
render :action => "pages"
else
render :action => "tags"
end
end
end
| Ruby |
class SearchController < ApplicationController
before_filter :show_search
def index
@terms = params[:search]
if request.post? && @terms.blank?
flash.now[:notice] = "No search terms given."
end
@tags = Tag.search(@terms) || [ ]
@page_items = Page.search(@terms) || [ ]
end
protected
def show_search
... | Ruby |
class FeedController < ApplicationController
session :off
before_filter :since
layout nil
def authenticate
unless WikiOptions[:allow_anonymous_read]
unless params[:key] && User.find_by_key(params[:key])
render :nothing => true, :status => 403 # forbidden
return false
end
end
end
def page
@f... | Ruby |
class ApplicationController < ActionController::Base
include ExceptionNotifiable rescue nil
before_filter :authenticate
def authenticate
unless session[:user_name]
begin
require 'external_auth'
session[:user_name] = ExternalAuth.get_user(cookies)
rescue LoadError
end
end
if session[:user_nam... | Ruby |
class RecentController < ApplicationController
def index
end
end
| Ruby |
class PageController < ApplicationController
include HTMLDiff
before_filter :load_page, :except => :edit_preview
def show
redirect_to(:action => "edit", :title => @title) and return if @revision.new_record?
@content = @revision.content.wikify if @revision.content
end
def popup
show
render :layout => "po... | Ruby |
ActionController::Routing::Routes.draw do |map|
# ===== pages =====
map.page_feed 'page/:name/:key/feed.xml', :controller => 'feed', :name => 'Contents', :action => 'page'
map.page 'page/:title/:action/:rev/:rev2',
:controller => 'page',
:title => 'Contents',
:action => 'show',
:rev => nil,
:rev2 ... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /mswin32/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
RAILS... | Ruby |
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
config.log_level = :warn
# Full error reports are disabled and caching is turned on
config.action_con... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
#
# Copied from Instiki-0.11.0 by David Heinemeier Hansson.
# License available at: http://www.ruby-lang.org/en/LICENSE.txt
#
module HTMLDiff
Match = Struct.new(:start_in_old, :start_in_new, :size)
class Match
def end_in_old
self.start_in_old + self.size
end
def end_in_new
self.start_... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# an... | Ruby |
#!/usr/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
re... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/breakpointer' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate' | Ruby |
module RecentHelper
end
| Ruby |
module ApplicationHelper
def relative_time(from_time)
from_time = from_time.to_time if from_time.respond_to?(:to_time)
distance_in_minutes = (((Time.now - from_time).abs)/60).round
case distance_in_minutes
when 0..1 then (distance_in_minutes == 0) ? '< 1 min ago' : '1 min ago'
when 2..45 then "#{d... | Ruby |
class Recent
def name
"Recent Changes"
end
def recent_items(options)
Page.recent_items(options)
end
def last_modified
Page.last_modified
end
end | Ruby |
module SearchHelper
end
| Ruby |
module PageHelper
def show_errors
if @page && !@page.errors.empty?
content_tag(
"div",
content_tag("ul", @page.errors.full_messages.collect { |msg| content_tag("li", msg) }),
:class => "errorExplanation"
)
end
end
def comparing?
controller.action_name == "compare"
end
def editing?
cont... | Ruby |
module FeedHelper
end
| Ruby |
module TagHelper
end
| Ruby |
class Comment < ActiveRecord::Base
belongs_to :revision
belongs_to :user
def page
revision.page
end
def content
comment
end
end
| Ruby |
class User < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
def self.find_or_create(name)
u = User.find_by_name(name)
return u if u
u = User.new(:name => name)
u.save
return u
end
def key
unless self.key?
self[:key] = MD5.hexdigest((object_id + rand(255)).to_s)
sa... | Ruby |
class Revision < ActiveRecord::Base
belongs_to :page
belongs_to :user
has_many :comments
# get the revision number as displayed on the page
def rid
return 1 if self.page.nil?
revs = self.page.index_revisions
n = 0
until n >= revs.length || revs[n] == self
n += 1
end
revs.length - n
end
def earl... | Ruby |
class Page < ActiveRecord::Base
has_many :index_revisions, :class_name => "Revision", :order => "created_at DESC", :select => 'id, created_at', :include => :user
has_many :revisions, :exclusively_dependent => true, :order => "created_at DESC", :include => :user
has_many :comments, :through => :revisions, :order => "... | Ruby |
class TagController < ApplicationController
def index
if params[:tag]
@tag = Tag.find_or_new(params[:tag])
render :action => "pages"
else
render :action => "tags"
end
end
end
| Ruby |
class SearchController < ApplicationController
before_filter :show_search
def index
@terms = params[:search]
if request.post? && @terms.blank?
flash.now[:notice] = "No search terms given."
end
@tags = Tag.search(@terms) || [ ]
@page_items = Page.search(@terms) || [ ]
end
protected
def show_search
... | Ruby |
class FeedController < ApplicationController
session :off
before_filter :since
layout nil
def authenticate
unless WikiOptions[:allow_anonymous_read]
unless params[:key] && User.find_by_key(params[:key])
render :nothing => true, :status => 403 # forbidden
return false
end
end
end
def page
@f... | Ruby |
class ApplicationController < ActionController::Base
include ExceptionNotifiable rescue nil
before_filter :authenticate
def authenticate
unless session[:user_name]
begin
require 'external_auth'
session[:user_name] = ExternalAuth.get_user(cookies)
rescue LoadError
end
end
if session[:user_nam... | Ruby |
class RecentController < ApplicationController
def index
end
end
| Ruby |
class PageController < ApplicationController
include HTMLDiff
before_filter :load_page, :except => :edit_preview
def show
redirect_to(:action => "edit", :title => @title) and return if @revision.new_record?
@content = @revision.content.wikify if @revision.content
end
def popup
show
render :layout => "po... | Ruby |
ActionController::Routing::Routes.draw do |map|
# ===== pages =====
map.page_feed 'page/:name/:key/feed.xml', :controller => 'feed', :name => 'Contents', :action => 'page'
map.page 'page/:title/:action/:rev/:rev2',
:controller => 'page',
:title => 'Contents',
:action => 'show',
:rev => nil,
:rev2 ... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /mswin32/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
RAILS... | Ruby |
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
config.log_level = :warn
# Full error reports are disabled and caching is turned on
config.action_con... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
#
# Copied from Instiki-0.11.0 by David Heinemeier Hansson.
# License available at: http://www.ruby-lang.org/en/LICENSE.txt
#
module HTMLDiff
Match = Struct.new(:start_in_old, :start_in_new, :size)
class Match
def end_in_old
self.start_in_old + self.size
end
def end_in_new
self.start_... | Ruby |
require 'rake/clean'
CLEAN.include('dist/kmltree.css', 'dist/kmltree.min.js', 'dist/kmltree.js', 'dist/images', 'src/_sprites.sass', 'sprites-url')
CLOBBER.include('compiler')
SRC = FileList[ 'src/kmltreeManager.js', 'src/base64.js', 'src/tmpl.js', 'src/kmldom.js', 'src/URI.js', 'src/kmltree.js', 'src/googleLayers.js... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# 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' }])
# Major.create(:name... | Ruby |
class CreateAutoUsers < ActiveRecord::Migration
def self.up
create_table :auto_users do |t|
t.timestamps
end
end
def self.down
drop_table :auto_users
end
end
| Ruby |
class CreateWarehouses < ActiveRecord::Migration
def self.up
create_table :warehouses do |t|
t.timestamps
end
end
def self.down
drop_table :warehouses
end
end
| Ruby |
class CreatePrices < ActiveRecord::Migration
def self.up
create_table :prices do |t|
t.timestamps
end
end
def self.down
drop_table :prices
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateGameHistories < ActiveRecord::Migration
def self.up
create_table :game_histories do |t|
t.timestamps
end
end
def self.down
drop_table :game_histories
end
end
| Ruby |
class CreateMiscs < ActiveRecord::Migration
def self.up
create_table :miscs do |t|
t.timestamps
end
end
def self.down
drop_table :miscs
end
end
| Ruby |
class CreateBoards < ActiveRecord::Migration
def self.up
create_table :boards do |t|
t.timestamps
end
end
def self.down
drop_table :boards
end
end
| Ruby |
class CreateSales < ActiveRecord::Migration
def self.up
create_table :sales do |t|
t.timestamps
end
end
def self.down
drop_table :sales
end
end
| Ruby |
class CreateDebts < ActiveRecord::Migration
def self.up
create_table :debts do |t|
t.timestamps
end
end
def self.down
drop_table :debts
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.