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
# list | |
curl -v http://localhost:3000/organizations.json | |
# create | |
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"organization":{"first_name":"firstname","last_name":"lastname","email":"[email protected]"}}' http://localhost:3000/organizations | |
# read | |
url -v http://localhost:3000/organizations/1.json | |
# update |
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
require 'goliath' | |
require 'em-synchrony/em-http' | |
# After a connect the server streams 10 bomb ticks and then stops with a BOOM. The | |
# event source needs to listen to source.addEventListener 'bomb', .. to retrieve | |
# the ticks. | |
class Stream < Goliath::API | |
def response(env) | |
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
/* Create Database */ | |
DROP SCHEMA IF EXISTS `limits`; | |
CREATE SCHEMA `limits`; | |
USE `limits`; | |
/* Create Tables */ | |
DROP TABLE IF EXISTS `limits`.`users`; | |
DROP TABLE IF EXISTS `limits`.`friends`; | |
DROP TABLE IF EXISTS `limits`.`statuses`; |
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
require 'goliath' | |
require 'eventmachine' | |
require 'em-synchrony' | |
require 'em-synchrony/em-hiredis' | |
class Server < Goliath::API | |
def response(env) | |
@redis = EM::Hiredis.connect | |
@redis.brpop "waiting_for_ever", 0 |
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
class TracksController < ApplicationController | |
# GET /tracks | |
def index | |
@tracks = Track.all | |
render "index" | |
end | |
# GET /tracks/1 | |
def show |
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
class TracksController < ApplicationController | |
# GET /tracks | |
def index | |
@tracks = Track.all | |
Scales.push :html => render("index"), :to => "/tracks" | |
end | |
# GET /tracks/1 | |
def show |
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
require 'scales/up/rails' | |
desc "Scale up the cache" | |
Scales::Up.new do |scales| | |
# Stylesheets | |
scales.push :css, :to => "/assets/application.css?body=1" | |
scales.push :css, :to => "/assets/scaffolds.css?body=1" | |
scales.push :css, :to => "/assets/tracks.css?body=1" | |
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
@html = "<html><head></head><body><p>Hello World</p></body></html>" | |
@xml = "<tracks><track><name>Islandary</name><artist>Thomas Fankhauser</artist></track></tracks>" | |
@json = '[{ name : "Islandary", artist : "Thomas Fankhauser" }]' | |
# Push a HTML | |
Scales.push :html => @html, :to => "/hello" | |
# Push a XML | |
Scales.push :xml => @xml, :to => "/hello.xml" |
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
# HTML Update URLs | |
Scales.update "/", "/tracks", "/overview", :format => :html | |
# XML Update URLs | |
Scales.update "/tracks.xml", "/overview.xml", :format => :xml | |
# JSON Update URLs | |
Scales.update "/tracks.json", "/overview.json", :format => :json |
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
@html = ' | |
<html> | |
<body> | |
<div><h1>Tracks</h1></div> | |
<div id="tracks"> | |
<p id="track1">Track 1</p> | |
</div> | |
</body> | |
</html>' |
OlderNewer