code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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
begin
require File.join(File.dirname(__FILE__), '../vendor/plugins/acts_as_ferret/lib/server_manager')
rescue LoadError
# try the gem
require 'rubygems'
gem 'acts_as_ferret'
require 'server_manager'
end
| 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/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/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/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 ApplicationHelper
def w3c_date(date)
date.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00")
end
end
| Ruby |
module AccountHelper
end | Ruby |
module AdminHelper
end
| Ruby |
module SiteHelper
end
| Ruby |
class Cv < ActiveRecord::Base
validates_presence_of :candidate_name, :cv, :email
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_uniqueness_of :email
protected
def validate
errors.add(:candidate_name, 'is not a full name.') if self.candidate_name.split(' ')... | Ruby |
class Notifier < ActionMailer::Base
def uploaded_cv(form)
recipients 'chris@fstmarketing.com'
from form[:email]
subject "Application for position #{form[:jid]||'CV Just Received'}"
body "From: #{form[:name].humanize}\n\nEmail: #{form[:email]}\nCurrent Salary: #{form[:current_salary]||'not specified'}... | Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
validates_presence_of :login, :email
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, :if ... | Ruby |
class Job < ActiveRecord::Base
validates_presence_of :jid, :job_title, :location, :description, :sector_id
validates_uniqueness_of :jid
belongs_to :sector
after_save :update_sitemap
private
def update_sitemap
require 'curb'
Curl::Easy.perform("www.google.com/webmasters/tools/ping?sitemap=http%3... | Ruby |
class Sector < ActiveRecord::Base
has_many :jobs
validates_presence_of :name
validates_uniqueness_of :name
end | Ruby |
class AccountController < ApplicationController
def index
redirect_to(:action => 'signup') unless logged_in? || User.count > 0
end
def login
return unless request.post?
self.current_user = User.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include AuthenticatedSystem
# Pick a unique cookie name to distinguish our session data from others'
sessio... | Ruby |
class SiteController < ApplicationController
verify :method => :post, :only => [:search, :upload]
def jobs
@sectors = Sector.find(:all, :include => :jobs)
end
def rss
@vacancies = Job.find(:all)
render :layout => false
end
def sitemap
@root_url = "http://#{`hostname`.chop}/"
... | Ruby |
class AdminController < ApplicationController
before_filter :login_required
verify :method => :post, :only => [:update, :delete, :create]
uses_tiny_mce
active_scaffold :job
def index
@jobs = Job.find(:all, :order => "jid DESC")
@sectors = Sector.find(:all)
end
def create
job = Job.... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.connect 'admin/:action/:id', :controller => 'admin', :id => 'id'
map.connect 'account/:action', :controller => 'account', :action => 'action'
map.comatose_admin
map.connect 'view/:id', :controller => 'site', :action => 'view', :id => 'id'
map.connec... | 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 |
# 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Enable the breakpoint server that script/breakpointer connects to
config.breakpoint_server = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local ... | 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 |
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
current_user != :false
end
# Accesses the current user from the session.
def current_user
@current_user ||= ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user] = user ? users(user).id : nil
end
def content_type(type)
@request.env['Content-Type'] = type
end
def accept(accept)
@request.env["HTTP_ACCEPT"] = accept
en... | Ruby |
class JobExtras < ActiveRecord::Migration
def self.up
add_column :jobs, :visible, :boolean
add_column :jobs, :benefits, :text
end
def self.down
remove_column :jobs, :visible
remove_column :jobs, :benefits
end
end
| Ruby |
class CreateSectors < ActiveRecord::Migration
def self.up
create_table :sectors do |t|
t.column :name, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :sectors
end
end | Ruby |
module Comatose
class Page < ActiveRecord::Base
set_table_name 'comatose_pages'
acts_as_versioned :if_changed => [:title, :slug, :keywords, :body]
end
end
class AddComatoseSupport < ActiveRecord::Migration
# Schema for Comatose version 0.7+
def self.up
create_table :comatose_pages do |t|
t.c... | Ruby |
class AddLocationFields < ActiveRecord::Migration
def self.up
add_column :jobs, :latitude, :float
add_column :jobs, :longitude, :float
end
def self.down
remove_column :jobs, :latitude
remove_column :jobs, :longitude
end
end
| Ruby |
class CreateJobs < ActiveRecord::Migration
def self.up
create_table :jobs do |t|
t.column :job_title, :string
t.column :sector_id, :integer
t.column :location, :string
t.column :salary, :float
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def ... | Ruby |
class AddSessions < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.column :session_id, :string
t.column :data, :text
t.column :updated_at, :datetime
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sess... | Ruby |
class JobDescriptions < ActiveRecord::Migration
def self.up
add_column :jobs, :description, :text
end
def self.down
remove_column :jobs, :description
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table "users", :force => true do |t|
t.column :login, :string
t.column :email, :string
t.column :crypted_password, :string, :limit => 40
t.column :salt, :str... | Ruby |
class AddJids < ActiveRecord::Migration
def self.up
add_column :jobs, :jid, :string
end
def self.down
remove_column :jobs, :jid
end
end
| Ruby |
class CreateCvs < ActiveRecord::Migration
def self.up
create_table :cvs do |t|
t.column :candidate_name, :string
t.column :cv, :binary
t.column :email, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :cvs
end
end... | Ruby |
module ApplicationHelper
def w3c_date(date)
date.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00")
end
end
| Ruby |
module AccountHelper
end | Ruby |
module AdminHelper
end
| Ruby |
module SiteHelper
end
| Ruby |
class Cv < ActiveRecord::Base
validates_presence_of :candidate_name, :cv, :email
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
validates_uniqueness_of :email
protected
def validate
errors.add(:candidate_name, 'is not a full name.') if self.candidate_name.split(' ')... | Ruby |
class Notifier < ActionMailer::Base
def uploaded_cv(form)
recipients 'chris@fstmarketing.com'
from form[:email]
subject "Application for position #{form[:jid]||'CV Just Received'}"
body "From: #{form[:name].humanize}\n\nEmail: #{form[:email]}\nCurrent Salary: #{form[:current_salary]||'not specified'}... | Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
validates_presence_of :login, :email
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, :if ... | Ruby |
class Job < ActiveRecord::Base
validates_presence_of :jid, :job_title, :location, :description, :sector_id
validates_uniqueness_of :jid
belongs_to :sector
after_save :update_sitemap
private
def update_sitemap
require 'curb'
Curl::Easy.perform("www.google.com/webmasters/tools/ping?sitemap=http%3... | Ruby |
class Sector < ActiveRecord::Base
has_many :jobs
validates_presence_of :name
validates_uniqueness_of :name
end | Ruby |
class AccountController < ApplicationController
def index
redirect_to(:action => 'signup') unless logged_in? || User.count > 0
end
def login
return unless request.post?
self.current_user = User.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include AuthenticatedSystem
# Pick a unique cookie name to distinguish our session data from others'
sessio... | Ruby |
class SiteController < ApplicationController
verify :method => :post, :only => [:search, :upload]
def jobs
@sectors = Sector.find(:all, :include => :jobs)
end
def rss
@vacancies = Job.find(:all)
render :layout => false
end
def sitemap
@root_url = "http://#{`hostname`.chop}/"
... | Ruby |
class AdminController < ApplicationController
before_filter :login_required
verify :method => :post, :only => [:update, :delete, :create]
uses_tiny_mce
active_scaffold :job
def index
@jobs = Job.find(:all, :order => "jid DESC")
@sectors = Sector.find(:all)
end
def create
job = Job.... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.connect 'admin/:action/:id', :controller => 'admin', :id => 'id'
map.connect 'account/:action', :controller => 'account', :action => 'action'
map.comatose_admin
map.connect 'view/:id', :controller => 'site', :action => 'view', :id => 'id'
map.connec... | 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 |
# 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
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Enable the breakpoint server that script/breakpointer connects to
config.breakpoint_server = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local ... | 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 |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| 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
# 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 |
# Be sure to restart your 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 = '2.0... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | 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
# ... | Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module PageHelper
end
| Ruby |
class Feedback < ActiveRecord::Base
end
| Ruby |
class PageController < ApplicationController
def index
end
def about
end
def services
end
def contact
@feedback = Feedback.new
end
def send_feedback
@feedback = Feedback.new(params[:feedback])
if @feedback.save
#send an e-mail with the feedback
redirect_to :action =... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details... | 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 |
#!/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
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| 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/request'
| 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/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| 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/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.