code
stringlengths
1
1.73M
language
stringclasses
1 value
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
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
# 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
# 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 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 # 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
# 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
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 '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
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css") environment = :development output_style = :expanded
Ruby
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css-debug") environment = :development output_style = :expanded
Ruby
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css") environment = :production output_style = :compressed
Ruby
# This file registers the sencha-touch framework with compass # It's a magic name that compass knows how to find. dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'theme_images.rb') Compass::Frameworks.register 'sencha-touch', dir
Ruby
stylesheet 'sencha-touch.scss'
Ruby
module SenchaTouch module SassExtensions module Functions module ThemeImages def theme_image(theme, path, mime_type = nil) path = path.value images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value) real_path = File.join(images_path, path) i...
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
# 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
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 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
class RubyLibraryExample def get_server_language 'ruby' end # Basic communication def passing end def failing(message) raise message end def logging(message, level='INFO') puts "*#{level}* #{message}" end def returning 'returned string' end # Logging def one_message_w...
Ruby
# Require any additional compass plugins here. add_import_path "bower_components/foundation/scss" # Set this to the root of your project when deployed: http_path = "/" css_dir = "css" sass_dir = "scss" images_dir = "css/assets" javascripts_dir = "js" # You can select your preferred output style here (can be overridde...
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
# 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
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
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
#!/usr/bin/ruby # Transporter Chief # Copyright 2012 Gamua OG. All Rights Reserved. # # This program is free software. You can redistribute and/or modify it # in accordance with the terms of the accompanying license agreement. require 'optparse' require 'ostruct' require 'fileutils' require 'pathname' require 'tmpdir...
Ruby
#!/usr/bin/ruby # Transporter Chief # Copyright 2012 Gamua OG. All Rights Reserved. # # This program is free software. You can redistribute and/or modify it # in accordance with the terms of the accompanying license agreement. require 'optparse' require 'ostruct' require 'fileutils' require 'pathname' require 'tmpdir...
Ruby
class ClassGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" if(!user_requested_test) m.directory full_class_dir m.template 'Class.as', full_cl...
Ruby
# Generate a new ActionScript 3.0 TestCase and rebuild the test suites. # This generator can be executed as follows: # # sprout -n as3 SomeProject # cd SomeProject # script/generator test utils.MathUtilTest # class TestGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| m....
Ruby
require 'sprout' # Optionally load gems from a server other than rubyforge: # set_sources 'http://gems.projectsprouts.org' sprout 'as3' ############################################ # Uncomment and modify any of the following: Sprout::ProjectModel.setup do |model| model.project_name = 'as3ui' # Default Values: ...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
class ClassGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" if(!user_requested_test) m.directory full_class_dir m.template 'Class.as', full_cl...
Ruby
# Generate a new ActionScript 3.0 TestCase and rebuild the test suites. # This generator can be executed as follows: # # sprout -n as3 SomeProject # cd SomeProject # script/generator test utils.MathUtilTest # class TestGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| m....
Ruby
require 'sprout' # Optionally load gems from a server other than rubyforge: # set_sources 'http://gems.projectsprouts.org' sprout 'as3' ############################################ # Uncomment and modify any of the following: Sprout::ProjectModel.setup do |model| model.project_name = 'as3ui' # Default Values: ...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
class ClassGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" if(!user_requested_test) m.directory full_class_dir m.template 'Class.as', full_cl...
Ruby
# Generate a new ActionScript 3.0 TestCase and rebuild the test suites. # This generator can be executed as follows: # # sprout -n as3 SomeProject # cd SomeProject # script/generator test utils.MathUtilTest # class TestGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| m....
Ruby
require 'sprout' # Optionally load gems from a server other than rubyforge: # set_sources 'http://gems.projectsprouts.org' sprout 'as3' ############################################ # Uncomment and modify any of the following: Sprout::ProjectModel.setup do |model| model.project_name = 'as3ui' # Default Values: ...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
class ClassGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| # m.class_collisions class_dir, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper" if(!user_requested_test) m.directory full_class_dir m.template 'Class.as', full_cl...
Ruby
# Generate a new ActionScript 3.0 TestCase and rebuild the test suites. # This generator can be executed as follows: # # sprout -n as3 SomeProject # cd SomeProject # script/generator test utils.MathUtilTest # class TestGenerator < Sprout::Generator::NamedBase # :nodoc: def manifest record do |m| m....
Ruby
require 'sprout' # Optionally load gems from a server other than rubyforge: # set_sources 'http://gems.projectsprouts.org' sprout 'as3' ############################################ # Uncomment and modify any of the following: Sprout::ProjectModel.setup do |model| model.project_name = 'as3ui' # Default Values: ...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'sprout' sprout 'sprout-as3-bundle' # Add a class name if TestSuites were generated if(ARGV.size == 1 && ARGV[0] == 'suite') ARGV << 'AllTests' end # Insert class type by default if(ARGV.size == 1) ARGV.unshift('class') end # Execute generators like this: # script/g...
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 'RMagick' class NumberImageGenerator @@IMAGE_DIR = 'numbers-hdpi/' def generate(text, fs=18) #filename = "b" + sprintf("%03d", text) + ".png"; filename = "" + sprintf("%03d", text) + ".png"; font_size = fs; height = 35; width = 35; image = Magick::Image.new(width, height) {self.ba...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 project = 'battery-indicator' user = `cat ~/.netrc | awk '{print $4;}'`.strip pass = `cat ~/.netrc | awk '{print $6;}'`.strip version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1] apk_location = "BatteryIndicatorPro-#{version}.apk" system("cp bin/*-release.ap...
Ruby
#!/usr/bin/env ruby require 'net/http' require 'uri' LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/' langs = Net::HTTP.get(URI.parse(LANGS_URI)).split() langs.each do |lang| if lang.length == 2 dir = 'res/values-' << lang else dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2] end if ! D...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 require 'nokogiri' # read in convert.xml to see which how to convert the string-arrays # for each strings.xml in res/values res/values-?? res/values-??-* # find the string-arrays that match the ones in convert.xml and for each # remove opening and closing string-array tag #...
Ruby
# File boggle_solver.rb require 'trie' require 'set' # The BoggleSolver class is used to solve Boggle boards. It has # nested classes to represent individual letter blocks (e.g., "a" or # "qu"), Boggle boards, and a class that can load in a dictionary and # then solve multiple boards. class BoggleSolver # Repre...
Ruby
# File trie.rb # Implements the trie data structure. class Trie def initialize(level = 0) @level = level @hash = Hash.new end # Adds the string parameter to the trie. def add(string) letter = curr_letter(string) if letter.nil? @hash[letter] = string else trie = @hash[letter]...
Ruby
#!/usr/bin/env ruby # Represents and generates Boggle Boards. It randomly rolls simulated # Boggle Dice and places them randomly in a 4x4 grid. # Note: one die has the side 'QU'. class BoardGenerator BoggleDie = [ ['F', 'O', 'R', 'I', 'X', 'B'], ['M', 'O', 'QU', 'A', 'B', 'J'], ...
Ruby
#!/usr/bin/env ruby # File boggle.rb #require 'enumerator' require 'pp' require 'solver' require 'board_generator' # If there's a command-line argument use it as the Boggle board. # Otherwise create a random Boggle board. board_count = 1 board_count = ARGV[0].to_i if ARGV.size >= 1 config = "" unless STDIN.tty...
Ruby
#!/usr/bin/ruby # Copyright 2013 Google Inc. All Rights Reserved. # # 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 ...
Ruby
# Copyright 2013 Google Inc. All Rights Reserved. # # 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 la...
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'logger' require 'oauth/oauth_util' require 'sqlite3' require 'thread' require 'trollop' YOUTUBE_API_READONLY_SCOPE = 'https://www.googleapis.com/auth/youtube.readonly' YOUTUBE_ANALYTICS_API_SCOPE = 'https://www.googleapis.com/auth/yt-analytics.re...
Ruby
#!/usr/bin/ruby require 'benchmark' Benchmark.bm do |x| [1, 2, 5, 10, 20].each do |thread_count| x.report("#{thread_count} threads:") do system('./analyticsdump.rb', '--threads', thread_count.to_s) end sleep(60) end end
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
#!/usr/bin/ruby # Copyright 2011 Google Inc. All Rights Reserved. # # 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 ...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' require 'trollop' # This code assumes that there's a client_secrets.j...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' # A limited OAuth 2 access scope that allows for read-only access. YO...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' require 'trollop' # An OAuth 2 access scope that allows for full read...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'trollop' # Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the # Google APIs Console <http://code.google.com/apis/console#access> # Please ensure that you have enabled the YouTube Data API for your project. DEVELOPER_KEY = "REP...
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
NOT READY YET #!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'oauth/oauth_util' client = Google::APIClient.new youtube = client.discovered_api('youtube', 'v3alpha') auth_util = CommandLineOAuthHelper.new('https://www.googleapis.com/auth/youtube') client.authorization = auth_util.authorize() ...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' # An OAuth 2 access scope that allows for full read/write access. YOU...
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
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