code
stringlengths
1
1.73M
language
stringclasses
1 value
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
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 # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_critters_s...
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
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
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/runner'
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/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/profiler'
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/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/breakpointer'
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/console'
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/process/inspector'
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/reaper'
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/destroy'
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/server'
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/plugin'
Ruby
#!c:/ruby1.8/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 impai...
Ruby
#!c:/ruby1.8/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 impai...
Ruby
#!c:/ruby1.8/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.lo...
Ruby
#!c:/ruby1.8/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 impai...
Ruby
#!c:/ruby1.8/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 impai...
Ruby
#!c:/ruby1.8/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.lo...
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
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # output_styl...
Ruby
desc "Use Uglify JS to compress Underscore.js" task :build do sh "uglifyjs underscore.js -c \"evaluate=false\" -m -o underscore-min.js" end desc "Build the docco documentation" task :doc do sh "docco underscore.js" end
Ruby
require 'rubygems' HEADER = /((^\s*\/\/.*\n)+)/ desc "rebuild the backbone-min.js files for distribution" task :build do begin require 'closure-compiler' rescue LoadError puts "closure-compiler not found.\nInstall it by running 'gem install closure-compiler'" exit end source = File.read 'backbone....
Ruby
#!/usr/bin/env ruby # # Pull out the list of options from jslint.js. # PREDEFINED_OPTS = { # Hard code, as not mentioned in the source list. 'predef' => ['The names of predefined global variables', 'StringArray'], # This is specific to jslint4java. 'warnings' => ['Enable additional warnings (jslint4java)', 'Bo...
Ruby
#!/usr/bin/env ruby # Add project classes require 'GeonamesHandler' require 'DirHandler' require 'DatabaseHandler' require 'ExifHandler' require 'WeatherHandler' require 'CategorizationHandler' require 'constants' # # A context handler class # class ContextHandler def initialize() # database h...
Ruby
#!/usr/bin/env ruby # require EXIF reader require "exifr" # # Exif information handler # class ExifHandler # DEBUG function, show exif information # @returns nothing unless no exif information is found def showdata(image) exifdata = Array.new image_file = image exif_i...
Ruby
#!/usr/bin/env ruby require "hpricot" require "open-uri" require 'cgi' require 'iconv' require 'htmlentities' require 'json' require 'net/http' require 'geonames' require 'iconv' require 'flickraw' #key = "e496cb4c3a379b2de0aae18f5528eb22" #secret = "0aef1c50d532f48c" # #class Flickr # def initia...
Ruby
#!/usr/bin/env ruby # Add project classes require 'DirHandler' require 'ContextHandler' require 'DatabaseHandler' require 'ExifHandler' require 'constants' require 'GeonamesHandler' require 'WeatherHandler' require 'CategorizationHandler' # Program constants # Show or not show debug messages DEBUG = 1 ...
Ruby
#!/usr/bin/env ruby SELF_DIR = Dir.getwd IMAGES_DIR = "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/cric/images/store"
Ruby
#!/usr/bin/env ruby # require mysql ruby-module require "mysql" # # Database handler # class DatabaseHandler def initialize() @address = "localhost" @username = "root" @password = "aurtjet4" @dbname = "test" @dbh = nil end # initiate database connection def connect ...
Ruby
#!/usr/bin/env ruby # Add project classes require 'GeonamesHandler' require 'DirHandler' require 'DatabaseHandler' require 'ExifHandler' require 'WeatherHandler' require 'CategorizationHandler' require 'constants' # # A context handler class # class ContextHandler def initialize() # database h...
Ruby
#!/usr/bin/env ruby #Add several methods to the File class require 'ftools' def debug(msg) if (DEBUG) puts "DEBUG: " + msg.to_s end end # # Directory handler, check given folder and insert images into DB # class DirHandler def initialize() @directory = "" @image_files = nil...
Ruby
#!/usr/bin/env ruby #Add several methods to the File class require 'ftools' def debug(msg) if (DEBUG) puts "DEBUG: " + msg.to_s end end # # Directory handler, check given folder and insert images into DB # class DirHandler def initialize() @directory = "" @image_files = nil...
Ruby
#!/usr/bin/env ruby # require EXIF reader require "exifr" # # Exif information handler # class ExifHandler # DEBUG function, show exif information # @returns nothing unless no exif information is found def showdata(image) exifdata = Array.new image_file = image exif_i...
Ruby
#!/usr/bin/env ruby SELF_DIR = Dir.getwd IMAGES_DIR = "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/cric/images/store"
Ruby
#!/usr/bin/env ruby # Add project classes require 'DirHandler' require 'ContextHandler' require 'DatabaseHandler' require 'ExifHandler' require 'constants' require 'GeonamesHandler' require 'WeatherHandler' require 'CategorizationHandler' # Program constants # Show or not show debug messages DEBUG = 1 ...
Ruby
#!/usr/bin/env ruby require "hpricot" require "open-uri" require 'cgi' require 'iconv' require 'htmlentities' require 'json' require 'net/http' require 'geonames' require 'iconv' require 'flickraw' #key = "e496cb4c3a379b2de0aae18f5528eb22" #secret = "0aef1c50d532f48c" # #class Flickr # def initia...
Ruby
#!/usr/bin/env ruby # require mysql ruby-module require "mysql" # # Database handler # class DatabaseHandler def initialize() @address = "localhost" @username = "root" @password = "aurtjet4" @dbname = "test" @dbh = nil end # initiate database connection def connect ...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # output_styl...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # output_styl...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" # You can select your preferred output style here (can be overridden via the command line): # output_styl...
Ruby
#! ruby require 'fileutils' require 'webrick' require 'date' require 'net/http' require 'fcsh_serve' include WEBrick ENV["PATH"] = "C:\\flex3_b3\\bin\\;" + ENV["PATH"] SHARED_CLASS_PATH = [".", "C:/corelib/src", "C:/flexunit/src/trunk/src/actionscript3", ...
Ruby
#! ruby require 'fileutils' require 'webrick' require 'date' require 'net/http' require 'fcsh_serve' include WEBrick ENV["PATH"] = "C:\\flex3_b3\\bin\\;" + ENV["PATH"] SHARED_CLASS_PATH = [".", "C:/corelib/src", "C:/flexunit/src/trunk/src/actionscript3", ...
Ruby
#!ruby require 'webrick' include WEBrick require 'net/http' COMPILE_COMMAND = "mxmlc -debug=true -compiler.warn-no-type-decl=false -compiler.source-path c:/my_system/src/as_dump/as3 c:/flex2/frameworks/source c:/my_system/src/as_dump/as3 c:/my_system/src/misc/croqodile/trunk/src/client -o=workspace.swf -file-s...
Ruby
#!ruby COMPILE_COMMAND = "mxmlc -compiler.warn-no-type-decl=false -compiler.source-path c:/my_system/src/as_dump/as3 c:/flex2/frameworks/source c:/my_system/src/as_dump/as3 c:/my_system/src/misc/croqodile/trunk/src/client -o=workspace.swf -file-specs=workspace.mxml" SWF_TO_RUN = "workspace.swf" def read_to_pr...
Ruby
#!ruby require 'webrick' include WEBrick require 'net/http' COMPILE_COMMAND = "mxmlc -debug=true -compiler.warn-no-type-decl=false -compiler.source-path c:/my_system/src/as_dump/as3 c:/flex2/frameworks/source c:/my_system/src/as_dump/as3 c:/my_system/src/misc/croqodile/trunk/src/client -o=workspace.swf -file-s...
Ruby
#!ruby COMPILE_COMMAND = "mxmlc -compiler.warn-no-type-decl=false -compiler.source-path c:/my_system/src/as_dump/as3 c:/flex2/frameworks/source c:/my_system/src/as_dump/as3 c:/my_system/src/misc/croqodile/trunk/src/client -o=workspace.swf -file-specs=workspace.mxml" SWF_TO_RUN = "workspace.swf" def read_to_pr...
Ruby
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # 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...
Ruby
#!/usr/bin/env ruby class ExampleRemoteLibrary def count_items_in_directory(path) Dir.entries(path).find_all{|i| not i.match('^\.')}.length end def strings_should_be_equal(str1, str2) puts "Comparing '#{str1}' to '#{str2}'" if str1 != str2 raise RuntimeError, "Given strings are not equal" ...
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/activerecord/rake' require './main'
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
# $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
# Compass configurations sass_path = File.dirname(__FILE__) css_path = File.join(sass_path, "..", "css") # Require any additional compass plugins here. images_dir = File.join(sass_path, "..", "img") output_style = :expanded environment = :production
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
#!/usr/local/bin/ruby gmsvpids=`ps auxw|grep gmsv__ |grep -v tail|grep -v ps|grep -v grep|grep -v killgmsv|grep -v init` gmsvpids.each do |line| if line =~ /^\w*\s+(\w*)/ then print "gmsv__ kill process id #{$1} \n" system( "kill -USR2 #{$1}") end end
Ruby
#!/usr/local/bin/ruby pid=`ps auxw|grep check|grep -v ps|grep -v grep|grep -v kill` pid.each do |line| if line =~ /^\w*\s+(\w*)/ then print "check.sh kill process id #{$1} \n" system( "kill -TERM #{$1}") end end gmsvpids=`ps auxw|grep gmsv__ |grep -v tail|grep -v ps|grep -v grep|grep -v killgmsv|grep -v init` ...
Ruby
#!/usr/local/bin/ruby gmsvpids=`ps auxw|grep gmsv__ |grep -v tail|grep -v ps|grep -v grep|grep -v killgmsv|grep -v init` gmsvpids.each do |line| if line =~ /^\w*\s+(\w*)/ then print "gmsv__ kill process id #{$1} \n" system( "kill -USR2 #{$1}") end end
Ruby
#!/usr/local/bin/ruby pid=`ps auxw|grep check|grep -v ps|grep -v grep|grep -v kill` pid.each do |line| if line =~ /^\w*\s+(\w*)/ then print "check.sh kill process id #{$1} \n" system( "kill -TERM #{$1}") end end gmsvpids=`ps auxw|grep gmsv__ |grep -v tail|grep -v ps|grep -v grep|grep -v killgmsv|grep -v init` ...
Ruby
require 'fileutils' task :default => [:clean] task :clean do [".", "tests"].each do |cd| puts "Cleaning directory #{cd}" Dir.new(cd).each do |t| if t =~ /.*\.pyc$/ puts "Removing #{File.join(cd, t)}" File.delete(File.join(cd, t)) end end end end desc "Upversion files" task...
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. # 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. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveReco...
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 cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
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 do debug a probl...
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 # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
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
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present #RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
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
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
# Copyright (C) 2010 National Association of REALTORS(R) # # All rights reserved. # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rig...
Ruby
class RetsController < ApplicationController include RetsHelper verify :method => :post, :render => {:text => "405 HTTP POST required", :status => :method_not_allowed}, :add_headers => {"Allow" => "POST"} def login wrap_action_handle_errors(params[:rets_info]) do |metadata| resources = [];...
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 #protect_from_forgery # See ActionController::RequestForgeryP...
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
#!/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/runner'
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/benchmarker'
Ruby