code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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
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
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
# 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 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
# 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. YKode::Application.config.session_store :cookie_store, :key => '_YKode_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 with "rails ge...
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
YKode::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 on ...
Ruby
YKode::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 webserv...
Ruby
YKode::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 test su...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application YKode::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' require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie" # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development...
Ruby
YKode::Application.routes.draw do # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'product...
Ruby
module ApplicationHelper end
Ruby
class ApplicationController < ActionController::Base protect_from_forgery 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.expand_path('../config/application', __FILE__) require 'rake' YKode::Application.load_tasks
Ruby
#!/usr/bin/env jruby # 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 jruby # 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' #platforms :ruby do # gem "bson_ext", "~> 1.2" #end platforms :jruby do # As rails --database switch does not support derby, hsqldb, h2 nor mssql # as valid values, if you a...
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name =>...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run YKode::Application
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
begin require 'Plist' rescue LoadError raise 'You must "gem install plist" to get plist parser' end ROOT = File.expand_path('..') SRC = ROOT DST = File.join(ROOT, 'build') DST_THEMES = File.join(DST, 'themes') TMP = File.join(ROOT, 'tmp') THEMES_DIR = File.expand_path("~/Library/Application\\ Support/TextMate/The...
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 'albacore' PROJECT_NAME = "FinAnSu" REPO_NAME = "brymck/finansu" task :default => :build task :release => [:build, :upload] desc "Builds the application." msbuild :build do |msb| msb.properties :configuration => :Release msb.targets :Clean, :Build msb.solution = "FinAnSu.sln" end # This requires ...
Ruby
source 'http://rubygems.org' gem 'albacore' gem 'mime-types' gem 'xml-simple'
Ruby
#!/usr/bin/env ruby -Ku require "fileutils" require "zip/zip" PROJECT_NAME = "FinAnSu" SOLUTION_DIR = File.dirname(File.expand_path(__FILE__)) # Writes a blank row then a header row def write_header(text) puts puts "---- %s ----" % text end # Writes a status row, by necessity indenting at least once def write_st...
Ruby
#!/usr/bin/env ruby -Ku puts "This upload script doesn't work at the moment." puts "Upload everything via https://github.com/brymck/finansu/downloads" exit 0 PROJECT_NAME = "FinAnSu" REPO_NAME = "brymck/finansu" this_path = File.expand_path(File.dirname(__FILE__)) upload_script = File.join(this_path, "Lib", ...
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 '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
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
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 '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
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
driver = Selenium::WebDriver.for :chrome
Ruby
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :htmlunit
Ruby
driver = Selenium::WebDriver.for :firefox
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
driver = Selenium::WebDriver.for :ie
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' 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' # 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: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
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 'example' print Example.My_variable, "\n"
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