GET /syllabi/1 Using wrapper objects
{
"type": "syllabus",
"properties": {
"id": 1,
"title": "Build a Simple Website",
"description": "Smells Like Bakin",
require 'rack' | |
module Rack | |
class ApiVersion | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
end | |
def call(env) |
GET /syllabi/1 Using wrapper objects
{
"type": "syllabus",
"properties": {
"id": 1,
"title": "Build a Simple Website",
"description": "Smells Like Bakin",
require "ostruct" | |
# A base Service Object module. | |
# | |
# Example usage: | |
# | |
# class DoSomething | |
# include Service | |
# def call | |
# puts context.foo |
Cache Marks
An introduction of the pattern of using cache “marks” for use in building cache keys and indicating resource state uniqueness.
A cache mark is a simple value that represents a unique state of a resource or group of resources as a whole or in a particular context. A commonly used (but not referred to as) cache mark is a resource’s updated_at
timestamp. It is updated to the current time when a resource is updated allowing for cache keys that use that mark to automatically invalidate caches based on previous versions of that resource’s mark. In the case of a group of resources a mark may be used to invalidate keys whenever any member of the collection is modified or removed.
Cache marks must be stored separately from the resource itself when:
require 'redis' | |
# This example creates a master-slave setup with a sentinel, then connects to | |
# it and sends write commands in a loop. | |
# | |
# After 30 seconds, the master dies. You will be able to see how a new master | |
# is elected and things continue to work as if nothing happened. | |
# | |
# To run this example: | |
# |
amoslanka:struck.com amoslanka$ cap staging deploy | |
* executing `staging' | |
triggering start callbacks for `deploy' | |
* executing `multistage:ensure' | |
* executing `deploy' | |
* executing `deploy:update' | |
** transaction: start | |
* executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote developer@united.struckaxiom.com:/git_repos/struckaxiom/struckaxiom.com master" |
sudo apt-get update | |
sudo apt-get install build-essential zlib1g-dev git-core curl mysql-server mysql-client | |
# INSTALL RBENV | |
cd ~/ | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
exec $SHELL |
sudo apt-get update | |
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \ | |
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \ | |
build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev | |
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \ | |
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \ | |
/usr/share/man/man1/ruby1.9.1.1.gz \ | |
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \ |
set :sync_directories, ["public/assets", "public/galleries"] | |
set :sync_backups, 3 |
Getting flickr thumbs for 'tcby' | |
Found 13 flickr thumbs | |
Started GET "/work/tcby-store-design" for 192.168.0.24 at 2012-05-01 15:51:49 -0700 | |
Processing by WorkDetailController#index as HTML | |
Parameters: {"id"=>"tcby-store-design"} | |
Category Load (0.3ms) SELECT `categories`.* FROM `categories` ORDER BY name asc | |
Industry Load (0.3ms) SELECT `industries`.* FROM `industries` ORDER BY name asc | |
Campaign Load (0.4ms) SELECT `campaigns`.* FROM `campaigns` WHERE `campaigns`.`live` = 1 AND `campaigns`.`slug` = 'tcby-store-design' LIMIT 1 |