Skip to content

Instantly share code, notes, and snippets.

View lunks's full-sized avatar

Pedro Nascimento lunks

View GitHub Profile
@lunks
lunks / just-refactor.rb
Last active August 1, 2020 14:14
u-case examples/proposals
class User::Create < Micro::Case
attributes :name, :age
def call!
return invalid_user unless valid?
if User.create(name: name, age: age)
Success
else
Failure
@lunks
lunks / usecases_config.rb
Created July 28, 2020 03:47
u-case config proposal
# Feedbacks:
#Remover os níveis extras i.e.
Micro::Case.config do |config|
config.enable_activemodel_validations = true
config.disable_transitions = true
config.disable_the_use_case_access_when_success = true
end
@lunks
lunks / cookie clicker bookmarklet
Last active May 6, 2020 05:38 — forked from met4000/cookie clicker bookmarklet
An autoclick bookmarklet for CC.
query LearnAboutSchema {
__schema {
types {
name
kind
}
queryType {
fields {
name
description
query LearnAboutSchema {
__schema {
types {
name
kind
}
queryType {
fields {
name
description
@lunks
lunks / circle-ci-config.yml
Last active September 4, 2023 21:17
React Native with Expo app publishing in Circle CI
---
version: 2.1
aliases:
- &install_yarn_dependencies
run:
name: Install yarn dependencies
command: yarn install --frozen-lockfile --ignore-engines
- &update_yarn
run:
name: Update yarn
@lunks
lunks / gruvbox-dark.conf
Last active June 25, 2025 18:34
gruvbox-dark theme for kitty - the fast, featureful, GPU based terminal emulator
# gruvbox-dark colorscheme for kitty
# snazzy theme used as base
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
# black
@lunks
lunks / output_with_apollo_proxy
Created October 26, 2017 16:26
Apollo Proxy woes
time="2017-10-26T14:24:42-02:00" level=debug msg="Got to backend... about to start query"
Started POST "/graphql" for ::1 at 2017-10-26 14:24:42 -0200
Processing by GraphqlController#execute as */*
Parameters: {"query"=>"query{organization(id:\"1\"){name}}", "variables"=>{"input"=>{"duration"=>"1h", "imageUrl"=>"google.com", "location"=>"Jedi", "points"=>50, "startedAt"=>"2017-05-12", "title"=>"Woot"}, "organizationId"=>"1"}, "operationName"=>"", "extensions"=>nil, "graphql"=>{"query"=>"query{organization(id:\"1\"){name}}", "variables"=>{"input"=>{"duration"=>"1h", "imageUrl"=>"google.com", "location"=>"Jedi", "points"=>50, "startedAt"=>"2017-05-12", "title"=>"Woot"}, "organizationId"=>"1"}, "operationName"=>"", "extensions"=>nil}}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Completed 200 OK in 3ms (Views: 0.2ms | ActiveRecord: 0.3ms)
time="2017-10-26T14:24:42-02:00" level=debug msg="Capturing trace." bucket=93 isError=true signature="que
@lunks
lunks / implicit_resolver_instrumentation.rb
Last active October 19, 2017 02:28
Implicit Resolver for GraphQL Ruby
class ImplicitResolverInstrumentation
def instrument(_type, field)
implicit_resolver = "Resolvers::#{field.name.camelize}".safe_constantize
if implicit_resolver && default_or_connection_resolver?(field)
field.redefine do
resolve implicit_resolver
end
else
field
@lunks
lunks / resolver.rb
Last active September 5, 2017 14:40
GraphQL resolver example with tests
module Resolvers
class CreateEvent
include Pundit
def self.call(*args)
new(*args).resolve
end
attr_reader :current_user