Skip to content

Instantly share code, notes, and snippets.

View jramiresbrito's full-sized avatar
🎯
Focusing

João Victor Ramires Guimarães Brito jramiresbrito

🎯
Focusing
View GitHub Profile
@jramiresbrito
jramiresbrito / calendar.tsx
Created March 18, 2024 14:09 — forked from mjbalcueva/calendar.tsx
shadcn ui calendar custom year and month dropdown
"use client"
import * as React from "react"
import { buttonVariants } from "@/components/ui/button"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "@/lib/utils"
import { ChevronLeft, ChevronRight } from "lucide-react"
import { DayPicker, DropdownProps } from "react-day-picker"
@jramiresbrito
jramiresbrito / rails http status codes
Created March 8, 2024 20:59 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@jramiresbrito
jramiresbrito / postgres_queries_and_commands.sql
Last active October 24, 2025 14:44 — forked from arthurmde/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- check indexes in a table
select *
from pg_indexes
where tablename like 'my_table';
-- Check then statistics were reseted
SELECT stats_reset
FROM pg_stat_database
WHERE datname = current_database();
@jramiresbrito
jramiresbrito / wsl2_android_device_via_wifi_or_usb.md
Last active October 24, 2025 07:46
Connect Android Devices to WSL2 with WIFI or USB

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt update

sudo apt install openjdk-8-jdk-headless
const addHours = (d,h) => d.getTime() + (h * 3600000);
let start = new Date(addHours(new Date(), 1));
let finish = new Date(addHours(start, 8));
const handleHourChange = (startHour) => {
start = new Date();
start.setHours(startHour);
finish = addHours(start, 8);
permittedHours();
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@jramiresbrito
jramiresbrito / rails_with_rspec_mongoid.md
Created February 3, 2021 15:43 — forked from rujmah/rails_with_rspec_mongoid.md
Quick setup for rails/rspec/mongoid spec_helper

dev bit of Gemfile

group :development, :test do
  gem "rspec-rails"
  gem 'capybara'
  gem 'factory_girl_rails'
  gem 'forgery'
  gem "database_cleaner"
  gem "mongoid-rspec"
class CocktailsController < ApplicationController
def index
@cocktails = Cocktail.all
end
def show
@cocktail = Cocktail.find(params[:id])
@dose = Dose.new
@review = Review.new
end
@jramiresbrito
jramiresbrito / api_controller.rb
Created November 28, 2020 09:53
Request test for Category
module Admin::V1
class ApiController < ApplicationController
include Authenticable
def render_error(message: nil, fields: nil, status: :unprocessable_entity)
errors = {}
errors['fields'] = fields if fields.present?
errors['message'] = message if message.present?
render json: { errors: errors }, status: status