code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require 'sinatra'
require 'json'
require 'dm-core'
#require 'dm-validations'
require 'dm-timestamps'
require 'dm-serializer'
require 'dm-ar-finders'
require 'haml'
# Configure DataMapper to use the App Engine datastore
DataMapper.setup(:default, "appengine://auto")
require 'models/chat'
require 'models/chat_user'
re... | Ruby |
require 'appengine-rack'
require 'chat'
AppEngine::Rack.configure_app(:application => "jrubychat", :version => 1)
configure :development do
class Sinatra::Reloader < ::Rack::Reloader
def safe_load(file, mtime, stderr)
if File.expand_path(file) == File.expand_path(::Sinatra::Application.app_file)
:... | Ruby |
require 'appengine-rack'
AppEngine::Rack.configure_app(
:application => "application-id",
:version => 1 )
run lambda { Rack::Response.new("Hello World!").finish }
| Ruby |
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path ".gems/bundler_gems"
# List gems to bundle here:
gem "dm-appengine"
gem "merb-core"
| Ruby |
require 'appengine-rack'
AppEngine::Rack.configure_app(
:application => 'application-id',
:version => 1)
require 'rubygems'
require 'merb-core'
Merb::Config.setup(
:merb_root => File.dirname(__FILE__),
:environment => AppEngine::Rack.environment)
Merb.environment = Merb::Config[:environment]
Merb.... | Ruby |
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path '.gems/bundler_gems'
# List gems to bundle here:
gem 'rails_dm_datastore'
gem 'jruby-openssl'
gem 'jruby-rack', '1.0.5'
gem 'rails', '2.3.9'
| Ruby |
#!/usr/bin/ruby
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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.apac... | Ruby |
class Rails::InfoController < ActionController::Base
def properties
info = [['Ruby version', "#{RUBY_VERSION} (#{RUBY_PLATFORM})"]]
if defined? Gem::RubyGemsVersion
info << ['RubyGems version', Gem::RubyGemsVersion]
else
info << ['RubyGems','disabled']
end
info << ['Rack version', Rack... | Ruby |
#!/usr/bin/ruby
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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.apac... | Ruby |
#!/usr/bin/ruby
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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.apac... | Ruby |
#!/usr/bin/ruby
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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.apac... | Ruby |
require "rails/backtrace_cleaner.rb"
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
def add_gem_filters
add_filter { |line| line.sub(/(.+gems\.jar\!\/)(.*)/, '\2')}
end
end
end
| Ruby |
require 'appengine-rack'
ENV['RAILS_ENV'] = AppEngine::Rack.environment
#deferred_dispatcher = AppEngine::Rack::DeferredDispatcher.new(
# :require => File.expand_path('../config/environment', __FILE__),
# :dispatch => 'ActionController::Dispatcher')
#
#map '/' do
# run deferred_dispatcher
#end
require 'config... | Ruby |
#!/usr/bin/ruby
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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.apac... | Ruby |
require 'rubygems'
require 'appengine-rack'
require 'appengine-apis/xmpp'
require 'stringio'
AppEngine::Rack.configure_app(:application => 'jruby-xmpp', :version => 1)
AppEngine::Rack.app.inbound_services << :xmpp_message
map "/_ah/xmpp" do
run lambda {|env|
data = env['rack.input'].read
env['CONTENT_LENGTH... | Ruby |
# Critical default settings:
disable_system_gems
disable_rubygems
bundle_path ".gems/bundler_gems"
# List gems to bundle here:
gem "dm-appengine"
gem "sinatra"
| Ruby |
require 'appengine-rack'
require 'guestbook'
AppEngine::Rack.configure_app(
:application => 'application-id',
:precompilation_enabled => true,
:version => 1)
run Sinatra::Application
| Ruby |
# Copyright 2009 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 writing,... | Ruby |
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/destroy'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem, ... | Ruby |
#!/usr/bin/env ruby
# File: script/console
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
libs = " -r irb/completion"
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
libs << " -... | Ruby |
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/generate'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:rubygems, :newgem,... | Ruby |
begin
require 'spec'
require 'appengine-sdk'
rescue LoadError
require 'rubygems'
require 'spec'
require 'appengine-sdk'
end
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'appengine-apis/testing'
AppEngine::Testing.setup
class ProtoMatcher
def compare(hash, proto, prefix='')
hash.each do |key,... | Ruby |
begin
require 'spec'
rescue LoadError
require 'rubygems'
require 'spec'
end
begin
require 'spec/rake/spectask'
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
gem install rspec
EOS
exit(0)
end
desc "Run the specs under spec/models"
Spec::Rake::SpecTask.new do |t|
t.s... | Ruby |
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rubygems/specification'
require 'date'
require 'spec/rake/spectask'
require File.dirname(__FILE__) + '/lib/appengine-apis'
# set up pretty rdoc if possible
begin
gem 'rdoc'
require 'sdoc'
ENV['RDOCOPT'] = '-T lightblu... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#! /usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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://ww... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Wang (mailto:jwang392@gmail.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Bas Wilbers
#
# 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 app... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Bas Wilbers
#
# 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 app... | Ruby |
require 'rbconfig'
module JRuby
class Commands
class << self
def find_script(name)
script = Config::CONFIG['bindir'] + "/#{name}"
ruby_bin = nil
if File.exists? script
ruby_bin = File.open(script) {|io| (io.readline rescue "") =~ /^#!.*ruby/} rescue nil
else
... | Ruby |
require 'rubygems'
# try to activate jruby-openssl gem, and only require from the gem if it's there
begin
gem 'jruby-openssl'
require 'openssl.rb'
rescue LoadError
end
| Ruby |
JRuby distributes some ruby modules which are distributed under Ruby
license:
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the GPL
(see the file GPL), or the conditions below:
1. You may make and give away verbatim copie... | Ruby |
require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'
require 'date'
require 'erb'
require 'fileutils'
ROOT = File.expand_path(File.dirname(__FILE__))
require "#{ROOT}/lib/appengine-jruby-jars"
GEM_VERSION = AppEngine::JRubyJars::VERSION
JRUBY_VERSION = AppEngine::JRubyJars::JRUBY_VERSION
... | Ruby |
#!/usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.o... | Ruby |
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/destroy'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:newgem_simple, :tes... | Ruby |
#!/usr/bin/env ruby
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
begin
require 'rubigen'
rescue LoadError
require 'rubygems'
require 'rubigen'
end
require 'rubigen/scripts/generate'
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
RubiGen::Base.use_component_sources! [:newgem_simple, :te... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'
require 'date'
require 'spec/rake/spectask'
GEM = "dm-appengine"
GEM_VERSION = "0.1.3"
HOMEPAGE = "http://code.google.com/p/appengine-jruby"
SUMMARY = "A DataMapper adapter for Google App Engine"
spec = Gem::Specification.new do |s|
s... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
module DataMapper
class Property
class AppEngineNative < Object
primitive ::Object
def dump(value)
value
end
def load(value)
value
end
end
IMHandle = GeoPt = User = AppEngineNative
end
end | Ruby |
module DataMapper
class Property
class AppEngineStringType < String
def self.dump(value, property)
if value.nil?
nil
else
typecast(value)
end
end
def self.load(value, property)
value
end
def typecast_to_primitive(value... | Ruby |
module DataMapper
class Property
class Rating < Integer
def self.dump(value, property)
AppEngine::Datastore::Rating.new(typecast(value)) if value
end
def self.load(value, property)
value.rating if value
end
end
end
end | Ruby |
module DataMapper
class Property
class Key < Object
primitive AppEngine::Datastore::Key
include PassThroughLoadDump
def dump(value)
typecast(value)
end
def load(value)
value
end
def typecast(value)
if value.nil?
value
... | Ruby |
module DataMapper
class Property
class List < Object
primitive ::Object
def dump(value)
value
end
def load(value)
value
end
end
end
end | Ruby |
module DataMapper
class Property
prefix = 'dm-appengine/properties'
class_mapping = [
['key', [:AncestorKey, :Key]],
['native', [:AppEngineNative, :IMHandle, :GeoPt, :User]],
['string', [:AppEngineStringType, :Blob, :ByteString, :Link, :Email,
:Category, :PhoneNumber, ... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2010 David Masover
# Original Author:: David Masover (mailto:ninja@slaphack.com)
#
# 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:... | Ruby |
$:.unshift(File.dirname(__FILE__) + '/../lib')
| Ruby |
require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'
require 'date'
require 'spec/rake/spectask'
require 'appengine-sdk'
GEM = "appengine-tools"
GEM_VERSION = "0.0.17"
HOMEPAGE = "http://code.google.com/p/appengine-jruby"
PLUGIN_SOURCE = 'src/com/google/appengine/jruby/JRubyYamlPlugin.jav... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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://ww... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby1.8 -w
#
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: John Woodell (mailto:woodie@google.com)
#
# 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... | Ruby |
#! /usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#! /usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#! /usr/bin/ruby
# Copyright:: Copyright 2009 Google Inc.
# Original Author:: Ryan Brown (mailto:ribrdb@google.com)
#
# 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.... | Ruby |
#!/usr/bin/env ruby
require 'rubygems'
entrada = IO.new(0,'r')
contador=0
endereco_num = 0
endereco_comeca = '0000'
codigo_linha = ''
soma = 0
entrada.each do |linha|
if linha.match(/([01]{8})([01]{8})\s+([01]{8})([01]{8})/)
addr_m = $1.to_i(2)
addr_l = $2.to_i(2)
code_m = $3.to_i(2)
code_l = $4.to... | Ruby |
# -*- coding: utf-8 -*-
# Constantes de pseudo instruções
NOP = /NOP/
LIW_cons = /LIW\s+\$(\d{1,2}),\s*(%\w+%)/
LIW_imm = /LIW\s+\$(\d{1,2}),\s*(\d+)/
nomeArquivo = ARGV[0]
entrada = File.new(nomeArquivo+".asm",'r')
arquivoIndexado = []
nLinha = 0
entrada.each do |linha|
nLinha = nLinha+1
linha2 =''
linha.su... | Ruby |
#!/usr/bin/env ruby
require 'rubygems'
require "serialport"
sp = SerialPort.new "/dev/ttyS0", 9600
entrada = IO.new(0,'r')
contador=0
endereco_num = 0
endereco_comeca = '0000'
codigo_linha = ''
soma = 0
entrada.each do |linha|
if linha.match(/([01]{8})([01]{8})\s+([01]{8})([01]{8})/)
addr_m = $1.to_i(2)
ad... | 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 |
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.u... | 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 |
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 |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.