Skip to content

Instantly share code, notes, and snippets.

@rogerleite
rogerleite / smeagol.rb
Created Mar 15, 2013
Tech talk HTTP Monkey
View smeagol.rb
require "avc"
require "fileutils"
Donkey = HttpMonkey.build do
storage AVC::HttpClient::FileStore.new(File.expand_path("~/.avc/donkey"))
middlewares.use AVC::HttpClient::M::CacheByEtag
end
puts "# Smeagol Assistant\n"
@rogerleite
rogerleite / Gemfile
Last active Dec 14, 2015
Tail call optimization in Ruby
View Gemfile
source 'https://rubygems.org'
gem "method_source", "~> 0.8.1"
@rogerleite
rogerleite / _wapi_pt-br.md
Created Dec 19, 2012
WAPI - Web API Server Spec
View _wapi_pt-br.md

WAPI - Web API Server Spec

por Roger Leite - 2012

Table of Contents

  • Web API Server Spec
  • Interfaces
  • Styles
@rogerleite
rogerleite / rql
Created Nov 28, 2012
Ruby Query Language *snaky edition*
View rql
#!/usr/bin/env ruby
# Ruby Query Language *snaky edition*
# usage: ./rql sample.rql
module RQL
class Context
def self.evaluate(rql_script)
@rogerleite
rogerleite / nginx.conf
Created Aug 2, 2012
Configuração Nginx
View nginx.conf
user www-data;
worker_processes 4;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
@rogerleite
rogerleite / hypermedia.md
Created Jun 12, 2012
Hypermedia Restful Applications
View hypermedia.md

Hypermedia Restful Applications

The Web as an application Platform

The [architectural simplicity from Web][webarch] plus the use of a widely implemented protocol (HTTP), it's a great platform for an ecosystem of services.

REST - Getting started

REpresentational State Transfer, describe Web as distributed hypermedia application whose linked resources communicate by exchanging representations of resource state. (from [Chapter 1 - Rest in Practice Book][Rest in Practice])

@rogerleite
rogerleite / .gitconfig
Last active Oct 5, 2015
Dot Fucking Files (Home folder)
View .gitconfig
[user]
name = Roger Leite
email = roger.barreto@gmail.com
[core]
editor = mvim
excludesfile = /Users/Roger/.gitignore
[color]
diff = auto
interactive = auto
status = auto
@rogerleite
rogerleite / restfolia-restfulie.txt
Created May 26, 2012
Restfolia - Adapter para migracao do Restfulie
View restfolia-restfulie.txt
# Restfolia - Restfulie
- Resource Read Write;
- Resource com interface Hash;
- Links com metodos;
- Alias get -> get!;
- Some Alias
## Resource Read Write
Ex:
View http_multpart.rb
################################################################################################################
# Criando uma imagem
################################################################################################################
imagens_entry_point = Restfulie.at(IMAGENS_ENTRY_POINT).get
nova_imagem = imagens_entry_point.links.nova_imagem.get
nova_imagem.imagem.original = "cid:original" #Identificador da imagem na parte não json da requisição, veja a especificação de multpart para mais detalhes (http://www.faqs.org/rfcs/rfc2387.html)
nova_imagem.imagem.marca = "Alexandria"
nova_imagem.imagem.titulo = "alexandria logo"
@rogerleite
rogerleite / support_to_hal.rb
Created Apr 24, 2012
Restfolia: Support to HAL
View support_to_hal.rb
# Run this sample from root project:
# $ ruby samples/support_to_HAL.rb
require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
# HAL from http://stateless.co/hal_specification.html
json_hal = <<-JSON