This file contains hidden or 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
require 'rack/config' | |
use Rack::Config do |env| | |
env['couch.users'] = 'http://localhost:5984/users' | |
end | |
use MyAuthMiddleware # needs users | |
run MyApp # also needs users |
This file contains hidden or 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
gem install rack-config |
This file contains hidden or 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
sudo gem install cloudkit |
This file contains hidden or 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
require 'cloudkit' | |
expose :notes, :projects |
This file contains hidden or 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
thin -R config.ru start |
This file contains hidden or 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
require 'cloudkit' | |
contain :notes, :projects |
This file contains hidden or 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
# The CloudKit 0.9.x way to list resources in a collection -- | |
# Still valid and useful... | |
$ curl -i http://localhost:9292/notes | |
HTTP/1.1 200 OK | |
Last-Modified: Sat, 10 Jan 2009 00:12:52 GMT | |
ETag: "c01f6230a8c40a2576b6f35f32f966ab" | |
Link: <http://localhost:9292/notes/_resolved>; rel="http://joncrosby.me/cloudkit/1.0/rel/resolved" | |
Cache-Control: proxy-revalidate | |
Content-Type: application/json |
This file contains hidden or 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
# A Sinatra App as a Rails Plugin | |
# | |
# In your Edge Rails app: | |
# | |
# ruby script/plugin install git://gist.github.com/50625.git | |
require 'sinatra/base' | |
class SinatraRailsPlugin < Sinatra::Base | |
This file contains hidden or 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
require 'cloudkit' | |
# use the default in-memory store | |
CloudKit.setup_storage_adapter | |
# create a resource in the 'items' collection | |
resource = CloudKit::Resource.create( | |
CloudKit::URI.new('/items'), | |
JSON.generate({:foo => 'bar'})) | |
This file contains hidden or 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
// Assuming a CloudKit app hosting "notes" and "things" collections: | |
var store = $.cloudkit; | |
store.boot({ | |
success: function() { | |
// insert a 'thing' | |
store.collection('things').insert({name:"box"}, { | |
success: function(index) { | |
// do something with your data | |
} |
OlderNewer