Skip to content

Instantly share code, notes, and snippets.

@rogerleite
rogerleite / support_to_hal.rb
Created April 24, 2012 19:43
Restfolia: Support to HAL
# 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
@rogerleite
rogerleite / http_multpart.rb
Created April 26, 2012 00:01
HTTP Multpart
################################################################################################################
# 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 / restfolia-restfulie.txt
Created May 26, 2012 01:24
Restfolia - Adapter para migracao do Restfulie
# Restfolia - Restfulie
- Resource Read Write;
- Resource com interface Hash;
- Links com metodos;
- Alias get -> get!;
- Some Alias
## Resource Read Write
Ex:
@rogerleite
rogerleite / .gitconfig
Last active October 5, 2015 20:57
Dot Fucking Files (Home folder)
[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 / hypermedia.md
Created June 12, 2012 14:41
Hypermedia Restful Applications

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 / rql
Created November 28, 2012 18:04
Ruby Query Language *snaky edition*
#!/usr/bin/env ruby
# Ruby Query Language *snaky edition*
# usage: ./rql sample.rql
module RQL
class Context
def self.evaluate(rql_script)
@rogerleite
rogerleite / _wapi_pt-br.md
Created December 19, 2012 17:57
WAPI - Web API Server Spec

WAPI - Web API Server Spec

por Roger Leite - 2012

Table of Contents

  • Web API Server Spec
  • Interfaces
  • Styles
@rogerleite
rogerleite / Gemfile
Last active December 14, 2015 14:38
Tail call optimization in Ruby
source 'https://rubygems.org'
gem "method_source", "~> 0.8.1"
@rogerleite
rogerleite / smeagol.rb
Created March 15, 2013 20:06
Tech talk HTTP Monkey
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 December 16, 2015 19:10
CSV data generator for lazy people like me.
source "https://rubygems.org"
gem "faker", "~> 1.1.2"
gem "uuid", "~> 2.3.7"