Skip to content

Instantly share code, notes, and snippets.

View ddanielsantos's full-sized avatar

Daniel Santos ddanielsantos

  • Fadesp
  • Belém - PA - Brazil
  • 23:22 (UTC -03:00)
  • X @renat0sp
View GitHub Profile
  • warp
  • obrstack
  • fig
  • raycast
# This script is meant to copy some files to a folder inside my sdcard
# it has some requirements:
# - adb installed (https://developer.android.com/studio/releases/platform-tools?hl=pt-br#downloads)
# - download and extract it, the .exe file will be inside, you can add this folder to
# the PATH variable
# - an android device with usb debug enabled
# Here, 3836-6631 its how adb recognizes my sdcard,
# if you want to use the internal storage, you can change to "emulated/0".
@ddanielsantos
ddanielsantos / CommentRecurso.java
Created February 1, 2023 21:02
due to the second method's argument, it skips the ControllerAdvice's error handling.
@RequestMapping(value = "/comments", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<?> createComment(@RequestBody @Valid CommentForm body, BindingResult errors ) {
// if (errors.hasErrors()) {
// HashMap<String, List<String>> res = new HashMap<>();
//
// List<String> errorList = errors
// .getFieldErrors()
// .stream()
// .map(DefaultMessageSourceResolvable::getDefaultMessage)
@ControllerAdvice
class ValidationHandler extends ResponseEntityExceptionHandler {
@Override
@ResponseBody
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException ex,
HttpHeaders headers,
HttpStatus status,
WebRequest request
class CommentForm implements Serializable {
private String value;
@NotEmpty(message = "please provide a value dude")
public String getValue() {
return this.value;
}
}
@ddanielsantos
ddanielsantos / combobox_repro.tsx
Created November 8, 2022 15:36
reproduction that triggers Maximum update depth exceeded on ariakit version: 2.0.0-next.41, when using a Combobox inside other two Ariakit components
import {
useSelectState,
Select,
SelectPopover,
SelectItem,
} from 'ariakit/select'
import {
Dialog,
DialogHeading,
DialogDismiss,

step 1

checkout01

step 2

checkout02

step 3

checkout03

@ddanielsantos
ddanielsantos / dockerLearnPath.md
Created September 9, 2022 12:22 — forked from sibelius/dockerLearnPath.md
Docker Learn Path - What do you need to know about Docker
  • learn why we need docker
  • learn how to define a Dockerfile
  • learn how to build a docker
  • learn how to list images
  • learn how to run docker with port forward
  • learn how to go inside docker to debug, running /bin/bash
  • learn docker compose
  • learn how to send a docker image to a reqistry (dockerhub or aws ecr)
  • learn how to deploy a docker to kubernetes, aws ecs or another platform
  • learn how to use docker volumes
@ddanielsantos
ddanielsantos / toggle-theme.lua
Created August 26, 2022 22:37
toggle light/dark on LunarVim
lvim.keys.normal_mode["<leader>t"] = ":lua ToggleTheme() <cr>"
function ToggleTheme()
if (vim.api.nvim_get_option("background") == "dark") then
vim.api.nvim_command("set background=light")
else
vim.api.nvim_command("set background=dark")
end
end