Skip to content

Instantly share code, notes, and snippets.

View boniattirodrigo's full-sized avatar

Rodrigo Boniatti boniattirodrigo

View GitHub Profile
@boniattirodrigo
boniattirodrigo / README.md
Created November 22, 2022 21:40 — forked from jesster2k10/README.md
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@boniattirodrigo
boniattirodrigo / iterm2-solarized.md
Created January 12, 2020 19:50 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@boniattirodrigo
boniattirodrigo / primitive-reference-types-javascript.md
Created March 10, 2018 13:28 — forked from branneman/primitive-reference-types-javascript.md
Primitive Types & Reference Types in JavaScript

Primitive Types & Reference Types in JavaScript

An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.

Facts

  • JavaScript has 2 kinds of variable types: primitive and reference.
  • A fixed amount of memory is reserved after creation of every variable.
  • When a variable is copied, it's in-memory value is copied.
  • Passing a variable to a function via a call also creates a copy of that variable.

Primitive Types

@boniattirodrigo
boniattirodrigo / rails-patterns.md
Last active November 27, 2019 14:16
Rails patterns

Rails patterns

Patterns

Decorator: Usado em views.

Helpers: Usado em controllers (São comportilhados com toda a aplicação).

Serializers: Retorna a instância serializada em JSON.

Concerns: Reutilização de models e controllers entre múltiplos domínios.

@boniattirodrigo
boniattirodrigo / login.js
Created June 25, 2017 18:44
A simple process to get, store and delete values from AsyncStorage.
import React, { Component } from 'react'
import {
View,
AsyncStorage,
TouchableHighlight,
Text,
StyleSheet,
} from 'react-native'
@boniattirodrigo
boniattirodrigo / example-of-using-scroll-view-props.js
Created March 2, 2017 02:25
Example of using ScrollView props
<ScrollView
horizontal={true}
pagingEnabled={true}>
@boniattirodrigo
boniattirodrigo / styling-react-native-component.js
Created March 2, 2017 02:18
Styling React Native component
<Text style={{
padding: 20,
fontSize: 16,
backgroundColor: 'red',
}}>
@boniattirodrigo
boniattirodrigo / using-react-native-component.js
Created March 2, 2017 02:16
Using React Native component
import {
Text,
ScrollView,
} from 'react-native';
class Carousel extends Component {
render() {
return (
<ScrollView>
<Text>Lorem ipsum...</Text>
import {
Text,
View,
ListView,
ScrollView,
Image,
// . . .
} from 'react-native';