Skip to content

Instantly share code, notes, and snippets.

View restebanez's full-sized avatar

Rodrigo Estebanez restebanez

  • mailpoet/automattic
  • Maspalomas
View GitHub Profile
@restebanez
restebanez / develop.webpack.config.js
Created September 29, 2015 14:47
Integration of webpack-dev-server with rails without using CORS, just redirecting in the action_controller.asset_host
/*
/Users/restebanez/mdsol/repos/medistrano/app/views/ecs/_index.html.erb
<%= javascript_include_tag 'wpbundle' %> # <script src='/assets/wpbundle.js'></script> goes wronly to routes.rb
/Users/restebanez/mdsol/repos/medistrano/config/environments/development.rb
config.action_controller.asset_host = Proc.new { |source|
if source =~ /wpbundle\.js$/i
"http://localhost:8080"
end
# First example (the way we do things currently):
module Hello
def greeting
"#{salutation}, #{name}"
end
end
class Husband
include Hello
@restebanez
restebanez / Understanding JSON Web Tokens
Last active November 24, 2016 16:15
Understanding JSON Web Tokens (JWT)
# Understanding JSON Web Tokens (JWT)
## Decoding a JWT
A JWT is formed of three parts separated by a dot: header, payload and signature.
let's explore a real one from a curl request:
>curl -H"authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3NWMyYzkwY2JhNzQxMTg3YjhkOTdkY2NiYmIwNGU3MGNlZmVjYzQifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwic3ViIjoiMTA0MzE5Mzg0OTgxOTM0ODUzODA5IiwiYXpwIjoiNTYyMjgyODc2NjIyLWFqOGdpbWc1M3JmNWcydXYxMzliZG80dmUwdHFudDRnLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZW1haWwiOiJyZXN0ZWJhbmV6QG1kc29sLmNvbSIsImF0X2hhc2giOiJlb3R1R0hvZTloYTZjbHAtZFowMEp3IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF1ZCI6IjU2MjI4Mjg3NjYyMi1hajhnaW1nNTNyZjVnMnV2MTM5YmRvNHZlMHRxbnQ0Zy5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsImhkIjoibWRzb2wuY29tIiwiY19oYXNoIjoiVnRpdUFrbUZBT0JsMXlrT3VyZmltZyIsImlhdCI6MTQyOTc5MTAyMSwiZXhwIjoxNDI5Nzk0NjIxfQ.ivITFQ0BAmWUviY4f_MH2srMFrH1xZM6qFqcN5XZrC9WiidGhpjLMBYIBFH0eBuyRRt_U1GxR4Ko33ivF4jlqDQegcBNWQvbI5uStMk60Nu8w0_YbSr25b_7_pgt0kFrnSKEA_wTlTHhZK2oYJVbvCFAed_qETS-i74-ftXyZ3k" http://localhost:
@restebanez
restebanez / identify javascript types
Last active November 24, 2016 16:15
JavaScript types identification is not straight forward. This gist checks every possible type including primitives and references built-in types
/* Primitive types:
Boolean true or false
Number Any integeror floating-point numeric value
String A character or sequence of characters delimited by either single or double quotes
Null A primitive type that has only one value, null
Undefined A primitive type that has only one value, undefined (undefined is the value assigned to a variable that is not initialize)
*/
/* Primitive Wrapper Types
[#<Cucumber::Formatter::Pretty:0x007fcf840ba0a8 @options=#<Cucumber::Cli::Options:0x007fcf815ee6d0 @out_stream=#<IO:<STDOUT>>, @error_stream=#<IO:<STDERR>>, @default_profile="default", @skip_profile_information=nil, @profiles=["default"], @overridden_paths=[], @options={:strict=>false, :require=>["features/support/base.rb"], :dry_run=>false, :formats=>[["pretty", #<IO:<STDOUT>>]], :excludes=>[], :tag_expressions=>[], :name_regexps=>[], :env_vars=>{}, :diff_enabled=>true, :snippets=>true, :source=>true, :paths=>["features/cloud_definition/cloud_definition_fetch_all.feature"], :tag_expression=>#<Gherkin::TagExpression:0x007fcf8168c560 @ands=[], @limits={}>}, @disable_profile_loading=nil, @quiet=nil, @args=["features/cloud_definition/cloud_definition_fetch_all.feature"], @expanded_args=["features/cloud_definition/cloud_definition_fetch_all.feature", "-r", "features/support/base.rb"], @profile_loader=#<Cucumber::Cli::ProfileLoader:0x007fcf816157d0 @cucumber_yml={"default"=>"-r features/support/base.rb"}, @cucumbe
@restebanez
restebanez / gist:2836309
Created May 30, 2012 13:21
IAM REST specification

IAM REST SPECIFICATION

Base url: /api/v1/iam

Users

Request mimics the aws API, model isn't implemented for IAM yet

REQUEST  | MODEL    | AgiFog  |

UserId | user_id | user_id |