Skip to content

Instantly share code, notes, and snippets.

View rodolfobandeira's full-sized avatar

Rodolfo rodolfobandeira

View GitHub Profile
# A histogram of the words in the King James Bible
[('the', 63919),
('and', 51696),
('of', 34618),
('to', 13560),
('that', 12915),
('in', 12667),
('he', 10420),
('shall', 9837),
@rodolfobandeira
rodolfobandeira / proximo-feriado.go
Last active April 28, 2016 21:15
proximo-feriado
package feriado
import (
"fmt"
"github.com/go-chat-bot/bot"
"github.com/go-chat-bot/plugins/web"
"time"
)
const (
class Foo
@foo = {
'test' => {'test2' => 'test3'},
'test4' => {'test5' => 'test6'},
}
def self.foo?
@foo
end
@rodolfobandeira
rodolfobandeira / php7-docker-debian.md
Created June 8, 2016 19:04
Install and compile PHP with Docker and Debian

docker run -dt —name debian01 debian

docker exec -it debian01 bash

sudo su;cd ~

apt-get update

apt-get install autoconf git make build-essential re2c bison libxml2-dev libssl-dev

@rodolfobandeira
rodolfobandeira / tmux.md
Created June 12, 2016 11:26
TMUX useful commands

Ctrl+b " - split pane horizontally.

Ctrl+b % - split pane vertically.

Ctrl+b arrow key - switch pane.

Hold Ctrl+b , don't release it and hold one of the arrow keys - resize pane.

Ctrl+b c - (c)reate a new window.

#!/usr/bin/env bash
#tmux new-session -d -s rails 'title rails-development; stty -ixon; vim'
cd ~/develop/projs/html5-audio-player-typescript
title oswp
tmux new-session -d -s oswp
# For some reason, send-keys does nothing here, not even an error is displayed.
@rodolfobandeira
rodolfobandeira / README.md
Created September 15, 2016 15:51 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
#!/usr/bin/env ruby
require 'aws-sdk'
sts = Aws::STS::Client.new(
region: 'us-east-1',
access_key_id: "<insert access key id>",
secret_access_key: "<secret>"
)
@rodolfobandeira
rodolfobandeira / README.md
Created November 9, 2016 21:23 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

# https://zvkemp.github.io/blog/2014/04/25/binary-search-trees-in-ruby/
module BinaryTree
class EmptyNode
def to_a
[]
end
def include?(*)
false