code
stringlengths
1
1.73M
language
stringclasses
1 value
# # = Bcomposer Liquid Edit Block # # Takes the provided name and provides an editable area around it. This is # required as often the body of an entry is inside structural elements # such as <td> or <li> which can not show data outside the area. # # Of course, if you do not want to support "live-edit" then bcomposer...
Ruby
module BcomposerLiquid # = Bcomposer Liquid Loader class # # Used for loading and creating the necessary environment for # the correct execution of Liquid templates. # # When instantiated, the bulletin object must be provided in the options. # class Loader attr_reader :assigns, :filters, :r...
Ruby
class BcomposerLiquid::Drops::Section < Liquid::Drop def initialize( section ) @section = section end def before_method( method ) if @section.attribute_names.include? method @section.send( method ) else '' end end end
Ruby
class BcomposerLiquid::Drops::Bulletin < Liquid::Drop def initialize( bulletin ) @bulletin = bulletin end def before_method( method ) if @bulletin.safe_method? method @bulletin.send( method ) else '' end end end
Ruby
# # Liquid Drop to handle a parameters object. # # Parameter classes should already be safe, so their # methods can be called directly without security problems. # In effect, these drops are just wrappers to support # liquid templates. # class BcomposerLiquid::Drops::Params < Liquid::Drop def initialize( params...
Ruby
class BcomposerLiquid::Drops::Project < Liquid::Drop def initialize( project ) @project = project end def before_method( method ) if @project.safe_method? method @project.send( method ) else '' end end end
Ruby
class BcomposerLiquid::Drops::ContentPage < Liquid::Drop def initialize( page ) @page = page end def before_method( method ) if @page.attribute_names.include? method @page.send( method ) else 'INAVLID: '+method end end end
Ruby
# # Liquid Subscription Drop # # Doesn't really do very much but is here none the less. # class BcomposerLiquid::Drops::Subscription < Liquid::Drop def initialize( subscription ) @subscription = subscription end def before_method( method ) if @subscription.safe_method? method @subscription.s...
Ruby
class BcomposerLiquid::Drops::Entry < Liquid::Drop def initialize( entry ) @entry = entry end def before_method( method ) if @entry.attribute_names.include? method @entry.send( method ) else '' end end end
Ruby
class BcomposerLiquid::Drops::Recipient < Liquid::Drop def initialize( recip ) @recip = recip end def before_method( method ) if @recip.nil? 'recipient.'+method elsif @recip.safe_method? method @recip.send( method ) else '' end end end
Ruby
module BcomposerLiquid::LinkHelper def url_for_media( file ) link_helper.url_for_media(find_project, file) end # Add the base url including domain for the requested file. # Also checks to ensure the provided file is not already # a complete url, in which case, nothing will be attached. def url_for(fi...
Ruby
# # Methods to help the production of statistics. # # This module is designed to be included in the bulletin / recipient_receipt # relationship. # module BulletinRecipientStatistics def first_sent find(:first, :order => 'received ASC', :conditions => ['received IS NOT NULL']) end def last_sent find(:...
Ruby
#!/usr/bin/ruby1.8 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...
Ruby
#!/usr/bin/ruby1.8 # # 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
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
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
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
require 'mkmf' $CPPFLAGS = $CPPFLAGS + " -I../../include" $LDFLAGS = $LDFLAGS + " -L../../" $LIBS = $LIBS + " -lhpdf -lpng -lz" create_makefile 'hpdf'
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- demo.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appea...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- encryption.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- font_example.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright noti...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- arc_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear ...
Ruby
# # << Haru Free PDF Library 2.0.6 >> -- ext_gstate_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice ...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- ttfont_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appe...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- text_demo2.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- line_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear...
Ruby
# # << Haru Free PDF Library 2.0.6 >> -- slideshow_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice a...
Ruby
class FixStringToText < ActiveRecord::Migration def self.up change_column( :repair_records, :note, :text ) change_column( :triage_notes, :note, :text ) end def self.down end end
Ruby
class AddShortNameToRepairStates < ActiveRecord::Migration def self.up add_column :repair_states, :short_name, :string end def self.down remove_column :repair_states, :short_name 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 AddAssignedToForTriageNotes < ActiveRecord::Migration def self.up add_column :triage_notes, :assigned_to_id, :integer end def self.down remove_column :triage_notes, :assigned_to_id end end
Ruby
class AddAssignedTo < ActiveRecord::Migration def self.up add_column :repair_records, :assigned_to_id, :integer end def self.down remove_column :repair_records, :assigned_to_id end end
Ruby
class FixPhoneNumbers < ActiveRecord::Migration def self.up remove_column :customer_records, :mobile remove_column :customer_records, :work remove_column :customer_records, :zip add_column :customer_records, :mobile, :string add_column :customer_records, :work, :string add_column :customer_rec...
Ruby
class ChangeDateTimeToString < ActiveRecord::Migration def self.up remove_column :repair_records, :time_estimate add_column :repair_records, :time_estimate, :string end def self.down remove_column :repair_records, :time_estimate add_column :repair_records, :time_estimate, :datetime end end
Ruby
class AddSeriesModelAndPartNumber < ActiveRecord::Migration def self.up add_column :cmodels, :series, :string add_column :cmodels, :cmodel, :string add_column :cmodels, :part_number, :string end def self.down remove_column :cmodels, :series remove_column :cmodels, :cmodel remove_column :c...
Ruby
class InitialDatabase < ActiveRecord::Migration def self.up create_table "customer_records" do |t| t.timestamps t.column :user_id, :integer t.column :fname, :string t.column :mname, :string t.column :lname, :string t.column :street, :string t.column :state, :string ...
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
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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 Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/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/dispat...
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
#!/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/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
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/dbconsole'
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 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/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/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/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
module IssuesContainersHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module SessionHelper end
Ruby
module TriageNotesHelper end
Ruby
module CmodelsHelper end
Ruby
module SessionsHelper end
Ruby
module ManufacturersHelper end
Ruby
module UsersHelper end
Ruby
module PartRecordsHelper end
Ruby
module RepairRecordsHelper end
Ruby
module PartStatesHelper end
Ruby
module RepairStatesHelper end
Ruby
module TemplatePartsHelper end
Ruby
module IssuesHelper end
Ruby
module CustomerRecordsHelper end
Ruby
module CustomerStatesHelper end
Ruby
class RepairState < ActiveRecord::Base end
Ruby
class PartRecord < ActiveRecord::Base end
Ruby
class Issue < ActiveRecord::Base end
Ruby
class PartState < ActiveRecord::Base end
Ruby
class CustomerState < ActiveRecord::Base end
Ruby
class RepairRecord < ActiveRecord::Base belongs_to :customer_record belongs_to :user has_many :triage_notes belongs_to :cmodel belongs_to :repair_state belongs_to :assigned_to, :class_name => "User" end
Ruby
class Cmodel < ActiveRecord::Base belongs_to :manufacturer end
Ruby
class IssuesContainer < ActiveRecord::Base end
Ruby