code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
class CreateBudgets < ActiveRecord::Migration def self.up create_table :budgets do |t| t.string :budget_type t.string :budget_name t.float :budget_amount t.integer :budget_month t.timestamps end end def self.down drop_table :budgets end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :fname t.string :lname t.string :email t.string :address t.string :login t.string :password t.timestamps end add_column :budgets, :user_id, :integer end def self.d...
Ruby
class AddTimeToBudgets < ActiveRecord::Migration def self.up add_column :budgets, :entry_date, :date end def self.down remove_column :budgets, :entry_date end end
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
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::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 da...
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
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.8' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirect...
Ruby
xml.instruct! # <?xml version="1.0" encoding="UTF-8"?> xml.comment! "a comment" # <!-- a comment --> xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.title "My Atom Feed" # xml.subtitle h(@feed.subtitle), "type" => 'html' xml.link url_for( :only_path => false, :controller =...
Ruby
# -*- encoding : utf-8 -*- # Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module DevHelper end
Ruby
module AccountHelper end
Ruby
module MemberHelper end
Ruby
module AdminHelper end
Ruby
module HotelHelper end
Ruby
# -*- encoding : utf-8 -*- module GmindappHelper end
Ruby
# encoding: utf-8 class Payment include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :member field :amount, :type => Float field :paid_on, :type => Date # gmindapp end end
Ruby
# encoding: utf-8 class Room include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :hotel field :code, :type => String field :description, :type => String # gmindapp end end
Ruby
# encoding: utf-8 class Book include Mongoid::Document # gmindapp begin include Mongoid::Timestamps field :belongs_to, :type => Hotel field :belongs_to, :type => Room field :rate, :type => Float field :checkin_on, :type => Date field :checkout_on, :type => Date field :name, :type => String field :cc...
Ruby
class Identity include Mongoid::Document include OmniAuth::Identity::Models::Mongoid self.auth_key 'name' field :name, :type => String field :email, :type => String field :password_digest, :type => String validates_presence_of :name validates_uniqueness_of :email validates_format_of :email, :with ...
Ruby
# encoding: utf-8 class Person include Mongoid::Document # gmindapp begin include Mongoid::Timestamps field :title, :type => String field :fname, :type => String field :lname, :type => String field :sex, :type => Integer field :nid, :type => String belongs_to :address field :dob, :type => Date fie...
Ruby
# encoding: utf-8 class Pictures include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :hotel field :url, :type => String # gmindapp end end
Ruby
# encoding: utf-8 class Member include Mongoid::Document # gmindapp begin include Mongoid::Timestamps field :login, :type => String field :fname, :type => String field :lname, :type => String field :nid, :type => String field :refer, :type => String field :dob, :type => Date field :sex, :type => Str...
Ruby
class User include Mongoid::Document field :provider, :type => String field :uid, :type => String field :name, :type => String field :email, :type => String field :role, :type => String def self.from_omniauth(auth) where(:provider=> auth["provider"], :uid=> auth["uid"]).first || create_with_omniaut...
Ruby
# encoding: utf-8 class Hotel include Mongoid::Document # gmindapp begin include Mongoid::Timestamps field :code, :type => String field :name, :type => String field :description, :type => String field :notice, :type => String has_one :address, as: :addressable field :phone, :type => String field :em...
Ruby
# encoding: utf-8 class Address include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :addressable, polymorphic: true field :hid, :type => String field :house, :type => String field :trok, :type => String field :soi, :type => String field :road, :type => String field :moo...
Ruby
# encoding: utf-8 class Avail include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :hotel belongs_to :room field :avail_on, :type => Date field :num, :type => Integer field :rate, :type => Float # gmindapp end end
Ruby
# -*- encoding : utf-8 -*- class Gmindapp::Xmain include Mongoid::Document # gmindapp begin include Mongoid::Timestamps belongs_to :service, :class_name => "Gmindapp::Service" field :start, :type => DateTime field :stop, :type => DateTime field :name, :type => String field :ip, :type => String field :...
Ruby
class Gmindapp::Notice include Mongoid::Document include Mongoid::Timestamps field :message, :type => String field :unread, :type => Boolean belongs_to :user # scope :new, :where=>{:unread=>true} scope :recent, where(unread: true) end
Ruby
class Gmindapp::Service include Mongoid::Document field :uid, :type => String field :module_code, :type => String field :code, :type => String field :name, :type => String field :xml, :type => String field :role, :type => String field :rule, :type => String field :seq, :type => Integer field :list, ...
Ruby
class Gmindapp::Role include Mongoid::Document include Mongoid::Timestamps field :code, :type => String field :name, :type => String belongs_to :user end
Ruby
# -*- encoding : utf-8 -*- class Gmindapp::Runseq include Mongoid::Document include Mongoid::Timestamps belongs_to :user belongs_to :xmain, :class_name => "Gmindapp::Xmain" field :action, :type => String field :status, :type => String field :code, :type => String field :name, :type => String field :r...
Ruby
class Gmindapp::Module include Mongoid::Document field :uid, :type => String field :code, :type => String field :name, :type => String field :role, :type => String field :seq, :type => Integer has_many :services, :class_name => "Gmindapp::Service" end
Ruby
class MemberController < ApplicationController def index render :text => "hello", :layout=>"_page" end end
Ruby
# -*- encoding : utf-8 -*- class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class AccountController < ApplicationController end
Ruby
class DevController < ApplicationController end
Ruby
class IdentitiesController < ApplicationController def new @identity = env['omniauth.identity'] end end
Ruby
class AdminController < ApplicationController end
Ruby
# -*- encoding : utf-8 -*- class GmindappController < ApplicationController def pending # @xmains= [] # @xmains= Gmindapp::Xmain.all :conditions=>"status='R' or status='I' ", :order=>"created_at", :include=>:runseqs @xmains= Gmindapp::Xmain.where(status:'R').union.where(status:'I').asc(:created_at) end ...
Ruby
class HotelController < ApplicationController end
Ruby
# encoding: utf-8 class SessionsController < ApplicationController def new @title= 'เข้าใช้ระบบ' end # to refresh the page, must know BEFOREHAND that the action needs refresh # then use attribute 'data-ajax'=>'false' # see app/views/sessions/new.html.erb for sample def create user = User.from_omnia...
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): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
# Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters ...
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
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
Rails.application.config.middleware.use OmniAuth::Builder do provider :identity, :on_failed_registration=> lambda { |env| IdentitiesController.action(:new).call(env) } end
Ruby
DEFAULT_TITLE = 'GMINDAPP' DEFAULT_HEADER = 'GMINDAPP' GMAP = false
Ruby
# Be sure to restart your server when you modify this file. Budhot::Application.config.session_store :cookie_store, key: '_budhot_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails gen...
Ruby
require 'smtp_tls' ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :authentication => :plain, :domain => "gmail.com", :user_name => "sample@gmail.com", # change :password => "sample" # change }
Ruby
Budhot::Application.routes.draw do match '/logout' => 'sessions#destroy', :as => 'logout' match '/auth/failure' => 'sessions#failure' match '/auth/:provider/callback' => 'sessions#create' resources :sessions resources :identities match 'gmindapp/init/:module/:service' => 'gmindapp#init' root :to => ...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Budhot::Application.initialize!
Ruby
Budhot::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_...
Ruby
Budhot::Application.configure do # Settings specified here will take precedence over those in config/application.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 web ser...
Ruby
Budhot::Application.configure do # Settings specified here will take precedence over those in config/application.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 sui...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Budhot::Application
Ruby
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) Budhot::Application.load_tasks
Ruby
require "openssl" require "net/smtp" Net::SMTP.class_eval do private def do_start(helodomain, user, secret, authtype) raise IOError, 'SMTP session already started' if @started begin # on my jolicloud check_auth_args user, secret if user or secret rescue # on heroku check_auth_ar...
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
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
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
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
# 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
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::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 da...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby