code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require File.dirname(__FILE__) + "/../config/environment.rb" puts "Creating root user" u = User.create(:nickname => "root", :user_name => "Charlie Root", :password => "password", :email => "root@chatlino.com", :agree_term => 'y') puts "Creating th...
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/about'
Ruby
#!/usr/bin/env ruby # HTTP Push Server # #Copyright (c) 2006 Alexander MacCaw # based on httpd daemon V 1.8 by Hipster: # http://www.xs4all.nl/~hipster # # Copyright (C) 2000-2004 Michel van de Ven <hipster@xs4all.nl> # Copyright (C) 2004 Patric Mueller <bhaak@gmx.net> #Permission is hereby granted, free of char...
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/performance/benchmarker'
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/plugin'
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/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby # HTTP Push Server # #Copyright (c) 2006 Alexander MacCaw # based on httpd daemon V 1.8 by Hipster: # http://www.xs4all.nl/~hipster # # Copyright (C) 2000-2004 Michel van de Ven <hipster@xs4all.nl> # Copyright (C) 2004 Patric Mueller <bhaak@gmx.net> #Permission is hereby granted, free of char...
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 File.dirname(__FILE__) + "/../config/environment.rb" puts "Creating root user" u = User.create(:nickname => "root", :user_name => "Charlie Root", :password => "password", :email => "root@chatlino.com", :agree_term => 'y') puts "Creating th...
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/runner'
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/generate'
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
# Create the join table ChatroomsUsers class CreateChatroomsUsers < ActiveRecord::Migration def self.up create_table :chatrooms_users, :id=>false, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :chatroom_id, :integer t.column :user_id, :integer end end def self.do...
Ruby
class CreateChatrooms < ActiveRecord::Migration def self.up create_table :chatrooms, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :title, :string t.column :description, :string t.column :user_id, :integer t.column :subject, :text t.column :sketch, :text t.co...
Ruby
class CreateUser < ActiveRecord::Migration def self.up create_table :user, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :nickname, :string, :limit=>45, :null=>false t.column :user_name, :string, :limit=>45, :null=>false t.column :password, :string, :limit=>45, ...
Ruby
require "pathname" require "cgi" # load the openid library begin require "rubygems" require_gem "ruby-openid", ">= 1.0.2" rescue LoadError require "openid" end class OpenidAccountController < ApplicationController # process the login request, disover the openid server, and # then redirect. def login o...
Ruby
class UserController < ApplicationController before_filter :require_login, :only=>[:invite] # display the summary of user rankings def index end def send_message @user = User.find(params[:id]) @message.to_user = @user rescue flash[:error] = _"User not found" redirect_to :action => "index"...
Ruby
class AccountController < ApplicationController before_filter :require_login, :only=>[:settings, :confirm] def index redirect_to :controller=>'chatroom' end def ajax_login if request.method == :post success = login_authenticate(params[:user][:email], params[:user][:password]) else succ...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. require "base64" require "digest/sha1" require_dependency "openid_login_system" class ApplicationController < ActionController::Base include OpenidLoginSystem inc...
Ruby
require 'ipush' class ChatroomController < ApplicationController yullio_column_template :yui_t6 before_filter :require_login before_filter :check_push_solution def index @chatrooms = Chatroom.find(:all) render :layout => "application" end def all @chatrooms = Chatroom.find(:all) render :...
Ruby
module OpenidAccountHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def user_to_hash(user) user = User.new unless user { :id => user.id, :user_name => user.user_name, :shortname => user.shortname, :photo_path => user.photo_path, :link_to...
Ruby
require "digest/sha1" class User < ActiveRecord::Base set_table_name :user before_create :crypt_password # validates_uniqueness_of :email, :on=>:create # validates_length_of :password, :within => 5..40 # validates_confirmation_of :password, :on=>:create has_one :confirmation has_and_belongs_to_many :...
Ruby
class Chatroom < ActiveRecord::Base belongs_to :owner, :class_name => 'User', :foreign_key => :user_id has_and_belongs_to_many :users def has_owner(user=nil) if !user return false end return (chatroom.owner == user) end end
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/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 ...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 ...
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 =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # Sa...
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 # 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 production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
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
require_dependency "user" module OpenidLoginSystem protected # overwrite this if you want to restrict access to only a few actions # or if you want to check if the user has the correct rights # example: # # # only allow nonbobs # def authorize?(user) # user.login != "bob" # end def a...
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/inspector'
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/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require File.dirname(__FILE__) + "/../config/environment.rb" puts "Creating root user" u = User.create(:nickname => "root", :user_name => "Charlie Root", :password => "password", :email => "root@chatlino.com", :agree_term => 'y') puts "Creating th...
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/about'
Ruby
#!/usr/bin/env ruby # Copyright (c) 2006 Alexander MacCaw # Copyright (c) 2006 Michael Schuerig # # 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 # with...
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/performance/benchmarker'
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/plugin'
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/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby # Copyright (c) 2006 Alexander MacCaw # Copyright (c) 2006 Michael Schuerig # # 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 # with...
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 File.dirname(__FILE__) + "/../config/environment.rb" puts "Creating root user" u = User.create(:nickname => "root", :user_name => "Charlie Root", :password => "password", :email => "root@chatlino.com", :agree_term => 'y') puts "Creating th...
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/runner'
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/generate'
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
# Create the join table ChatroomsUsers class CreateChatroomsUsers < ActiveRecord::Migration def self.up create_table :chatrooms_users, :id=>false, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :chatroom_id, :integer t.column :user_id, :integer end end def self.do...
Ruby
class CreateChatrooms < ActiveRecord::Migration def self.up create_table :chatrooms, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :title, :string t.column :description, :string t.column :user_id, :integer t.column :subject, :text t.column :sketch, :text t.co...
Ruby
class CreateUser < ActiveRecord::Migration def self.up create_table :user, :options => 'engine=InnoDB default charset=utf8' do |t| t.column :nickname, :string, :limit=>45, :null=>false t.column :user_name, :string, :limit=>45, :null=>false t.column :password, :string, :limit=>45, ...
Ruby
require "pathname" require "cgi" # load the openid library begin require "rubygems" require_gem "ruby-openid", ">= 1.0.2" rescue LoadError require "openid" end class OpenidAccountController < ApplicationController # process the login request, disover the openid server, and # then redirect. def login o...
Ruby
class UserController < ApplicationController before_filter :require_login, :only=>[:invite] # display the summary of user rankings def index end def send_message @user = User.find(params[:id]) @message.to_user = @user rescue flash[:error] = _"User not found" redirect_to :action => "index"...
Ruby
class AccountController < ApplicationController before_filter :require_login, :only=>[:settings, :confirm] def index redirect_to :controller=>'chatroom' end def ajax_login if request.method == :post success = login_authenticate(params[:user][:email], params[:user][:password]) else succ...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. require "base64" require "digest/sha1" require_dependency "openid_login_system" class ApplicationController < ActionController::Base include OpenidLoginSystem inc...
Ruby
require 'ipush' class ChatroomController < ApplicationController yullio_column_template :yui_t6 before_filter :require_login before_filter :check_push_solution def index @chatrooms = Chatroom.find(:all) render :layout => "application" end def all @chatrooms = Chatroom.find(:all) render :...
Ruby
module OpenidAccountHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def user_to_hash(user) user = User.new unless user { :id => user.id, :user_name => user.user_name, :shortname => user.shortname, :photo_path => user.photo_path, :link_to...
Ruby
require "digest/sha1" class User < ActiveRecord::Base set_table_name :user before_create :crypt_password # validates_uniqueness_of :email, :on=>:create # validates_length_of :password, :within => 5..40 # validates_confirmation_of :password, :on=>:create has_one :confirmation has_and_belongs_to_many :...
Ruby
class Chatroom < ActiveRecord::Base belongs_to :owner, :class_name => 'User', :foreign_key => :user_id has_and_belongs_to_many :users def has_owner(user=nil) if !user return false end return (chatroom.owner == user) end end
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/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 impaire...
Ruby
#!/usr/bin/env 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 ...
Ruby
#!/usr/bin/env 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 impaire...
Ruby