forked from maccman/book-assets
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
17,555 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011 Alex MacCaw (info@eribium.org) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Spine | ||
|
||
__Spine is a lightwork framework for building JavaScript web applications.__ Spine gives you a MVC structure and then gets out of your way, allowing you to concentrate on the fun stuff, building awesome web applications. | ||
|
||
Spine is tiny, the library comes in at around 500 lines of JavaScript, that's about 2K minified & compressed. However, it's not about size, it's how you use it, and Spine certainly packs a punch! | ||
|
||
For documentation, usage, and examples, see: [http://maccman.github.com/spine](http://maccman.github.com/spine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require "rdiscount" | ||
|
||
task :generate do | ||
text = File.read("site/site.md") | ||
html = RDiscount.new(text).to_html | ||
File.open("index.html", "w+") do |io| | ||
io.write(%{ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="charset" content="utf-8"> | ||
<title>Spine</title> | ||
<link rel="stylesheet" href="site/site.css" type="text/css" charset="utf-8"> | ||
<link rel="stylesheet" href="site/highlight.css" type="text/css" charset="utf-8"> | ||
<script src="site/jquery.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="spine.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="site/highlight.js" type="text/javascript" charset="utf-8"></script> | ||
<script type="text/javascript" charset="utf-8"> | ||
hljs.initHighlightingOnLoad(); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="container">#{html}</div> | ||
</body> | ||
</html> | ||
}) | ||
end | ||
end | ||
|
||
task :build do | ||
require "yui/compressor" | ||
require "fileutils" | ||
|
||
compressor = YUI::JavaScriptCompressor.new(:munge => true) | ||
File.open("spine.min.js", "w+") do |output| | ||
File.open("spine.js", "r") do |input| | ||
compressor.compress(input) do |compressed| | ||
while buffer = compressed.read(4096) | ||
output.write(buffer) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
task :default => :generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="jquery.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../spine.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../lib/spine.history.js" type="text/javascript" charset="utf-8"></script> | ||
|
||
<script type="text/javascript" charset="utf-8"> | ||
var Users = Spine.Controller.create({ | ||
init: function(){ | ||
this.navigate("/users", 1); | ||
}, | ||
|
||
active: function(number){ | ||
console.log("active", number) | ||
} | ||
}); | ||
|
||
// Add routes in App controller | ||
var App = Spine.Controller.create({ | ||
init: function(){ | ||
this.users = Users.init(); | ||
this.routes({ | ||
"/users/:number": function(num){ | ||
this.users.active(num); | ||
}, | ||
"/users/*glob": function(any){ | ||
console.log('any', any); | ||
} | ||
}); | ||
} | ||
}).init(); | ||
|
||
// Add routes manually | ||
|
||
// Add a group of routes | ||
Spine.History.add({ | ||
"/groups/:id": function(id){ | ||
console.log('groups id', id) | ||
} | ||
}); | ||
|
||
// More generic routes added last | ||
|
||
// Use your own regex | ||
Spine.History.add(/\/groups(\/)?/, function(){ | ||
console.log('groups') | ||
}); | ||
|
||
// Fire event on load | ||
Spine.History.change(); | ||
</script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.