Skip to content

Instantly share code, notes, and snippets.

View giljr's full-sized avatar
💭
Full Stack Developer with a degree in Computer Engineering.

Gilberto Oliveira Jr giljr

💭
Full Stack Developer with a degree in Computer Engineering.
View GitHub Profile
Feature Turbo Stream Direct Turbo Frame Button Turbo with Respond Turbo with AJAX
Server Interaction Turbo Stream Frame Targeted Respond Block AJAX Polling
Response Format Turbo Stream Frame Partial Turbo Stream Turbo Stream (AJAX)
Use Case Simple Updates Button Actions Multi-Format APIs Real-Time Updates
@giljr
giljr / Global Id Rails Feature
Last active January 15, 2025 16:21
Nice token Creation o RAILS - https://github.com/rails/globalid
> user.signed_id
=> "eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoidXNlciJ9fQ--4ef38fa58e98da155800151c24727be385e0c0bd628b492ff4813bd25862902e"
> user.to_global_id.to_s
=> "gid://ytm/User/1"
> user.signed_id(expires_in: 15.minutes)
=> "eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNS0wMS0xNVQxNjoyMToyMy4wNTRaIiwicHVyIjoidXNlciJ9fQ--6b20835c13452b287dbf5b89a3a477edaa2ea356827d26adea0749a3277b9c12"
> user.signed_id(expires_in: 15.minutes, purpose: "password_reset")
@giljr
giljr / session_manager.html.erb
Created January 14, 2025 15:18
A Cool Session Manager Rails Partial
<% if true %>
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
User Functionality
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<%= link_to "Action", "#", class: "dropdown-item" %>
<div class="dropdown-divider"></div>
<%= button_to "Sign out", "#", method: :delete, class: "dropdown-item" %>
@giljr
giljr / docker_cmds
Last active September 29, 2024 21:53
Docker Commands
[Ubuntu Version]
release --version
lsb_release -a
[Install Docker]
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
PREFIX VERB URI patters Interface
new_user_session GET /users/sign_in Sign In (Login)
destroy_user_session DELETE /users/sign_out Sign Out
new_user_registration GET /users/sign_up Sign Up
edit_user_registration GET /users/edit Edit Account
/*Project:
47_UNIR_tls2561_Light_to_Digital_converter_v1.ino
Link: [TODO: LINK TO JUNGLETRONICS GOES HERE]
Objective:
This code demonstrates how to initialize and read data from the TSL2561
light sensor module over the I2C bus, providing insight into the ambient
light conditions in terms of Full Spectrum, Infrared, and Visible light.
It is designed to work with the TSL2561_I2CS I2C Mini Module GY2561.
It uses a chip TSL2561 which is a 16-bit digital I2C light sensor from
/*Project:
46_UNIR_NEMA17_12VDC_multi_test_code.ino
Link: https://medium.com/jungletronics/nema-17-stepper-motor-test-1d05aec10f91
Objective:
This code allows you to control the NEMA 17 stepper motor in different
micro-stepping modes (full, half, quarter, eighth, sixteenth, and thirty second steps).
It was developed during the N.A.V.E TECH UNIR Samsung Eletrônica da Amazônia LTDA
In Porto Velho - RO - Brazil, Course from November 2023 to April 2024.
The project was supervised by Professor Dr. Ciro José Egoavil Montero
/*Project:
44_UNIR_28BYJ48_12VDC_test_code.ino
Link: https://medium.com/jungletronics/28byj-48-12-v-stepper-motor-test-fbaa972dfea5
Objective:
This code allows you to control the 28BYJ-48 stepper motor in different
micro-stepping modes (full, half, quarter, eighth, and sixteenth steps).
The thirty-second step mode did not work, so it is commented out.
It was developed during the N.A.V.E TECH UNIR Samsung Eletrônica da Amazônia LTDA
In Porto Velho - RO - Brazil, Course from November 2023 to April 2024.
/*Project:
43_UNIR_EEPROM24LC256v2.ino
Link: https://medium.com/jungletronics/eeprom-24lc256-reading-and-writing-arduino-sketch-bdfb6e5a3b13
Objective:
Reading and Writing Integers and Longs to EEPROM. See Project #42.
It was developed during the N.A.V.E TECH UNIR Samsung Eletrônica da Amazônia LTDA
In Porto Velho - RO - Brazil, Course from November 2023 to April 2024.
The project was supervised by Professor Dr. Ciro José Egoavil Montero
(https://www.linkedin.com/in/ciro-j-egoavil-210b7a44/?originalSubdomain=br),
/*Project:
42_UNIR_EEPROM24LC256v1.ino
Link: https://medium.com/jungletronics/eeprom-24lc256-reading-and-writing-arduino-sketch-bdfb6e5a3b13
Objective:
Reads and writes bytes to and from EEPROM.
Checks 24LC256 external EEPROM is connected.
Basic script to read and write to EEPROM.
It was developed during the N.A.V.E TECH UNIR Samsung Eletrônica da Amazônia LTDA
In Porto Velho - RO - Brazil, Course from November 2023 to April 2024.