Skip to content

Instantly share code, notes, and snippets.

View thiago-sydow's full-sized avatar

Thiago von Sydow thiago-sydow

View GitHub Profile
@thiago-sydow
thiago-sydow / estados-cidades.json
Created May 15, 2020 13:58 — forked from letanure/estados-cidades.json
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
### Keybase proof
I hereby claim:
* I am thiago-sydow on github.
* I am thiago_sydow (https://keybase.io/thiago_sydow) on keybase.
* I have a public key ASCAI1wzY2GpDBbbRVS6fisyYm9ph0GfQ9i_3F7YYS0yfwo
To claim this, I am signing this object:
@thiago-sydow
thiago-sydow / users_policy.rb
Created December 26, 2017 16:01
Files used in the Medium post about Field Instrumentation
class UsersPolicy < ApplicationPolicy
class Scope < Scope
  attr_reader :user, :scope
def initialize(user, scope)
  @user = user
 @scope = scope
  end
def resolve
@thiago-sydow
thiago-sydow / organization_type.rb
Created December 26, 2017 15:58
Files used in the Medium post about Field Instrumentation
OrganizationType = GraphQL::ObjectType.define do
name "Organization"
field :members, types.[UserType], "Members of the organization" do
scoped_collection(policy_class: UsersPolicy)
resolve ->(obj, args, ctx) {
obj.members_dataset
}
end
@thiago-sydow
thiago-sydow / scoped_collection.rb
Last active December 26, 2017 15:53
Files used in the Medium post about Field Instrumentation Raw
def authorization_proc(field)
permission = field.metadata[:scoped_collection]
original_resolve_proc = field.resolve_proc
->(obj, args, ctx) {
initial_scope = original_resolve_proc.call(obj, args, ctx)
scope = permission[:policy_class]::Scope.new(ctx[:current_user], initial_scope)
resolved = scope.resolve
@thiago-sydow
thiago-sydow / query_type.rb
Created December 26, 2017 15:39
Files used in the Medium post about Field Instrumentation
QueryType = GraphQL::ObjectType.define do
name "Query"
description "The root query for the Impraise GraphQL Schema"
field :organization do
type OrganizationType
description "Lookup an `Organization` by id"
access_permission(policy_class: OrganizationsPolicy, action: :load?)
argument :id, !types.Int, "Organization id"
@thiago-sydow
thiago-sydow / schema.rb
Last active December 26, 2017 15:40
Files used in the Medium post about Field Instrumentation
GraphQL::Field.accepts_definitions(
access_permission: GraphQL::Define.assign_metadata_key(:access_permission)
)
Schema = GraphQL::Schema.define do
...
instrument(:field, FieldAuthorization.new)
...
end
@thiago-sydow
thiago-sydow / field_authorization.rb
Last active December 26, 2017 15:51
Files used in the Medium post about Field Instrumentation
class FieldAuthorization
def instrument(_type, field)
return field if field.metadata[:access_permission].blank?
resolve_proc = authorization_proc(field)
# Return a copy of `field`, with a new resolve proc
field.redefine do
resolve(resolve_proc)
end
@thiago-sydow
thiago-sydow / index.markdown
Last active September 30, 2022 12:45
Integrações RD Station - Wordpress e Contact Form 7

Integrações RD Station

Wordpress e Contact Form 7

Para as pessoas que usam o Wordpress como ferramenta de gerenciamento de conteúdo do seu site, e também a facilidade do plugin Contact Form 7 para criar formulários, a integração com RD Station fica bem simples.

Ainda não conhece o Contact Form 7

Se você ainda não tem tanta familiaridade com o plugin Contact Form 7, veja alguns tutoriais: http://www.webmaster.pt/como-criar-formulario-wordpress-contact-form-7-parte1-12914.html#post-12914 http://www.comocriarmeusite.com.br/wordpress-2/formulario-de-contato-no-wordpress-contact-form-7/#middle-post

@thiago-sydow
thiago-sydow / index.markdown
Last active October 13, 2015 18:08 — forked from pedrobachiega/index.markdown
Integrações RD Station - HTML puro

Integrações RD Station

HTML Puro

Para quem não tem conhecimento técnico, a integração via HTML Puro é a mais simples de integrar ao RD Station. Mas, infelizmente, ainda é preciso fazer algumas pequenas modificações no seu arquivo HTML.

Usando a API

Quatro coisas são necessárias editar/adicionar na sua página para a integração funcionar: