Botchは簡単にウェブクローラーを記述するためのDSLのようなものです。
Sinatraを参考にしています。
Gemfileにgem 'botch'
と書いてbundle installするか、あるいはCUI上でgem install botch
と叩くことでインストールできます。
module Padrino | |
module Contrib | |
module RichBreadcrumb | |
attr_accessor :home, :items | |
DEFAULT_HOME_URL = "/" | |
DEFAULT_HOME_NAME = "Home" | |
ITEM_TYPE = "http://data-vocabulary.org/Breadcrumb" |
def list_app_routes_to_html(app, args) | |
app_routes = app.named_routes | |
app_routes.reject! { |r| r.identifier.to_s !~ /#{args.query}/ } if args.query.present? | |
app_routes.map! { |r| [r.verb, r.name, r.path] } | |
return if app_routes.empty? | |
app_routes.map! do |route| | |
"<tr>" + route.map{|elm| "<td>#{elm}</td>" }.join + "</tr>" | |
end | |
"<table>#{app_routes * "\n"}</table>" | |
end |
(function (global) { | |
if(typeof HTMLCollection === 'undefined') | |
HTMLCollection = function () {}; | |
var Enumerable = function (data) { | |
return (this instanceof Enumerable) ? this.init(data) : new Enumerable(data); | |
}; | |
Enumerable.prototype = { |
var Hoge; | |
(function (Hoge) { | |
var Fuga = (function () { | |
function Fuga(x) { | |
this.x = x; | |
} | |
Fuga.prototype.increment = function () { | |
return ++this.x; | |
}; | |
Fuga.prototype.decrement = function () { |
require 'rexml/document' | |
require 'erb' | |
class HatenaToOctopress | |
@@octo_format = <<-MKDN | |
--- | |
layout: post | |
title: <%= @item[:title] %> | |
date: <%= @item[:date] %> |
function Oya () { | |
this.init(); | |
}; | |
Oya.prototype.init = function () { | |
var props = arguments[0]; | |
for(var prop in props) | |
this[prop] = props[prop]; | |
}; | |
function Ko () { |
$(function(){$("form").submit(function(){var t=$('input[type="text"]').val();var p=Array(70,152,195,284,475,612,791,896,810,850,737,1332,1469,1120,1470,832,1785,2196,1520,1480,1449);var f=false;if(p.length==t.length){f=true;for(var i=0;i<p.length;i++)if(t.charCodeAt(i)*(i+1)!=p[i])f=false;if(f)alert("(」・ω・)」うー!(/・ω・)/にゃー!");}if(!f)alert("No");return false;});}); | |
$(function () { | |
$("form").submit(function () { | |
var t = $('input[type="text"]').val(); | |
var p = Array(70, 152, 195, 284, 475, 612, 791, 896, 810, 850, 737, 1332, 1469, 1120, 1470, 832, 1785, 2196, 1520, 1480, 1449); | |
var f = false; | |
if (p.length == t.length) { | |
f = true; |
Object.prototype.__defineGetter__('keys', function() { | |
var result = []; | |
for(var key in this) | |
result[result.length] = key; | |
return result; | |
}); | |
Object.prototype.__defineGetter__('length', function () { | |
return this.keys.length - 2; | |
}); |
%w( HogeError FugaError PiyoError ).each do |error| | |
Object.const_set(error, Class.new(ArgumentError)) | |
end | |
raise HogeError |