code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| 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/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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
class CreateGuideExecs < ActiveRecord::Migration
def self.up
create_table :guide_execs do |t|
t.integer :guide_id,:null =>false
t.string :guide_name
#执行状态 0:待执行 1:执行中 3:执行完毕
t.string :status,:null =>false,:default => '0'
t.integer :out_num,:null =>false,:default =>0
#需要导出的量... | Ruby |
class CreateChannels < ActiveRecord::Migration
def self.up
create_table :channels do |t|
t.integer :orders,:null =>false
t.integer :height,:null =>false
t.string :name,:null =>false
t.string :desc
t.boolean :status,:null =>false
t.integer :width,:null =>false
t.boolean :i... | Ruby |
class CreateGuides < ActiveRecord::Migration
def self.up
create_table :guides do |t|
t.string :name
t.integer :weigh,:null =>false,:default =>99
t.integer :num,:null =>false,:default =>0
#周期 1:一次性 2:每天
t.string :cycle,:null =>false,:default =>'1'
#类型 1:广告 2:站点
t.string :t... | Ruby |
class CreateResTags < ActiveRecord::Migration
def self.up
create_table :res_tags do |t|
t.integer :res_id
t.integer :tag_id
t.timestamps
end
end
def self.down
drop_table :res_tags
end
end
| Ruby |
class CreateAds < ActiveRecord::Migration
def self.up
create_table :ads do |t|
t.string :name ,:null => false
t.string :url ,:null => false
#1:首页 2:栏目页 3:资源页 4:固有广告
t.integer :orders ,:null => false
#0关闭 1开放
t.string :status,:null =>false,:default => '1'
t.string :de... | Ruby |
class CreateUserCfgs < ActiveRecord::Migration
def self.up
create_table :user_cfgs do |t|
t.integer :user_sign
t.string :sid,:null => false
t.string :nickname
t.string :phone
t.string :qq
t.string :sex,:null => false,:default => '1'
t.string :password
t.string... | Ruby |
class CreateLevels < ActiveRecord::Migration
def self.up
create_table :levels do |t|
t.string :name,:null =>false
t.string :host,:null =>false
t.boolean :is_default,:default => false, :null =>false
t.string :col_level,:null =>false
t.string :res_level,:null =>false
t.timestamps... | Ruby |
class CreateUserComments < ActiveRecord::Migration
def self.up
create_table :user_comments do |t|
t.integer :res_id
t.integer :user_id
t.integer :user_sign
t.string :nickname
t.string :qq
t.string :sid
t.string :user_type,:null => false,:default => '0'
t.string :com... | Ruby |
class CreateSections < ActiveRecord::Migration
def self.up
create_table :sections do |t|
t.integer :x,:null =>false
t.integer :y,:null =>false
t.string :name,:null =>false
t.string :desc
t.boolean :status,:null =>false
t.integer :channel_id,:null =>false
t.string :level,:... | Ruby |
class CreateAdStatics < ActiveRecord::Migration
def self.up
create_table :ad_statics do |t|
t.integer :ad_id
t.string :ad_name
t.timestamps
end
end
def self.down
drop_table :ad_statics
end
end
| Ruby |
class CreateUserCollects < ActiveRecord::Migration
def self.up
create_table :user_collects do |t|
t.integer :user_id
t.integer :user_sign
t.string :sid
t.integer :res_id
t.integer :img_index
t.string :img_path
t.string :res_name
t.timestamps
end
end
def sel... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name,:null =>false
t.string :pass,:null =>false
t.timestamps
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateResources < ActiveRecord::Migration
def self.up
create_table :resources do |t|
t.integer :orders,:null =>false
t.string :name,:null =>false
t.string :desc
t.boolean :status,:null =>false
t.string :level,:null =>false
t.integer :col_id,:null =>false
t.string :r... | Ruby |
class CreateTags < ActiveRecord::Migration
def self.up
create_table :tags do |t|
t.string :name,:null =>false
t.integer :level,:null =>false
t.integer :click_num,:null =>false,:default => 0
t.timestamps
end
end
def self.down
drop_table :tags
end
end
| Ruby |
class CreateFrs < ActiveRecord::Migration
def self.up
create_table :frs do |t|
t.string :name
t.string :value
t.string :return_url
t.timestamps
end
end
def self.down
drop_table :frs
end
end
| Ruby |
class CreateLogs < ActiveRecord::Migration
def self.up
create_table :logs do |t|
t.string :type,:null =>false
t.string :name,:null =>false
t.string :desc,:null =>true
t.string :sid,:null =>false
t.timestamps
end
end
def self.down
drop_table :logs
end
end
| Ruby |
class CreateFrStats < ActiveRecord::Migration
def self.up
create_table :fr_stats do |t|
t.integer :fr_id
t.string :name
t.string :value
t.timestamps
end
end
def self.down
drop_table :fr_stats
end
end
| Ruby |
#!/home/game/ruby/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.cra... | Ruby |
#!/home/game/ruby/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.cra... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::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 da... | Ruby |
# map.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# Map
# A basic map class to handle drawing the world.
include Rubygame
class Map
attr_accessor :tiles
attr_accessor :width
attr_accessor :height
attr_accessor :legend
attr_accessor :map_loaded
attr_accessor :mons... | Ruby |
# ingamestate.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# InGameState
# The ingame state, inherited from gamestate.
include Rubygame
require "io/wait"
class InGameState < GameState
attr_accessor :server_running
attr_accessor :loggedin
attr_accessor :got_response
... | Ruby |
# menustate.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# MenuState
# The menu state, inherited from gamestate.
# This handles all of the main menus.
require "rubygems"
require "rubygame"
include Rubygame
class MenuGameState < GameState
def initialize(scr)
super(... | Ruby |
# gamestate.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# GameState
# This is the base GameState class, that all the other gamestates will
# inherit from. Has an update class that gets called to do logic handling.
include Rubygame
class GameState
def initialize(scr)
... | Ruby |
# game.rb
# created by: Dan Alexander
# date: 3/5/2011
# license: New BSD License
#
# This is the main program for the client.
# This project is a part of "Adventures of 5 nachos awesomeness",
# a roguelike project started during 7DRL 2011 competition.
#!/usr/bin/env ruby
main_dir = File.dirname(__FILE__)
... | Ruby |
# menustate.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# MenuState
# The menu state, inherited from gamestate.
# This handles all of the main menus.
require "rubygems"
require "rubygame"
include Rubygame
class MessageGameState < GameState
def initialize(scr)
sup... | Ruby |
# chargamestate.rb
# created by: Dan Alexander
# date: 3/6/2011
# license: New BSD License
#
# CharacterSelectGameState
# The character selection game state, where players choose who
# to play as.
include Rubygame
class CharacterSelectState < GameState
def initialize(scr)
super(scr) #GameState paren... | Ruby |
# resources.rb
# created by: Dan Alexander
# date: 3/5/2011
# license: New BSD License
#
# Resource manager for the client. It loads all of the
# resources (images, sound, etc), which can then be
# accessed by calling the current functions.
include Rubygame
class ResourceManager
#the constructor. pass ... | 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.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
TwitterRails::Application.config.session_store :cookie_store, key: '_TwitterRails_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 wit... | 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 |
TwitterRails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.a... | Ruby |
TwitterRails::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 w... | Ruby |
TwitterRails::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 te... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
TwitterRails::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'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
TwitterRails::Application.routes.draw do
# get "tweets/index"
resources :tweets do
collection do
get 'obtener_request_token', 'redirigir_usuario', 'callback', 'obtener_access_token', 'tweet'
end
end
root to: "tweets#index"
# The priority is based upon order of creation:
# first created -> hi... | Ruby |
module ApplicationHelper
end
| Ruby |
module TweetsHelper
end
| Ruby |
require "erb"
include ERB::Util
# Sign in twitter, basado en:
# https://dev.twitter.com/docs/auth/implementing-sign-twitter
# TODO: explicar qué hace cada paso, para que sirve cada parámetro, separar en vistas distintas cada paso
# TODO poner response status para cada request
CONSUMER_SECRET = "EDUcnNFGa0GMjVLBtQkRk... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
#!/usr/bin/env rake
# 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__)
TwitterRails::Application.load_tasks
| Ruby |
#!/usr/bin/env ruby
# 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 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'faraday'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffe... | 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: 'Emanuel... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run TwitterRails::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 |
#Representacion en comillas simples o dobles
"abc"
'abc'
#Caracteres de escape
"nueva\nlinea"
"\tnueva parrafo"
| Ruby |
h = { :North => "NORTH", :South => "SOUTH" } | Ruby |
h = {1 => 2, "2" => "4"} #{"2"=>"4", 1=>2}
h[1] #2
h[5] #nil
h[5] = 10 # anadir un valor
h[1]=nil # borrar un valor
h #{5=>10, "2"=>"4", 1=>nil}
h = { "a" => 100, "b" => 200, "c" => 300 }
h.delete_if {|key, value| key >= "b" } #=> {"a"=>100} | Ruby |
require 'thread'
mutex = Mutex.new
count1 = count2 = 0
difference = 0
counter = Thread.new do
loop do
mutex.synchronize do
count1 += 1
count2 += 1
end
end
end
spy = Thread.new do
loop do
mutex.synchronize do
difference += (count1 - count2).abs
end
end
end
s... | Ruby |
["puts 'start'", "x","puts 'end'"].each do |string|
begin
eval string
raise ArgumentError, "Error Raised" if string.include?('start')
rescue ArgumentError => bang
print "Argument Error: " + bang
puts ""
end
else
print "Ok\n"
end
end | Ruby |
#Case
i=8
case i
when 1, 2..5
print "1..5\n"
when 6..10
print "6..10\n"
end
#6..10
case 'abcdef'
when 'aaa', 'bbb'
print "aaa o bbb\n"
when /def/
print "incluye /def/\n"
end
#incluye /def/
#While
i = 0
print "Es cero.\n" if i == 0
print "Es negativo\n" if i < 0
print "#{i... | Ruby |
#Uso como secuencias
edadNinos = 4..12
estrellasHotel = 1...6
edadNinos.include?(12) #true
estrellasHotel.include?(6) #false
(5..10).inject {|sum, n| sum + n } # 45
#Uso como condicionales
while line = gets
puts line if line =~ /start/..line =~/end/
end
#Uso como intervalos
(1..10) === 5 # Return... | Ruby |
#Los array pueden almacenar elementos de distintos tipos
ary = [1, 2, "3"]
#Al igual que las cadenas...
ary + ["foo", "bar"] #[1, 2, "3", "foo", "bar"]
ary * 2 #[1, 2, "3", 1, 2, "3"]
ary[-2] #2
#Uso de indices
ary[0,2] #[1, 2]
ary[-2,2] #[2, "3"]
ary[-2..-1] #[2, "3"]
a = [ "a", "b", "c", "d" ]
a.map!... | Ruby |
begin
file = open("/tmp/algun_fichero","w")
# ... Escribimos en el archivo ...
rescue
# ... gestionamos las excepciones ...
ensure
file.close # ... Y esto se ejecuta siempre.
end | Ruby |
#Ejemplo 1
/abc/ =~ 'zxyabcdef' # Returns TRUE
/ABC/ =~ 'zxyabcdef' # Returns FALSE
/ABC/i =~ 'zxyabcdef' # Returns TRUE
#Ejemplo 2
/^From:/ =~ "From: jack" # Returns TRUE
/^ To:/ =~ "To: jill" # Returns FALSE
/end$/ =~ "to the end" # Returns TRUE
/end$/ =~ "to an end!" # Ret... | Ruby |
class A
@@cvar = "ok"
end
class B < A
def print_cvar ()
p (@@cvar)
end
end
| Ruby |
# Programa que calcula el factorial de un numero
def factorial(n)
if n == 0
1
else
n * fact(n-1)
end
end
puts factorial(ARGV[0].to_i) | Ruby |
#Numeros
123456789 # -123456789 Fixnum
0d123456789 # 1234567890 Fixnum
1234323424231 # 1234323424231 Bignum
0x5C1 # 1473 Hex
01411 # 777 Octal
0b10 # 2 binario
1_90_33 # 19033 Fixnum, se omite el caracter _
1.5 # 1.5 Float
1.0e5 # 100000.0 Float
#Algunos Metodos
-14.abs # 14
6.zero? # false | Ruby |
class Base
def btest
puts "Test in Base Called!"
end
private :btest
end
class C < Base
public :btest
end
class D < Base
end
c = C.new()
c.btest()
#Test in Base Called!
d = D.new()
d.btest()
#private method `btest' called for # (NoMethodError)
| Ruby |
#Lanzar una exception
[ 0, 2, 4,7,8,10].each do |cond|
puts "Cond = #{cond}"
raise(ArgumentError, "Cond is not even number") if (cond % 2) != 0
end
| Ruby |
#Descarga de sitios web
require 'net/http'
pages = ["www.rubycentral.com", "www.awl.com", "www.pragmaticprogrammer.com"]
threads = []
for page in pages
threads << Thread.new(page) { |myPage|
h = Net::HTTP.new(myPage, 80)
puts "Fetching: #{myPage}"
resp, data = h.get('/')
puts "Got #... | Ruby |
class Getdata
attr_reader :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
ga = Getdata.new("john", "55")
puts "Name = #{ga.name} -- Age = #{ga.age}"
| Ruby |
class Fantasma
def initialize
@estado=Cazador.new(self)
end
def cambiarEstado(estado)
@estado=estado
end
def molestar!
@estado.molestar!
end
def presa!
@estado.presa!
end
def comer!
@estado.comer!
end
def mover
@estado.mover
end
... | Ruby |
class C
def initialize ()
@i = "ok"
end
def get_i ()
return @i
end
end
c = C.new ()
p (c.get_i ()) # "ok" is displayed | Ruby |
#Creando strings...
%Q(\ttext) # "<tab>text"
%q(\ttext) # "\text"
%Q#--text--# # "--text--"
#Array de strings
arr = %w(cat dog whale tiger great dane)
#["cat", "dog", "whale", "tiger", "great", "dane"]
| Ruby |
#En ruby las variables son referencias
firstVar="Dogs"
secondVar = firstVar
firstVar.chop!
#ambas variablas terminan
#con una referencia al valor "Dog" | Ruby |
def walk(dir)
case dir
when :North
puts "North Pasture"
when :east
puts "Homestead"
when :South
puts "ocean"
when :West
puts "city"
else
puts "unkown"
end
end
puts "Show Direction:"
walk(:North)
puts "Show Direction"
walk(:South)
... | 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 |
#!/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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.