code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
require 'collada/exporter.rb'
| Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class Material
attr_reader :id
def initialize(id, color)
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class IdManager
def initialize(initial_entries = [])
@id_hash = {}
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
require 'rubystdlib.rb'
require 'rexml/Document'
module Collada
class Mesh
attr_accessor :id
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
def Collada.ccw(a, b, c)
a[0] * (b[1] - c[1]) - b[0] * (a[1] - c[1]) + c[0] *... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class Contours
attr_accessor :vertex_indices, :normal_indices, :count
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class AnimationPath
def AnimationPath.set_path(object)
object.se... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
def Collada.p_to_s(p)
p = p.collect { |n| if n.abs < 1e-10 then 0.0 else n end }
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class Lines
attr_accessor :vertex_indices, :count
def init... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class LineStrips
attr_accessor :vertex_indices
def initial... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.i
module Collada
class Triangles
attr_accessor :vertex_indices, :normal_indices, :count
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class Component
attr_accessor :node
def initialize(node)
... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
require 'rexml/formatters/default'
module REXML
module Formatters
# Pretty-prints an XML document. T... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
require 'sketchup.rb'
require 'rubystdlib.rb'
require 'rexml/Document'
load 'collada/id_manager.rb'
load 'co... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
module Collada
class Node
attr_accessor :name, :id, :geometries, :components, :nodes, :anima... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
if not file_loaded?("rubystdlib.rb")
processor, platform, *rest = RUBY_PLATFORM.split("-")
cas... | Ruby |
# Author: Michael Burns (mburns@cs.princeton.edu)
# Copyright (c) 2009 Michael Burns
#
# This program is distributed under the terms of the
# GNU General Public License. See the COPYING file
# for details.
require 'sketchup.rb'
module SelectionFilter
def SelectionFilter.filter(type)
new_selection = Sketch... | Ruby |
#
# jQuery File Tree Ruby Connector
#
# Version 1.01
#
# Erik Lax
# http://datahack.se
# 13 July 2008
#
# History
#
# 1.01 Initial Release
#
# Output a list of files for jQuery File Tree
#
#<settings>
#root = "/absolute/path/"
# or
root = File.expand_path(".")
#</settings>
#<code>
require "cgi"... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "../css"
sass_dir = "."
images_dir = "../images"
javascripts_dir = "..js"
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expande... | Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | 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.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| 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.
CLBSArtDej::Application.config.session_store :cookie_store, :key => '_CLBS-Art-Dej_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 wi... | 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 |
CLBSArtDej::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned... | Ruby |
CLBSArtDej::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 we... | Ruby |
CLBSArtDej::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 te... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CLBSArtDej::Application.initialize!
| 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 you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module CLBSArtDej
class Application < Rails::Application
... | Ruby |
CLBSArtDej::Application.routes.draw do
get "admin/login"
get "admin/logout"
get "admin/index"
resources :comp_evaluations
resources :users
resources :evaluation_result_camts
resources :student_evaluation_seconds
resources :company_evaluations
resources :camts
resources :company_ths
resou... | Ruby |
module AdminHelper
end
| Ruby |
module ApplicationHelper
end
| Ruby |
module CompEvaluationsHelper
end
| Ruby |
module StudentEvaluationFirstsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module JobRequirementsHelper
end
| Ruby |
module CamtsHelper
end
| Ruby |
module ProductsHelper
end
| Ruby |
module CompaniesHelper
end
| Ruby |
module StudentEvaluationSecondsHelper
end
| Ruby |
module CompanyTHsHelper
end
| Ruby |
module StudentStatusHelper
end
| Ruby |
module StudentsHelper
end
| Ruby |
module StudentTHsHelper
end
| Ruby |
module StoreHelper
end
| Ruby |
module EvaluationResultCamtsHelper
end
| Ruby |
class StudentEvaluationSecond < ActiveRecord::Base
validates_presence_of :evaluator_name, :evaluator_position, :evaluator_department, :quantity_of_work, :quality_of_work,
:academic_ability, :ability_to_learn, :practical_ability, :judgment, :management, :communication,
:foreign_language, :suitability, :responsibi... | Ruby |
class Student < ActiveRecord::Base
validates_presence_of :firstname, :lastname, :firstname_th, :lastname_th, :status, :advisor, :nationality,:email, :emergency_contact_name,
:computer_language, :dob, :emergency_contact_relationship,:emergency_email, :emergency_phone, :father_name,
:gpa, :id_card_no, :language_eng... | Ruby |
class StudentEvaluationFirst < ActiveRecord::Base
validates_presence_of :evaluator_name, :evaluator_position, :evaluator_department, :quantity_of_work, :quality_of_work,
:academic_ability, :ability_to_learn, :practical_ability, :judgment, :management, :communication,
:foreign_language, :suitability, :responsibil... | Ruby |
class Country < ActiveRecord::Base
COUNTRY = [[ "Thailand", "Thailand"],
["Afghanistan", "Afghanistan"],
["Albania", "Albania"],
["Algeria", "Algeria"],
["Andorra","Andorra"],
["Angola", "Angola"],
["Antigua & Deps", "Antigua & Deps"],
["Argentina", "Argentina"],
["Arm... | Ruby |
class CompanyTh < ActiveRecord::Base
end
| Ruby |
#---
# Excerpted from "Agile Web Development with Rails, 3rd Ed.",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any pur... | Ruby |
class EvaluationResultCamt < ActiveRecord::Base
end
| Ruby |
class CompEvaluation < ActiveRecord::Base
end
| Ruby |
class Camt < ActiveRecord::Base
end
| Ruby |
class Product < ActiveRecord::Base
validates_presence_of :title, :description, :image_url
validates_numericality_of :price
validate :price_must_be_at_least_a_cent
validates_uniqueness_of :title
validates_format_of :image_url,
:with => %r{\.(gif|jpg|png|jpeg)$}i,
:me... | Ruby |
# coding: utf-8
class Student_status < ActiveRecord::Base
STUDENT_STATUS = [
["Available", "Available"],
["Accepted", "Accepted"]
]
TITLE = [
["Mr.", "Mr."],
["Ms.", "Ms."],
["Mrs.", "Mrs."]]
TITLE_TH = [
["นาย", "นาย"],
["นางสาว", "นางสาว"],
["นาง", "นาง"]]
SEX = [
... | Ruby |
class Company < ActiveRecord::Base
end
| Ruby |
class StudentTh < ActiveRecord::Base
end
| Ruby |
class JobRequirement < ActiveRecord::Base
end
| Ruby |
class ProductsController < ApplicationController
# GET /products
# GET /products.xml
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @products }
end
end
# GET /products/1
# GET /products/1.xml
def show
@produc... | Ruby |
class CompaniesController < ApplicationController
# GET /companies
# GET /companies.xml
def index
@companies = Company.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @companies }
end
end
# GET /companies/1
# GET /companies/1.xml
def show
... | Ruby |
class StudentEvaluationSecondsController < ApplicationController
# GET /student_evaluation_seconds
# GET /student_evaluation_seconds.xml
def index
@student_evaluation_seconds = StudentEvaluationSecond.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @studen... | Ruby |
class CompanyThsController < ApplicationController
# GET /company_ths
# GET /company_ths.xml
def index
@company_ths = CompanyTh.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @company_ths }
end
end
# GET /company_ths/1
# GET /company_ths/1.xml
... | Ruby |
class EvaluationResultCamtsController < ApplicationController
# GET /evaluation_result_camts
# GET /evaluation_result_camts.xml
def index
@evaluation_result_camts = EvaluationResultCamt.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @evaluation_result_cam... | Ruby |
class CompEvaluationsController < ApplicationController
# GET /comp_evaluations
# GET /comp_evaluations.xml
def index
@comp_evaluation = CompEvaluation.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @comp_evaluation }
end
end
# GET /comp_evaluati... | Ruby |
class AdminController < ApplicationController
# just display the form and wait for user to
# enter a name and password
def login
if request.post?
user = User.authenticate(params[:name], params[:password])
if user
session[:user_id] = user.id
uri = session[:original_uri]
se... | Ruby |
class CamtsController < ApplicationController
# GET /camt
# GET /camt.xml
def index
@camts = Camt.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @camts }
end
end
# GET /camt/1
# GET /camt/1.xml
def show
@camt = Camt.find(params[:id])
... | Ruby |
class StudentThsController < ApplicationController
# GET /student_ths
# GET /student_ths.xml
def index
@student_ths = StudentTh.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @student_ths }
end
end
# GET /student_ths/1
# GET /student_ths/1.xml
... | Ruby |
class ApplicationController < ActionController::Base
before_filter :authorize, :except => :login
helper :all
protect_from_forgery
protected
def authorize
unless User.find_by_id(session[:user_id])
session[:original_uri] = request.request_uri
flash[:notice] = "Please log in"
redirect_to... | Ruby |
class StudentsController < ApplicationController
# GET /students
# GET /students.xml
def index
@students = Student.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @students }
end
end
# GET /students/1
# GET /students/1.xml
def show
@studen... | Ruby |
class StudentEvaluationFirstsController < ApplicationController
# GET /student_evaluation_firsts
# GET /student_evaluation_firsts.xml
def index
@student_evaluation_firsts = StudentEvaluationFirst.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @student_eva... | Ruby |
class StoreController < ApplicationController
def index
@products = Product.find_product_for_sale
end
end
| Ruby |
class JobRequirementsController < ApplicationController
# GET /job_requirements
# GET /job_requirements.xml
def index
@job_requirements = JobRequirement.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @job_requirements }
end
end
# GET /job_require... | Ruby |
class UsersController < ApplicationController
# GET /users
# GET /users.xml
def index
@users = User.order(:name)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
# GET /users/1
# GET /users/1.xml
def show
@user = User.find(para... | 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.expand_path('../config/application', __FILE__)
require 'rake'
CLBSArtDej::Application.load_tasks
| 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 |
#!/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 |
source 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.... | Ruby |
class CreateCompanyThs < ActiveRecord::Migration
def self.up
create_table :company_ths do |t|
t.string :name
t.string :address
t.timestamps
end
end
def self.down
drop_table :company_ths
end
end
| Ruby |
class CreateStudentEvaluationFirsts < ActiveRecord::Migration
def self.up
create_table :student_evaluation_firsts do |t|
t.string :student_id
t.string :employer_name
t.string :evaluator_name
t.string :evaluator_position
t.string :evaluator_department
t.timestamps
end
end... | Ruby |
class CreateJobRequirements < ActiveRecord::Migration
def self.up
create_table :job_requirements do |t|
t.string :position
t.integer :amount
t.text :job_specification
t.integer :salary
t.string :ext_welfare
t.timestamps
end
end
def self.down
drop_table :job_requi... | Ruby |
class CreateCountries < ActiveRecord::Migration
def self.up
create_table :countries do |t|
t.column :iso, :string, :size => 2
t.column :name, :string, :size => 80
t.column :printable_name, :string, :size => 80
t.column :iso3, :string, :size => 3
t.column :numcode, :integer
t.t... | Ruby |
class CreateEvaluationResultCamts < ActiveRecord::Migration
def self.up
create_table :evaluation_result_camts do |t|
t.timestamps
end
end
def self.down
drop_table :evaluation_result_camts
end
end
| Ruby |
class StudentStatus < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.string :hashed_password
t.string :salt
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateStudents < ActiveRecord::Migration
def self.up
create_table :students do |t|
t.string :firstname
t.string :lastname
t.boolean :status
t.timestamps
end
end
def self.down
drop_table :students
end
end
| Ruby |
class Product < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sessions
end
end
| Ruby |
class CreateStudentEvaluationSeconds < ActiveRecord::Migration
def self.up
create_table :student_evaluation_seconds do |t|
t.timestamps
end
end
def self.down
drop_table :student_evaluation_seconds
end
end
| Ruby |
class AddTestData < ActiveRecord::Migration
def self.up
Product.delete_all
Product.create(:title => 'Pragmatic Version Control',
:description => %{This book is a recipe-based approach to using Subversion that will get you up.},
:image_url => '/images/svn.jpg',
:price => 28.50)
end
def s... | Ruby |
class CreateCompanies < ActiveRecord::Migration
def self.up
create_table :companies do |t|
t.string :name
t.text :address
t.string :sub_district
t.string :district
t.string :province
t.string :zip_code
t.string :tel
t.string :fax
t.string :email
t.string... | Ruby |
class CreateStudentThs < ActiveRecord::Migration
def self.up
create_table :student_ths do |t|
t.string :firstname
t.string :lastname
t.timestamps
end
end
def self.down
drop_table :student_ths
end
end
| Ruby |
class CreateCompEvaluations < ActiveRecord::Migration
def self.up
create_table :comp_evaluations do |t|
t.string :student_id
t.string :student_name
t.string :employer_name
t.string :student_position
t.string :student_department
t.timestamps
end
end
def self.down
dr... | Ruby |
class Student < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.string :title
t.text :description
t.string :image_url
t.timestamps
end
end
def self.down
drop_table :products
end
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.