Skip to content
Browse files

Cleaning up.

Closes #66
  • Loading branch information...
1 parent 9e009ff commit a0163a590c3c7c50479cba131da5c79ce2e993ee @steveklabnik steveklabnik committed Dec 21, 2010
View
1 app/boot.rb
@@ -13,7 +13,6 @@ def HH.anonymous_binding
end
require 'lib/all'
-require 'app/web/all'
require 'app/syntax/markup'
require 'app/db/sequel'
View
2 app/db/http.rb
@@ -1,4 +1,4 @@
-require 'app/web/yaml'
+require 'lib/web/yaml'
module HH::Sequel
module HTTP
View
3 app/web/all.rb
@@ -1,3 +0,0 @@
-require 'app/web/channel'
-require 'app/web/hacker'
-require 'app/web/web'
View
70 app/web/channel.rb
@@ -1,70 +0,0 @@
-# website integration
-
-require 'app/web/yaml'
-
-def Channel(name)
- Hacker('username'=> '_why').channel(name)
-end
-
-class Channel
- include HH::YAML
-
- attr_reader :owner, :name
-
- def initialize(owner, name)
- @owner = owner
- @name = name
- @since = 0
- @received = {}
- end
- def inspect
- "(Channel #{@owner}'s #{@name})"
- end
- def start &blk
- http('POST', '/channels', :title => @name, :who => @owner, &blk)
- self
- end
- def hear &blk
- return if @hear
- @hear = http('GET', "/channels/#@name", :since => @since, :who => @owner) do |objs|
- begin
- objs = objs.map do |m|
- next if @received[m["id"]]
- t = m["at"].to_i
- @since = t if t > @since
- @received[m["id"]] = true
- begin
- m["said"] = YAML.load(m["object"])
- Message.new(m)
- rescue
- nil
- end
- end
- if blk
- objs.compact.
- sort_by { |x| x.at }.
- each do |x|
- blk[x]
- end
- end
- rescue
- end
- @hear = nil
- end
- self
- end
- def say obj
- http('PUT', '/channels/' + @name, :who => @owner, :post => YAML.dump(obj))
- self
- end
-
- class Message
- attr_reader :said, :hacker, :at, :id
- def initialize(opts = {})
- @said = opts['said']
- @hacker = Hacker(opts['hacker'])#, 'chunky_bacon')
- @at = opts['at']
- @id = opts['id']
- end
- end
-end
View
2 lib/all.rb
@@ -1,7 +1,9 @@
+require 'lib/web/all'
require 'lib/dev/init'
require 'lib/art/turtle'
require 'lib/enhancements'
require 'lib/dev/errors'
require 'lib/dev/events'
require 'lib/dev/stdout'
+
View
2 lib/web/all.rb
@@ -0,0 +1,2 @@
+require 'lib/web/hacker'
+require 'lib/web/web'
View
2 app/web/hacker.rb → lib/web/hacker.rb
@@ -1,6 +1,6 @@
# website integration
-require 'app/web/yaml'
+require 'lib/web/yaml'
def Hacker name
Hacker.new name
View
0 app/web/web.rb → lib/web/web.rb
File renamed without changes.
View
0 app/web/yaml.rb → lib/web/yaml.rb
File renamed without changes.
View
41 todo.txt
@@ -1,41 +0,0 @@
-Hackety Hack
-============
-
-* Go through the whole thing
-* Look for issues
-* Log them
-* See if can fix any of them
-* Play with shoes
-
-Hackety Hack Problems:
-
-* Mac
-
-* Windows
- - when hover over the x button in the sidebar, the word "Close" is cut off
- - when enter text wherever, pipe symbols follow the cursor
- - actually, it seems like it is ghosting the text
-* Linux
-* All
- - lesson 1.13 Counting
- - the example here is a little dumb
- - "your name has #{x} letters"
- - lesson 2.2, 2.3 etc.
- - saving the files to .hacketyhack sucks on a mac
- - how does a newbie find that?
- - I understand you are trying to show the kids how that works, but maybe that's a different thing?
- - maybe ask_save_file is the thing to do here
- - some kind of weird highlighting/select that I can't get rid of
-
-
-* Shoes
-
-Hackety Hack Suggestions:
--------------------------
-
-* Can the displayed program not go over the black area, so you can read the lesson as the program runs?
-
-* Can we copy from the lesson? eg. 2.3 Running the Program, being able to copy the url would be nice.
-
-
-
View
99 turtle-graphics
@@ -1,99 +0,0 @@
-Turtle Graphics support (http://en.wikipedia.org/wiki/Turtle_graphics)
-
-Turtle code can be run from the HacketyHack editor, two modes are available:
-
-1. interactive mode, allowing step by step execution
-
-Turtle.start do
- # turtle code here
-end
-
-
-2. drawing mode that execute the whole code at once
-
-Turtle.draw do
- # turtle code here
-end
-
-
-== Available Commands ==
-penup
-after this command gets called the pen is up and nothing is drawn
-
-pendown
-after this command the pen is dawn and lines are drawn as the turtle moves
-
-pendown?
-returns true if the pen is down, (default is true)
-
-pensize x
-set the width of the line drawn by the turtle to x
-
-pencolor c
-set the color of the line drawn by the turtle to c, use the shoes color system
-
-background c
-set the background color to c, use the shoes color system
-
-forward x
-moves the turtle forward by x pixels
-when no options are given a default argument of 50 pixels is used
-
-backward x
-moves the turtle forward by x pixels, equivalent to forward -x
-when no options are given a default argument of 50 pixels is used
-
-turnleft a
-turns the turtle heading a degrees to the left, default heading is 0 degrees
-when no options are given a default argument of 90 degrees is used
-
-turnright a
-turns the turtle heading a degrees to the right, equivalent to turnleft -a
-when no options are given a default argument of 90 degrees is used
-
-setheading a
-sets the current heading to a
-
-getheading
-retuns the current heading in degrees
-
-setx x
-moves the turtle horizontally to (current_y, x)
-doesn't draw anything
-
-sety y
-moves the turtle vertically to (y, current_x)
-doesn't draw anything
-
-goto x, y
-moves the turtle to (x, y)
-doesn't draw anything
-
-getposition
-retuns [x, y] (as an array)
-
-clear
-removes all content (but does not change the turtle attributes)
-
-reset
-removes all content and resets all attributes (including turtle position)
-
-
-
-== Example ==
-
-
-Turtle.start do
- background blue
- pensize 2
- pencolor yellow
- 30.times do
- goto rand(width), rand(height)
- setheading rand(360)
- len = 5 + rand(30)
- 5.times do
- forward len
- turnleft 180-360/10
- end
- end
-end

0 comments on commit a0163a5

Please sign in to comment.
Something went wrong with that request. Please try again.