code
stringlengths
1
1.73M
language
stringclasses
1 value
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
require 'custom_xml_serialization'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the custom_xml_serialization plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the custo...
Ruby
# No rake tasks yet.
Ruby
# No uninstall code yet.
Ruby
# No install code yet.
Ruby
require 'active_record' require 'active_support/inflector' # Adds the ability for an +ActiveRecord+ instance to specify exactly what fields # get included when it's XML-serialized. module CustomXMLSerialization # Attaches this module's functionality to a class when it's included. def self.included(mod) ...
Ruby
require 'custom_xml_serialization'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the custom_xml_serialization plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the custo...
Ruby
# No rake tasks yet.
Ruby
# No uninstall code yet.
Ruby
# No install code yet.
Ruby
require 'active_record' require 'active_support/inflector' # Adds the ability for an +ActiveRecord+ instance to specify exactly what fields # get included when it's XML-serialized. module CustomXMLSerialization # Attaches this module's functionality to a class when it's included. def self.included(mod) ...
Ruby
require 'custom_xml_serialization'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the custom_xml_serialization plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the custo...
Ruby
# No rake tasks yet.
Ruby
# No uninstall code yet.
Ruby
# No install code yet.
Ruby
require 'active_record' require 'active_support/inflector' # Adds the ability for an +ActiveRecord+ instance to specify exactly what fields # get included when it's XML-serialized. module CustomXMLSerialization # Attaches this module's functionality to a class when it's included. def self.included(mod) ...
Ruby
require 'custom_xml_serialization'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the custom_xml_serialization plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the custo...
Ruby
# No rake tasks yet.
Ruby
# No uninstall code yet.
Ruby
# No install code yet.
Ruby
require 'active_record' require 'active_support/inflector' # Adds the ability for an +ActiveRecord+ instance to specify exactly what fields # get included when it's XML-serialized. module CustomXMLSerialization # Attaches this module's functionality to a class when it's included. def self.included(mod) ...
Ruby
# Tigase Jabber/XMPP Server # Copyright (C) 2004-2012 "Artur Hefczyc" <artur.hefczyc@tigase.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, version 3 of the License. # # This pro...
Ruby
#!/usr/bin/env ruby # Tool for creating a new unit test case. require 'erb' def main if ARGV.size != 1 usage() exit 1 end class_name = ARGV[0] if class_name !~ /^[a-z0-9]+$/i print "'#{class_name}' doesn't look like a valid class name.\n" exit 1 end header = find_header(class_name) if header.nil? p...
Ruby
#!/usr/bin/env ruby # Tool for creating a new unit test case. require 'erb' def main if ARGV.size != 1 usage() exit 1 end class_name = ARGV[0] if class_name !~ /^[a-z0-9]+$/i print "'#{class_name}' doesn't look like a valid class name.\n" exit 1 end header = find_header(class_name) if header.nil? p...
Ruby
#!/usr/bin/env ruby # Tool for creating a new unit test case. require 'erb' def main if ARGV.size != 1 usage() exit 1 end class_name = ARGV[0] if class_name !~ /^[a-z0-9]+$/i print "'#{class_name}' doesn't look like a valid class name.\n" exit 1 end header = find_header(class_name) if header.nil? p...
Ruby
#!/usr/bin/env ruby # Tool for creating a new unit test case. require 'erb' def main if ARGV.size != 1 usage() exit 1 end class_name = ARGV[0] if class_name !~ /^[a-z0-9]+$/i print "'#{class_name}' doesn't look like a valid class name.\n" exit 1 end header = find_header(class_name) if header.nil? p...
Ruby
#cvsauthz.spec require 'rubygems' SPEC=Gem::Specification.new do |s| s.name="cvsauthz" s.version='0.01' s.author='Ronald Mai' s.homepage="http://www.rubyeye.net" s.platform=Gem::Platform::RUBY s.summary="CVS authz file format converter" condidates =Dir.glob("{bin,lib,test}/**/*") s.f...
Ruby
class String def words split(' ') end end def transfer(s) r = "" _trans(s) do |x| r += x end r end def dump(s) puts 'cvs chacl -R default:n' _trans(s) do |x| unless x.strip.empty? puts x end end end def _trans(s) empty_matcher = Proc.new { |x| '' } grou...
Ruby
require 'test/unit' require 'src/authz' class TC_Trans < Test::Unit::TestCase def test_empty_source_should_transfer_to_empty assert_equal('', transfer('')) end def test_comment_transfer_to_empty assert_equal('', transfer('#foo')) end def test_empty_dir_should_transfer_to_empty assert_equal('', ...
Ruby
#!/usr/bin/ruby # bdb2msql.rb - Migrate the jabberd2 data in sm.db and authreg.db to MySQL # # Warning! This tool has not widely been tested! Use at your own risk # # Copyright (C) 2007 by Daniel Willmann <daniel@totalueberwachung.de> # # This program is free software; you can redistribute it and/or modify # it under ...
Ruby
#!/usr/bin/ruby # bdb2msql.rb - Migrate the jabberd2 data in sm.db and authreg.db to MySQL # # Warning! This tool has not widely been tested! Use at your own risk # # Copyright (C) 2007 by Daniel Willmann <daniel@totalueberwachung.de> # # This program is free software; you can redistribute it and/or modify # it under ...
Ruby
#!/usr/bin/ruby # bdb2msql.rb - Migrate the jabberd2 data in sm.db and authreg.db to MySQL # # Warning! This tool has not widely been tested! Use at your own risk # # Copyright (C) 2007 by Daniel Willmann <daniel@totalueberwachung.de> # # This program is free software; you can redistribute it and/or modify # it under ...
Ruby
#!/usr/bin/ruby # bdb2msql.rb - Migrate the jabberd2 data in sm.db and authreg.db to MySQL # # Warning! This tool has not widely been tested! Use at your own risk # # Copyright (C) 2007 by Daniel Willmann <daniel@totalueberwachung.de> # # This program is free software; you can redistribute it and/or modify # it under ...
Ruby
# coding: utf-8 # Title: LightPack API wrapper for Ruby # Author: Mikhail S. Pobolovets # License: GPL v3 # Date: 2011/08/15 # API Version: 5.5 require 'socket' class LightPack include Socket::Constants # host = '127.0.0.1' # The remote host # port = 3636 ...
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
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
class CreateOutlines < ActiveRecord::Migration def self.up create_table :outlines do |t| t.integer :user_id t.integer :todo_id t.integer :first_child t.integer :next_sibling t.timestamps end end def self.down drop_table :outlines end end
Ruby
class CreateTodos < ActiveRecord::Migration def self.up create_table :todos do |t| t.integer :user_id t.string :name t.date :start_d t.time :start_t t.date :due_d t.time :due_t t.string :effort t.string :prio t.integer :time_required t.string :context ...
Ruby
class CreateContexts < ActiveRecord::Migration def self.up create_table :contexts do |t| t.string :name t.integer :user_id t.timestamps end end def self.down drop_table :contexts end end
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
#!/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
#!/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
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module TodosHelper end
Ruby
module ContextsHelper end
Ruby
module OutlinesHelper end
Ruby
class Outline < ActiveRecord::Base end
Ruby
class Todo < ActiveRecord::Base end
Ruby
class Context < ActiveRecord::Base end
Ruby
class OutlinesController < ApplicationController # GET /outlines # GET /outlines.xml def index @outlines = Outline.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @outlines } end end # GET /outlines/1 # GET /outlines/1.xml def show ...
Ruby
class ContextsController < ApplicationController # GET /contexts # GET /contexts.xml def index @contexts = Context.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @contexts } end end # GET /contexts/1 # GET /contexts/1.xml def show ...
Ruby
class TodosController < ApplicationController # GET /todos # GET /todos.xml def index @todos = Todo.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @todos } end end # GET /todos/1 # GET /todos/1.xml def show @todo = Todo.find(params[...
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 # Be sure to include AuthenticationSystem in Application Cont...
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
# 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. # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full class name (including module namespa...
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
ActionController::Routing::Routes.draw do |map| map.resources :users map.resource :session map.resources :todos map.resources :contexts map.resources :outlines map.signup '/singup',:controller=>'users',:action=>'new' map.login '/login', :controller=>'sessions', :action=>'new' map.logout '/logout'...
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.1...
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