Skip to content

Instantly share code, notes, and snippets.

View guiocavalcanti's full-sized avatar

Guilherme Cavalcanti guiocavalcanti

View GitHub Profile

Download and access the cluster

The linux kubectl binary can be fetched with a command like:

  curl -O https://storage.googleapis.com/kubernetes-release/release/v1.4.5/bin/linux/amd64/kubectl

On an OS X workstation, replace linux in the URL above with darwin:

Other name

To get started enter a title for your note above. When you’re ready to save your note just use Vim’s :write or :update commands, a filename will be picked automatically based on the title.

def method
   puts "foo"
end
{
"took":47,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"failed":0
},
"hits":{
"total":159215,

Benchmark Bundler

Because loading gems can take longer than you think

$ curl -fsSL https://gist.github.com/raw/5022636/benchmark.rb | ruby
............................................................[DONE]

Gem                            Time(sec)     Pct %
--------------------------------------------------
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
class UserBuilder < Untied::Consumer::Observer
observe :user, :from => "social-network"
def build(attrs)
LeanUser.new(external_id: attrs[:id], name: attrs[:first_name])
end
alias_method :after_create, :build
end
.data
entrada: .asciiz "acd"
nextline: .asciiz "\n"
.text
main:
addi $t0, $zero, 0 # Inicializa contador ($t0) com 0, just in case.
change_case:
lb $t1, entrada($t0) # Armazena caractere em $t1
beq $t1, 0, sort # Sai do loop change_case se entrada[$t0] for 0
"links": [
{
"rel": "self",
"href": "http://www.redu.com.br/api/subjects/4723"
},
{
"rel": "lectures",
"href": "http://www.redu.com.br/api/subjects/4723/lectures"
},
{
import java.util.Scanner;
import wrapper.Management;
public class main {
/**
* @param args
*/
@guiocavalcanti
guiocavalcanti / gist:5577847
Last active December 17, 2015 08:09
Projeto da disciplina Engenharia de Sw. Educativo

Descrição de Projeto: encapsuladores

Este projeto consiste na criação de um encapsulador para a API REST do Mural do Redu.

O que é um encapsulador?

Encapsuladores (para APIs REST), também conhecidos como wrappers, são bibliotecas que abstraem detalhes de rede na comunicação com serviços terceiros.

Por exemplo, para criar um post no mural de um usuário no Redu é necessário realizar uma requisição HTTP do tipo POST para a URL http://redu.com.br/api/users/:user_id/statuses passando-se como payload o seguinte json: