code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# == Schema Information
# Schema version: 20080916002106
#
# Table name: photos
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# parent_id :integer(4)
# content_type :string(255)
# filename :string(255)
# thumbnail :string(255)
# size ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: email_verifications
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# code :string(255)
# created_at :datetime
# updated_at :datetime
#
class EmailVerification < ActiveRecord::B... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: thumbnails
#
# id :integer(4) not null, primary key
# parent_id :integer(4)
# content_type :string(255)
# filename :string(255)
# thumbnail :string(255)
# size :integer(4)
# width ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: people
#
# id :integer(4) not null, primary key
# email :string(255)
# name :string(255)
# remember_token :string(255)
# crypted_password ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: events
#
# id :integer(4) not null, primary key
# title :string(255) default(""), not null
# description :string(255)
# person_id :integer(4) not null
# start_time ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: galleries
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# title :string(255)
# description :string(255)
# photos_count :integer(4) default(0), not null
# p... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: posts
#
# id :integer(4) not null, primary key
# blog_id :integer(4)
# topic_id :integer(4)
# person_id :integer(4)
# title :string(255)
# body :text
# type :string(255)... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: communications
#
# id :integer(4) not null, primary key
# subject :string(255)
# content :text
# parent_id :integer(4)
# sender_id :integer(4) ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: posts
#
# id :integer(4) not null, primary key
# blog_id :integer(4)
# topic_id :integer(4)
# person_id :integer(4)
# title :string(255)
# body :text
# type :string(255)... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: forums
#
# id :integer(4) not null, primary key
# name :string(255)
# description :text
# topics_count :integer(4) default(0), not null
# created_at :datetime
# updated_at :datetime ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: people
#
# id :integer(4) not null, primary key
# email :string(255)
# name :string(255)
# remember_token :string(255)
# crypted_password ... | Ruby |
class PersonMailer < ActionMailer::Base
extend PreferencesHelper
def domain
@domain ||= PersonMailer.global_prefs.domain
end
def server
@server_name ||= PersonMailer.global_prefs.server_name
end
def password_reminder(person)
from "Password reminder <password-reminder@#{domain}>"... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: activities
#
# id :integer(4) not null, primary key
# public :boolean(1)
# item_id :integer(4)
# person_id :integer(4)
# item_type :string(255)
# created_at :datetime
# updated_at :dateti... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: comments
#
# id :integer(4) not null, primary key
# commenter_id :integer(4)
# commentable_id :integer(4)
# commentable_type :string(255) default(""), not null
# body :text
# c... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: connections
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# contact_id :integer(4)
# status :integer(4)
# accepted_at :datetime
# created_at :datetime
# updated_at ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: conversations
#
# id :integer(4) not null, primary key
#
class Conversation < ActiveRecord::Base
has_many :messages, :order => :created_at
end
| Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: feeds
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# activity_id :integer(4)
#
class Feed < ActiveRecord::Base
belongs_to :activity
belongs_to :person
end
| Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: communications
#
# id :integer(4) not null, primary key
# subject :string(255)
# content :text
# parent_id :integer(4)
# sender_id :integer(4) ... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: blogs
#
# id :integer(4) not null, primary key
# person_id :integer(4)
# created_at :datetime
# updated_at :datetime
#
class Blog < ActiveRecord::Base
belongs_to :person
has_many :posts, :order => "crea... | Ruby |
# == Schema Information
# Schema version: 20080916002106
#
# Table name: topics
#
# id :integer(4) not null, primary key
# forum_id :integer(4)
# person_id :integer(4)
# name :string(255)
# forum_posts_count :integer(4) default(0), not null
# ... | Ruby |
class EventsController < ApplicationController
before_filter :in_progress unless test?
before_filter :login_required
before_filter :load_event, :except => [:index, :new, :create]
before_filter :load_date, :only => [:index, :show]
before_filter :authorize_show, :only => :show
before_filter :authorize_change... | Ruby |
class MessagesController < ApplicationController
before_filter :login_required, :setup
before_filter :authenticate_person, :only => :show
# GET /messages
def index
@messages = current_person.received_messages(params[:page])
respond_to do |format|
format.html { render :template => "messages/index... | Ruby |
# NOTE: We use "posts" for both forum topic posts and blog posts,
# There is some trickery to handle the two in a unified manner.
class PostsController < ApplicationController
include ApplicationHelper
include BlogsHelper
before_filter :login_required
before_filter :get_instance_vars
before_filter :check_b... | Ruby |
class ConnectionsController < ApplicationController
before_filter :login_required, :setup
before_filter :authorize_view, :only => :index
before_filter :authorize_person, :only => [:edit, :update, :destroy]
before_filter :redirect_for_inactive, :only => [:edit, :update]
# Show all the contacts for a pers... | Ruby |
# NOTE: We use "comments" for both wall topic comments and blog comments,
# There is some trickery to handle the two in a unified manner.
class CommentsController < ApplicationController
before_filter :login_required
before_filter :get_instance_vars
before_filter :authorize_destroy, :only => [:destroy]
befor... | Ruby |
class Admin::PreferencesController < ApplicationController
before_filter :login_required, :admin_required
before_filter :setup
in_place_edit_for :post, :app_name
def index
render :action => "show"
end
def show
respond_to do |format|
format.html
end
end
def edit
end
de... | Ruby |
class Admin::ForumsController < ApplicationController
before_filter :login_required, :admin_required, :setup
before_filter :protect_last_forum, :only => :destroy
def index
@forums = Forum.find(:all)
respond_to do |format|
format.html
end
end
def show
@forum = Forum.find(params[:id]... | Ruby |
class Admin::PeopleController < ApplicationController
before_filter :login_required, :admin_required
def index
@people = Person.paginate(:all, :page => params[:page], :order => :name)
end
def update
@person = Person.find(params[:id])
if current_person?(@person)
flash[:error] = "Action faile... | Ruby |
class PasswordRemindersController < ApplicationController
before_filter :check_can_send_email
def new
end
def create
person = Person.find_by_email(params[:person][:email])
respond_to do |format|
format.html do
if person.nil?
flash.now[:error] = "Invalid email address"
... | Ruby |
class HomeController < ApplicationController
skip_before_filter :require_activation
def index
@body = "home"
@topics = Topic.find_recent
@members = Person.find_recent
if logged_in?
@feed = current_person.feed
@some_contacts = current_person.some_contacts
@requested_contacts = cu... | Ruby |
class TopicsController < ApplicationController
before_filter :login_required
before_filter :admin_required, :only => [:edit, :update, :destroy]
before_filter :setup
def index
redirect_to forum_url(params[:forum_id])
end
def show
@topic = Topic.find(params[:id])
@posts = @topic.posts
... | Ruby |
class GalleriesController < ApplicationController
before_filter :login_required
before_filter :correct_user_required, :only => [ :edit, :update, :destroy ]
def show
@body = "galleries"
@gallery = Gallery.find(params[:id])
@photos = @gallery.photos.paginate :page => params[:page]
end
def ind... | Ruby |
class PhotosController < ApplicationController
before_filter :login_required
before_filter :correct_user_required,
:only => [ :edit, :update, :destroy, :set_primary,
:set_avatar ]
before_filter :correct_gallery_requried, :only => [:new, :create]
def index
redi... | 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
include AuthenticatedSystem
include SharedHelper
include ... | Ruby |
class ActivitiesController < ApplicationController
before_filter :authorize_user, :only => :destroy
# This gets called after activity destruction for some reason.
def show
render :text => ""
end
# DELETE /activities/1
# DELETE /activities/1.xml
def destroy
@activity.destroy
flash[:success] ... | Ruby |
class SearchesController < ApplicationController
include ApplicationHelper
before_filter :login_required
def index
redirect_to(home_url) and return if params[:q].nil?
query = params[:q].strip.inspect
model = strip_admin(params[:model])
page = params[:page] || 1
unless %(Person Me... | Ruby |
class BlogsController < ApplicationController
before_filter :login_required
def show
@body = "blog"
@blog = Blog.find(params[:id])
@posts = @blog.posts.paginate(:page => params[:page])
respond_to do |format|
format.html
end
end
end
| Ruby |
class ForumsController < ApplicationController
before_filter :login_required, :setup
def index
@forums = Forum.find(:all)
if @forums.length == 1
redirect_to forum_url(@forums.first) and return
end
end
def show
@forum = Forum.find(params[:id])
@topics = @forum.topics.paginate(:page... | Ruby |
class PeopleController < ApplicationController
skip_before_filter :require_activation, :only => :verify_email
skip_before_filter :admin_warning, :only => [ :show, :update ]
before_filter :login_required, :only => [ :show, :edit, :update,
:common_contacts ]
before_f... | Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
skip_before_filter :require_activation, :only => [:new, :destroy]
def new
@body = "login single-col"
end
def create
if using_open_id?
open_id_authentication(params[:openid_url])
... | 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 |
# This overrides the :per_page attribute for will_paginate.
# The default for will_paginate is 30, which seems a little high.
class ActiveRecord::Base
def self.per_page
10
end
end | Ruby |
class ActiveRecord::Base
# Build and create records unsafely, bypassing attr_accessible.
# These methods are especially useful in tests and in the console.
def self.unsafe_build(attrs)
record = new
record.unsafe_attributes = attrs
record
end
def self.unsafe_create(attrs)
record = unsafe... | Ruby |
# Column sizes
FULL = 20
LEFT = LARGER_COLUMN = 14
RIGHT = SMALLER_COLUMN = 6
# Database strings typically can't be longer than 255.
MAX_STRING_LENGTH = 255
MEDIUM_STRING_LENGTH = 100
SMALL_STRING_LENGTH = 40
MAX_TEXT_LENGTH = 5000
MEDIUM_TEXT_LENGTH = 500
SMALL_TEXT_LENGTH = 300
# The number of raster colums.
N_COL... | Ruby |
require 'digest/sha1'
require 'rand'
require 'will_paginate'
require 'string'
# Handle RDiscount and BlueCloth in a unified way.
begin
require 'rdiscount'
rescue LoadError
# Rails loads BlueCloth automatically if present.
nil
end
# In some cases autotest interprets the initialization of the UUID generator
# as s... | Ruby |
require 'openssl'
module Crypto
def self.create_keys(priv = "rsa_key", pub = "#{priv}.pub", bits = 1024)
private_key = OpenSSL::PKey::RSA.new(bits)
File.open(priv, "w+") { |fp| fp << private_key.to_s }
File.open(pub, "w+") { |fp| fp << private_key.public_key.to_s }
private_key
end
cla... | Ruby |
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
# Only save the attributes that have changed since the record was loaded.
ActiveRecord::Base.partial_updates = true
# Include ActiveRecord class name as root for JSON seri... | Ruby |
# Methods in this file need to be loaded first.
# This is because other initializers may depend on them.
# The funky filename? Rails loads the initializers in alphabetical order.
def development?
env_is('development')
end
def production?
env_is('production')
end
def test?
env_is('test')
end
def env_is(env)
... | 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 |
# Provide a maximally flexible Markaby builder.
# For Markaby, see http://redhanded.hobix.com/inspect/markabyForRails.html
# The plugin is broken in Rails 2.0.2. Get a working plugin as follows:
# $ cd vendor/plugins
# $ git clone http://github.com/giraffesoft/markaby/tree/master
# TODO: figure out how to make this n... | Ruby |
# ---------------------------------------------------------------------------
# collect_every(n [,fill=false[,offset=0]]) => an array
# collect_every(n [,fill=false[,offset=0]]) {|item| block} => an_array
# ---------------------------------------------------------------------------
# If a block is gi... | Ruby |
begin
unless test?
global_prefs = Preference.find(:first)
if global_prefs.email_notifications?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => global_prefs.smtp_server,
:port => 25,
:domain => global_prefs.domain
... | Ruby |
class ActiveRecord::Base
# Allow skipping of specific callbacks.
# See http://integrumbles.com/2007/12/12/skipping-activerecord-callback-methods
def self.skip_callback(callback, &block)
method = instance_method(callback)
remove_method(callback) if respond_to?(callback)
define_method(callback){ tr... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :categories
map.resources :links
map.resources :events, :member => { :attend => :get,
:unattend => :get } do |event|
event.resources :comments
end
map.resources :preferences
map.resources :searches
ma... | 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 |
# 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.2... | 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 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 |
# 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 person is logged in.
# Preloads @current_person with the person model if they're logged in.
def logged_in?
current_person != :false
end
# Accesses the current person from the session. Set it to :false if login fails
# ... | Ruby |
module ActivityLogger
# Add an activity to the feeds of a person's contacts.
# Usually, we only add to the feeds of the contacts, not the person himself.
# For example, if a person makes a forum post, the activity shows up in
# his contacts' feeds but not his.
# The :include_person option is to handle the ca... | Ruby |
module AuthenticatedTestHelper
# Sets the current person in the session from the person fixtures.
# Returns the person to allow @person = login_as(:quentin) construction.
def login_as(person)
if person.is_a?(Person)
id = person.id
elsif person.is_a?(Symbol)
person = people(person)
id = p... | Ruby |
class String
def to_safe_uri
self.strip.downcase.gsub('&', 'and').gsub(' ', '-').gsub(/[^\w-]/,'')
end
end | Ruby |
require 'active_record'
require 'active_record/fixtures'
desc "Install Insoshi"
task :install => :environment do |t|
Rake::Task["db:migrate"].invoke
Preference.create!
end
| Ruby |
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
# Don't load rspec if running "rake gems:*"
unless ARGV.any? {|a| a =~ /^gems/}
begin
require 'spec/rake/spectask'
rescue MissingSourceFile
module Spec
module Rake
class SpecTask
def initialize(name)
task name do
# if rsp... | Ruby |
namespace :db do
namespace :migrate do
desc "Migrate and prepare test database"
task :both do
Rake::Task["db:migrate"].invoke
Rake::Task["db:test:prepare"].invoke
end
end
end | Ruby |
namespace :db do
desc "Recycle the databases by dropping, recreating, and migrating"
task :recycle => :environment do
system 'rake db:drop:all'
system 'rake db:create:all'
system 'rake db:migrate'
system 'rake db:test:prepare'
end
end | Ruby |
# Provide tasks to load and delete sample user data.
require 'active_record'
require 'active_record/fixtures'
#DATA_DIRECTORY = File.join(RAILS_ROOT, "lib", "tasks", "sample_data")
namespace :db do
namespace :demo_data do
desc "Load demo data"
task :load => :environment do |t|
create_demo_people
... | Ruby |
# Provide tasks to load and delete sample user data.
require 'active_record'
require 'active_record/fixtures'
DATA_DIRECTORY = File.join(RAILS_ROOT, "lib", "tasks", "sample_data")
namespace :db do
namespace :sample_data do
desc "Load sample data"
task :load => :environment do |t|
Rake::Task["insta... | Ruby |
require 'active_record'
require 'active_record/fixtures'
namespace :feed do
desc "Remove duplicate feed items"
task :undup => :environment do |t|
feed = Feed.find(:all, :order => 'person_id, activity_id')
dups = []
feed.each_with_index do |item, i|
dups.push(item) if i > 0 and same?(item, feed[i-... | Ruby |
# = Spec, with Ultrasphinx
# Based on test_with_ultrasphinx from
# http://stephencelis.com/archive/2008/4/testing-with-ultrasphinx
#
# See [Ultrasphinx](http://blog.evanweaver.com/files/doc/fauna/ultrasphinx).
#
# This Rake task automates Ultrasphinx in a testing environment. It will start
# or set up Sphinx on your te... | Ruby |
namespace :db do
desc "Recycle the database by dropping, recreating, and migrating"
task :conversation_bootstrap => :environment do
messages = Message.find(:all, :order => :created_at)
unless messages.empty?
puts "Bootstrapping existing messages by adding conversation ids."
messages.each do |me... | Ruby |
#
# = rand.rb -- library for picking random elements and shuffling
#
# Copyright (C) 2004 Ilmari Heikkinen
#
# Documentation:: Christian Neukirchen <mailto:chneukirchen@gmail.com>
#
module Enumerable
# Choose and return a random element of the Enumerable.
# [1, 2, 3, 4].pick #=> 2 (or 1, 3, 4)
def pick
... | Ruby |
has_many :logs, :as=>:logleable
aplication controller
log all
clase=controller_name.split("_").collect{|t| t.singularize.titleize}.join.constantize
if clase.instance_methods.include?("logs") and (action_name=="update" or action_name=="create")
logger.info "=========================="
logger.inf... | Ruby |
<h3>Tutores <%= button_to_add_fields "Agregar", f, :tutores,:partial=>"new_tutor"%></h3>
<div class="box">
<table>
<tr class="tutores" style="width: 100%">
<th>Funcionario</th><th></th>
</tr>
<% f.simple_fields_for :tutores do |builder|%>
<%= render 'tutor', :f => builder %>
... | Ruby |
module ChromatronHelper
#funcion que crea etiquetas de color(red, yellow, blue, green, gray, orange)
def color_tag(texto, color)
"<span class='tag #{color}'>#{texto}</span>".html_safe
end
#contenido=[{:text=>"Title-1",:content=>items1,:url=>""},{:text=>"Titulazo-2",:content=>items2,:url=>""}]
#items=[{:... | Ruby |
def show_mapa
@usuario=Usuario.find(512)
draw_map(true)
respond_to do |format|
format.html {render :layout=>"mapa"}
end
end | Ruby |
class DowncaseColumnsNames < ActiveRecord::Migration
def self.up
ActiveRecord::Base.connection.tables.each do |table|
columns=ActiveRecord::Base.connection.columns(table).collect{|c| c.name}
columns.delete("ID")
columns.delete("id")
columns.each do |column|
rename_column table, col... | Ruby |
require 'rchardet'
require 'iconv'
class Importacion < ActiveRecord::Base
attr_accessor :importados, :agregados, :descartados, :errores
validates_presence_of :nombre
has_many :movimientos, :dependent => :destroy
has_many :marcaciones, :dependent => :destroy
belongs_to :modelo
def self.importar(modelo, arch... | Ruby |
def send_mail(objeto,nombre_parametro,destinatarios=nil)
destinatarios||=Parametro.destinatarios(nombre_parametro)
unless destinatarios.nil?
(objeto.class_name+"Mailer").constantize.send("deliver_#{objeto.class_name.underscore}_email",objeto,destinatarios)
else
flash[:error] = 'No se enc... | 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 |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'data_mapper', '~> 1.2'
gem 'dm-postgres-adapter'
gem 'google-api-client', '>= 0.4.3'
group :development do
gem 'dm-sqlite-adapter', '~> 1.2'
gem 'do_sqlite3', '~> 0.10'
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 |
environment = :production
project_type = :stand_alone
http_path = "/"
css_dir = "../styles"
sass_dir = "."
images_dir = "images"
sass_options = {
:line_numbers => false,
:debug_info => false
}
# output_style = :compressed
# output_style = :compact
output_style = :expanded
| Ruby |
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 2010,
:DocumentRoot => Dir::pwd
)
s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts')
s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles')
trap('INT') { s.stop }
s.start
| Ruby |
Umbraco = Object.const_get("umbraco")
Library = Umbraco.const_get("library")
NodeFactory = Umbraco.const_get("presentation").const_get("nodeFactory")
# Set the node id you would like to fetch pages from here
# You can also set it as a macro property with the alias 'nodeId' instead
parent = NodeFactory::Node.n... | Ruby |
result = "<ul>";
currentPage.Children.each do |this_item|
result += "<li><a href='" + this_item.NiceUrl + "'>" + this_item.Name + "</a></li>"
end
result += "</ul>"
puts result | Ruby |
| Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'data_mapper', '~> 1.2'
gem 'dm-postgres-adapter'
gem 'google-api-client', '>= 0.4.3'
group :development do
gem 'dm-sqlite-adapter', '~> 1.2'
gem 'do_sqlite3', '~> 0.10'
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 |
# 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... | Ruby |
# This migration comes from spree (originally 20121111231553)
class RemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration
def up
remove_column :spree_payment_methods, :display_on
end
end
| Ruby |
# This migration comes from spree (originally 20121109173623)
class AddCostCurrencyToVariants < ActiveRecord::Migration
def change
add_column :spree_variants, :cost_currency, :string, :after => :cost_price
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.