code
stringlengths
1
1.73M
language
stringclasses
1 value
require 'rubygems' # not required for ruby 1.9 or if you installed without gem require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.get "http://somedomain/url_that_delays_loading" wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds begin element = wait.until { driver.find_element...
Ruby
require 'rubygems' require 'selenium-webdriver' PROXY = "localhost:8080" proxy = Selenium::WebDriver::Proxy.new( :http => PROXY, :ftp => PROXY, :ssl => PROXY ) caps = Selenium::WebDriver::Remote::Capabilities.ie(:proxy => proxy) # you have to use remote, otherwise you'll have to code it yoursel...
Ruby
require 'rubygems' require 'selenium-webdriver' PROXY = 'localhost:8087' profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::WebDriver::Proxy.new( :http => PROXY, :ftp => PROXY, :ssl => PROXY ) driver = Selenium::WebDriver.for :firefox, :profile => profile
Ruby
driver = Selenium::WebDriver.for :chrome
Ruby
driver = Selenium::WebDriver.for :ie
Ruby
driver = Selenium::WebDriver.for :firefox
Ruby
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :htmlunit
Ruby
require 'rubygems' require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.get "http://google.com" element = driver.find_element :name => "q" element.send_keys "Cheese!" element.submit puts "Page title is \#{driver.title}" wait = Selenium::WebDriver::Wait.new(:timeout => 10) wait.until { drive...
Ruby
require 'rubygems' require 'selenium-webdriver' begin driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox driver.get "http://www.google.com" driver.save_screenshot "/Screenshots/google.png" ensure driver.quit end
Ruby
require 'rubygems' # not required for ruby 1.9 or if you installed without gem require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.manage.timeouts.implicit_wait = 10 # seconds driver.get "http://somedomain/url_that_delays_loading" element = driver.find_element(:id => "some-dynamic-element")
Ruby
require 'rubygems' # not required for ruby 1.9 or if you installed without gem require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.get "http://somedomain/url_that_delays_loading" wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds begin element = wait.until { driver.find_element...
Ruby
require 'rubygems' require 'selenium-webdriver' PROXY = "localhost:8080" proxy = Selenium::WebDriver::Proxy.new( :http => PROXY, :ftp => PROXY, :ssl => PROXY ) caps = Selenium::WebDriver::Remote::Capabilities.ie(:proxy => proxy) # you have to use remote, otherwise you'll have to code it yoursel...
Ruby
require 'rubygems' require 'selenium-webdriver' PROXY = 'localhost:8087' profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::WebDriver::Proxy.new( :http => PROXY, :ftp => PROXY, :ssl => PROXY ) driver = Selenium::WebDriver.for :firefox, :profile => profile
Ruby
driver = Selenium::WebDriver.for :chrome
Ruby
driver = Selenium::WebDriver.for :ie
Ruby
driver = Selenium::WebDriver.for :firefox
Ruby
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :htmlunit
Ruby
require 'rubygems' require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.get "http://google.com" element = driver.find_element :name => "q" element.send_keys "Cheese!" element.submit puts "Page title is \#{driver.title}" wait = Selenium::WebDriver::Wait.new(:timeout => 10) wait.until { drive...
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
# # << 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 >> -- 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.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 >> -- 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 >> -- 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.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 >> -- 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.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
# # << 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
require 'mkmf' $CPPFLAGS = $CPPFLAGS + " -I../../include" $LDFLAGS = $LDFLAGS + " -L../../" $LIBS = $LIBS + " -lhpdf -lpng -lz" create_makefile 'hpdf'
Ruby
# Application text_items = %s шт. - %s руб. text_welcome = Войти в <a href="%s">личный кабинет</a> или <a href="%s">зарегистрироваться</a> text_logged = Вы вошли как <a href="%s">%s</a> <b>(</b> <a href="%s">Выйти</a> <b>)</b> text_home = Главная text_order = Заказать text_contact = Контакты text_faq = Вопросы и отве...
Ruby
# Application text_items = %s шт. - %s руб. text_welcome = Войти в <a href="%s">личный кабинет</a> или <a href="%s">зарегистрироваться</a> text_logged = Вы вошли как <a href="%s">%s</a> <b>(</b> <a href="%s">Выйти</a> <b>)</b> text_home = Главная text_order = Заказать text_contact = Контакты text_faq = Вопросы и отве...
Ruby
#!/usr/bin/env ruby #coding: utf-8 #YomeBrowser Parser #ruby yomeparse.rb < conf/yome_data_N.xml > N.html require 'rubygems' require 'multisax' require 'cgi' if ARGV.size<2 puts 'yomeparsewiki.rb conf/yome_data_N.xml picture_prefix' exit end ID=ARGV[1] m={ 'なでる'=>'なでた時のコメント', '超なでる'=>'超なでた時のコメント', 'キス'=>'キスした時のコ...
Ruby
#!/usr/bin/env ruby #coding:utf-8 #YomeBrowser Parser #ruby yomeparse.rb < conf/yome_data_N.xml > N.html require 'rubygems' require 'multisax' levels={} open(File.dirname(__FILE__)+'/level.csv'){|f| f.each_line{|line| a=line.chomp.split(',') levels[a[0]]=a[2] } } items={} open(File.dirname(__FILE__)+'/itemlist.c...
Ruby
#!/usr/bin/env ruby #YomeBrowser Lister #server number NUMBER=28 #1=iPhone 2=Android TERMINALKIND=2 require 'rubygems' require 'net/https' require 'uri' require 'multisax' uri=URI.parse("https://idol.anime.biglobe.ne.jp/api/yome/#{NUMBER}/firstRun/getYomeList.php?terminalKind=#{TERMINALKIND}") body='' https = Net::H...
Ruby
#!/usr/bin/env ruby #YomeBrowser Downloader #server number NUMBER=28 #1=iPhone 2=Android TERMINALKIND=2 require 'rubygems' require 'net/https' load File.expand_path(File.dirname(__FILE__)+'/yomedlidol.conf') if ARGV.size<2 puts 'yomedlidol.rb N group(usually 1)' puts 'Note: You must have at least one vacancy.' pu...
Ruby
#!/usr/bin/env ruby require 'find' require 'fileutils' if ARGV.size<2 puts 'unyomecolle.rb source-dir/ target-dir/' exit end source=ARGV[0] source+='/' if !source.end_with?('/') target=ARGV[1] target+='/' if !target.end_with?('/') Find.find(source){|path| newpath=path.sub(source,target) puts newpath if File.direc...
Ruby
#!/usr/bin/env ruby #YomeBrowser Downloader #server number NUMBER=30 #1=iPhone 2=Android TERMINALKIND=2 require 'rubygems' require 'net/https' load File.expand_path(File.dirname(__FILE__)+'/yomedl.conf') if ARGV.size<2 puts 'yomedl.rb N group(usually 1)' puts 'Note: You must have at least one vacancy.' puts 'Also...
Ruby
#!/usr/bin/env ruby require 'digest/sha1' require 'openssl' if ARGV.size<1 puts "ruby getyomecolleuid.rb IMEI" exit end sha1=Digest::SHA1.hexdigest(ARGV[0]) str='0000000000000000'+sha1 aes=OpenSSL::Cipher::Cipher.new("AES-128-CBC") aes.encrypt aes.key='neBIG08-08-21#AP' aes.iv='NEBIGVoice08Zero' puts (aes.update(str...
Ruby
#!/usr/bin/env ruby #YomeBrowser Lister #server number NUMBER=30 #1=iPhone 2=Android TERMINALKIND=2 require 'rubygems' require 'net/https' require 'uri' require 'multisax' uri=URI.parse("https://yomecolle.jp/api/yome/#{NUMBER}/firstRun/getYomeList.php?terminalKind=#{TERMINALKIND}") body='' https = Net::HTTP.new(uri....
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 '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
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 any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
# 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' # inflect.uncountable %w( fish sheep ) # end
Ruby
# Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile
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
# Be sure to restart your web 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 =...
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) unless defined?(Rails::Initializer) if File.directory?("#{RAILS_ROOT}/vendor/rails") require "#{RAILS_ROOT}/vendor/rails/railties/lib/init...
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 # Sa...
Ruby
# 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 helper :all # include all helpers, all the time end
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/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/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
require "yaml" desc 'install plugins with piston' task :plugin_install do |t| plugins = YAML.load_file('plugins.yml') plugins.each do |name, svn| sh "piston import #{svn} vendor/plugins/#{name}" end end
Ruby
#!/usr/local/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
#!/usr/local/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
#!/usr/local/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
#!/usr/local/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
#!/usr/local/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
#!/usr/local/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 File.dirname(__FILE__) + '/lib/sphinx'
Ruby
require 'rake' require 'spec/rake/spectask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :spec desc 'Test the sphinx plugin.' Spec::Rake::SpecTask.new(:spec) do |t| t.libs << 'lib' t.pattern = 'spec/*_spec.rb' end desc 'Generate documentation for the sphinx plugin.' Rake...
Ruby
namespace :sphinx do desc 'Run indexer for configured indexes' task :index do config = load_config if config[:indexes] system "#{config[:root_dir]}/indexer --config \"#{config[:config_file]}\" #{config[:indexes]}" else puts 'You should specify indexes in sphinx.yml' end end ...
Ruby
require 'fileutils' sphinx_config = File.dirname(__FILE__) + '/../../../config/sphinx.yml' FileUtils.cp File.dirname(__FILE__) + '/sphinx.yml.tpl', sphinx_config unless File.exist?(sphinx_config) puts IO.read(File.join(File.dirname(__FILE__), 'README'))
Ruby
require File.dirname(__FILE__) + '/sphinx/request' require File.dirname(__FILE__) + '/sphinx/response' require File.dirname(__FILE__) + '/sphinx/client' module Sphinx end
Ruby