Skip to content

Instantly share code, notes, and snippets.

@pete
pete / gist:14690
Created October 4, 2008 01:17 — forked from prem/gist:14688
require 'net/http'
urls = %w(
http://irvsrdves3.flight.yellowpages.com:8080/smm/ypc?field=city_state_business&imei=353763.01541827.6&grammar=/data1/lm/test.lm
http://research.yellowpages.com:8080/smm/ypc?field=city_state_business&imei=353763.01541827.6&grammar=/data1/lm/test.lm
)
urls.each { |url|
puts url
uri = URI.parse url
; A thing:
'a
; Some things:
'*b
; A thing with criteria:
'(int? c)
; Some things with criteria:
'(int? *d)
; At least x things, no more than y things:
'(true *f (x y))
module MyLayout
def show(&b)
doctype
html {
head {
link :rel => 'stylesheet', :href => '/stylesheets/site.css'
script :src => '/js/jquery.js'
}
body(:onload => 'return true;') {
class Trivial < Hoshi::View :html4
def show
doctype
html {
head {
title "Hello, world!"
link :rel => 'stylesheet', :href => '/css/hoshi.css'
}
body {
diff --git a/bin/waves b/bin/waves
index 3b5d1ec..f94694a 100755
--- a/bin/waves
+++ b/bin/waves
@@ -9,14 +9,21 @@ WAVES = "#{File.dirname(__FILE__)}/.." unless defined? WAVES
waves = [
WAVES, ENV['WAVES'], './waves'
-].compact.map { |dir| File.join(dir, 'lib') }.find( &File.method( :directory? )
+].compact.map { |dir| File.join(dir, 'lib') }.find { |d|
require 'hoshi'
class Vizziew < Hoshi::View(:html4)
def almost_blank_page
doc {
head { title "test" }
body { h1 "test" }
}
end
end
@pete
pete / gist:29245
Created November 26, 2008 02:42 — forked from ab5tract/gist:29216
def require(lib)
@paths ||= []
return false if @paths.include?(lib)
$:.each { |path|
['','.rb','.so'].each { |ext|
l = "#{path}/#{lib}#{ext}"
if File.exist?(l)
@paths << l
load l
return true
require 'hoshi'
module ClaudeHw
module Resources
class UsesHoshi < Default
on(:get, true) {
Hoshi::View(:html4) {
doc {
head { title "Hello, World!" }
body {
roboto-repl > (def l (*a (id *b 3) *c) (list a b c))
(lambda (*a (id *b 3) *c) (list a b c))
roboto-repl > (l nil nil nil 5 6 7 8 nil nil)
((() () () 5) (6 7 8) (() ()))
rake test
(in /home/pete/proj/waves)
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
Matching The Accepts Header
- Match an implied accept header using the file extension
- Match against an array of options
- Match against a Mime type (rather than subtype)
Matching Request Methods
- Match the 'get' method