code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/ruby
# file: yamltunesmail.rb
# author: davidfmiller http://www.fivevoltlogic.com/code/mytunes/
# version: v0.1.2
# about: a script that reads in email messages stored on disk saved via
# Apple's Mail.app and parses the message content to add any
# attached files to iTunes and ... | Ruby |
# file: AppleScript.rb
# author: davidfmiller http://www.fivevoltlogic.com
# about: a class that lets you execute AppleScript through Ruby
#
# history: v0.1 ??
# - beta release
#
# notes: AppleScript errors will be echoed to the terminal instead of being captured in the result
#
class AppleScript... | Ruby |
# file: yamltunes.rb
# author: davidfmiller http://www.fivevoltlogic.com/code/mytunes/yaml
# version: v0.1b
# about: a class that accepts yamltunes markup and excutes the corresponding AppleScript
# to create/update the playlist(s) in itunes
#
# ---
# "d.new":
# - buck 65 : blood of a young wolf
# - ja... | Ruby |
# Simple Jobs
# ===========
require 'java'
java_import Java::MyscheduleQuartzExtraJob::LoggerJob
java_import Java::MyscheduleQuartzExtraJob::ScriptingJob
java_import Java::MyscheduleQuartzExtra::SchedulerTemplate
java_import Java::JavaUtil::Date
java_import Java::JavaLang::System
# Schedule hourly job
scheduler.schedu... | Ruby |
# Simple Jobs
# ===========
require 'java'
java_import Java::MyscheduleQuartzExtraJob::LoggerJob
java_import Java::MyscheduleQuartzExtraJob::ScriptingJob
java_import Java::MyscheduleQuartzExtra::SchedulerTemplate
java_import Java::JavaUtil::Date
java_import Java::JavaLang::System
# Schedule hourly job
scheduler.schedu... | Ruby |
require 'yaml_waml'
| Ruby |
require 'rubygems'
require_gem 'rspec'
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
desc 'Default: run unit tests.'
task :default => :spec
task :pre_commit => [:spec, 'coverage:verify']
desc 'Run all specs under spec/**/*_spec.rb'
Spec::Rake::SpecTask.new(:spec ... | Ruby |
# desc "Explaining what the task does"
# task :yaml_waml do
# # Task goes here
# end | Ruby |
# Install hook code here
| Ruby |
require File.dirname(__FILE__) + '/../lib/yaml_waml'
| Ruby |
require "yaml"
class String
def is_binary_data?
false
end
end
ObjectSpace.each_object(Class) do |klass|
klass.class_eval do
if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
def to_yaml_with_decode(*args)
result = to_yaml_without_decode(*args)
if result.kind_of... | Ruby |
require 'yaml_waml'
| Ruby |
require 'rubygems'
gem 'rspec', '>= 1.1.4'
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
desc 'Default: run unit tests.'
task :default => :spec
task :pre_commit => [:spec, 'coverage:verify']
desc 'Run all specs under spec/**/*_spec.rb'
Spec::Rake::SpecTask.new(:s... | Ruby |
# desc "Explaining what the task does"
# task :yaml_waml do
# # Task goes here
# end | Ruby |
# Install hook code here
| Ruby |
require File.dirname(__FILE__) + '/../lib/yaml_waml'
| Ruby |
require "yaml"
class String
def is_binary_data?
false
end
end
ObjectSpace.each_object(Class) do |klass|
klass.class_eval do
if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
def to_yaml_with_decode(*args)
result = to_yaml_without_decode(*args)
if result.kind_of... | Ruby |
require 'yaml_waml'
| Ruby |
require 'rubygems'
require_gem 'rspec'
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
desc 'Default: run unit tests.'
task :default => :spec
task :pre_commit => [:spec, 'coverage:verify']
desc 'Run all specs under spec/**/*_spec.rb'
Spec::Rake::SpecTask.new(:spec ... | Ruby |
# desc "Explaining what the task does"
# task :yaml_waml do
# # Task goes here
# end | Ruby |
# Install hook code here
| Ruby |
require File.dirname(__FILE__) + '/../lib/yaml_waml'
| Ruby |
require "yaml"
class String
def is_binary_data?
false
end
end
ObjectSpace.each_object(Class) do |klass|
klass.class_eval do
if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
def to_yaml_with_decode(*args)
result = to_yaml_without_decode(*args)
if result.kind_of... | Ruby |
require 'yaml_waml'
| Ruby |
require 'rubygems'
gem 'rspec', '>= 1.1.4'
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
desc 'Default: run unit tests.'
task :default => :spec
task :pre_commit => [:spec, 'coverage:verify']
desc 'Run all specs under spec/**/*_spec.rb'
Spec::Rake::SpecTask.new(:s... | Ruby |
# desc "Explaining what the task does"
# task :yaml_waml do
# # Task goes here
# end | Ruby |
# Install hook code here
| Ruby |
require File.dirname(__FILE__) + '/../lib/yaml_waml'
| Ruby |
require "yaml"
class String
def is_binary_data?
false
end
end
ObjectSpace.each_object(Class) do |klass|
klass.class_eval do
if method_defined?(:to_yaml) && !method_defined?(:to_yaml_with_decode)
def to_yaml_with_decode(*args)
result = to_yaml_without_decode(*args)
if result.kind_of... | 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.
# 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 'net/http'
server = "msdl.microsoft.com"
pdb = "ntkrnlmp"
guid = "30092be745b24fe2a311a936e7b7486f2"
uri = "/download/symbols/#{pdb}.pdb/#{guid}/#{pdb}.pd_"
dest = "#{pdb}.pd_"
puts uri
Net::HTTP.start(server) { |http|
headers = {"User-Agent" => "Microsoft-Symbol-Server/6.6.0007.5"}
resp = http.get(u... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'virtdbg'
require 'optparse'
$VERBOSE = false
# parse arguments
opts = { :device => 0 }
OptionParser.new { |opt|
opt.banner = 'Usage: virtdbg.... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
module VirtDbg
VIRTDBGDIR = File.dirname(__FILE__)
# add it to the ruby library path
$: << VIRTDBGDIR
end
%w[forensic1394 virtdbg util main system].each { |f|
require ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# this exemple illustrates the use of the cparser/preprocessor #factorize functionnality:
# we write some code using standard headers, and t... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'metasm/dynldr'
include Metasm
module VirtDbg
class Forensic1394 < Metasm::DynLdr
new_api_c File.read(File.join(VIRTDBGDIR, "inc", ... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'metasm/dynldr'
include Metasm
module VirtDbg
class VirtDbgMem < VirtualString
def initialize(impl, addr=0, length=nil)
... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'metasm/dynldr'
require 'iconv'
class String
def utf16_to_iso
converter = Iconv.new('ISO-8859-1//IGNORE//TRANSLIT', 'UTF-16')
... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'metasm/dynldr'
include Metasm
def calc_checksum(data)
data.unpack('C*').inject(0) { |sum, byte| sum+byte }
end
module VirtDbg
class ... | Ruby |
# ripped from metasm/misc
class IO
def hexdump(ctx={})
ctx[:noend] = true
while buf = read(512) and not buf.empty?
buf.hexdump(ctx)
end
ctx.delete :noend
''.hexdump(ctx)
end
end
class String
def hexdump(ctx={})
fmt = ctx[:fmt] ||= ['c', 'd', 'a']
... | 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 |
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 Demo
def test # A test
i = 1
puts "Example"
end
end | Ruby |
require 'mytest_ext'
module Mytest
def hello
puts MytestInt::hello()
end
module_function :hello
end
| Ruby |
puts 'hello world'
#require 'hello2'
| Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
# Compass configurations
sass_path = File.dirname(__FILE__)
css_path = File.join(sass_path, "..", "css")
# Require any additional compass plugins here.
images_dir = File.join(sass_path, "..", "img")
output_style = :expanded
environment = :production | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | Ruby |
require 'mkmf'
$CPPFLAGS = $CPPFLAGS + " -I../../include"
$LDFLAGS = $LDFLAGS + " -L../../"
$LIBS = $LIBS + " -lhpdf -lpng -lz"
create_makefile 'hpdf'
| Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- demo.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appea... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- encryption.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- font_example.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright noti... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- arc_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear ... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- ext_gstate_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice ... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- ttfont_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appe... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- text_demo2.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- line_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- slideshow_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice a... | Ruby |
# 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/env ruby
require 'json'
RESET_PROB = 0.15;
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
last_change = json['state'].to_f
return {:edges => :OUT_EDGES} if last_change > 1e-2
return {:edges => :NO_EDGES}
end
def gather(json)
edge = j... | Ruby |
#!/usr/bin/env ruby
require 'json'
INFINITY = 1e99
class String
alias :old_to_f :to_f
def to_f
return INFINITY if 0 >= self.length
self.old_to_f
end
end
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
{:edges => :OUT_EDGES}
end
def gather(jso... | Ruby |
#!/usr/bin/env ruby
def colorize(text, color_code)
"\e[0;#{color_code}m#{text}\e[0m"
end
def red(text)
colorize(text, 31)
end
def green(text)
colorize(text, 32)
end
def cyan(text)
colorize(text, 36)
end
begin
# open new terminal
fd = IO.sysopen("/dev/tty", "r")
term = IO.new(fd,"r")
thread = T... | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_... | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_... | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_... | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_... | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
#
# This file is gererated by ruby-glade-create-template 1.1.4.
#
require 'libglade2'
require 'modules/plagtion_mod'
class PlagtionGlade
include GetText
attr :glade
def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
bindtextdomain(domain, localedir... | Ruby |
#!/usr/bin/env ruby
#
# This file is gererated by ruby-glade-create-template 1.1.4.
#
# Main program file
require 'includes/plagtion_logger'
require 'modules/plagtion_mod'
require 'includes/autoload'
class PlagtionGlade
include GetText
attr :glade
def initialize(path_or_data, root = nil, domain = nil, localed... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
#
# This file is gererated by ruby-glade-create-template 1.1.4.
#
# Main program file
require 'includes/plagtion_logger'
require 'modules/plagtion_mod'
require 'includes/autoload'
class PlagtionGlade
include GetText
attr :glade
def initialize(path_or_data, root = nil, domain = nil, localed... | Ruby |
#!/usr/bin/env ruby
#
# This file is gererated by ruby-glade-create-template 1.1.4.
#
require 'libglade2'
require 'modules/plagtion_mod'
class PlagtionGlade
include GetText
attr :glade
def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)
bindtextdomain(domain, localedir... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
class YahooSearchEngine < SearchEngine
def initialize(obj_ref, wlist, bsize)
super(obj_ref, wlist, bsize)
@language='it' # only italian pages
@app_id = 'fQ19NwLV34FPwYY.h2I1Hc8VcSfCGGCiUPY8kFfi2m8cjbKeAx3YxV0779bydcfE2Q--'
end
def search(num_of_results)
super(num_of_results)
for query ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
class GoogleCachedSearchEngine < SearchEngine
def initialize(obj_ref, wlist, bsize)
super(obj_ref, wlist, bsize)
end #init
def search(num_of_pages)
super(num_of_pages)
for query in @searchString
$logger.info("GoogleSearchEngine") {"query -> #{query}"}
q = GScraper::Search.query(:query => query)
... | Ruby |
class GoogleSearchEngine < SearchEngine
def initialize(obj_ref, wlist, bsize)
super(obj_ref, wlist, bsize)
end #init
def search(num_of_pages)
super(num_of_pages)
for query in @searchString
q = GScraper::Search.query(:query => query)
$logger.debug("GoogleSearchEngine") {q.page(0).urls}
... | Ruby |
#!/usr/bin/env ruby
############################################################################
# Copyright (C) 2009 by Davide Monfrecola #
# davide.monfrecola@gmail.com #
# ... | Ruby |
require 'logger'
# create a log file and store it in a global variable
$logger = Logger.new('log/logfile.log', 'daily')
$error_logger = Logger.new('log/error.log', 'daily')
| Ruby |
# classes
autoload :Overlap, 'classes/overlap'
autoload :UrlManager, 'classes/url_manager'
autoload :WebDocument, 'classes/web_document'
autoload :MasterDocument, 'classes/master_document'
# search engine
autoload :SearchEngine, 'classes/search_engine/search_engine'
autoload :GoogleSearchEngine, 'classes/search_engine... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.