Skip to content

Instantly share code, notes, and snippets.

View robsonkades's full-sized avatar
🎯
Focusing

Robson Kades robsonkades

🎯
Focusing
View GitHub Profile
@robsonkades
robsonkades / Image.tsx
Created September 14, 2021 00:48
Integrate NextJs `next/image` with Chakra-UI styling
import { chakra, ThemingProps, useStyleConfig } from '@chakra-ui/react'
import NextImage, { ImageProps as NextImageProps } from 'next/image'
import { ReactElement } from 'react'
import { Sizes } from '../../theme/variables/image'
// TODO review props when NextJs is updated so we don't have to defined it here
/**
* ? Because NextJs typing is preventing auto-suggest for layout, width and height,
* ? we declare the styles differently in this component and will manage the switch
* ? to NextJs typings when calling NextJs `next/image` component
import Ws from '@adonisjs/websocket-client';
import { toast } from 'react-toastify';
import { eventChannel } from 'redux-saga';
import { all, takeLatest, call, take, put, select } from 'redux-saga/effects';
import { history } from '../../../services';
import {
subscribeUserRequest,
subscribeChatRequest,
subscribeChatSuccess,
@robsonkades
robsonkades / metatags.html
Created December 10, 2020 17:58 — forked from diego3g/metatags.html
Meta tags do curso de Next.js
<meta httpEquiv="x-ua-compatible" content="IE=edge,chrome=1" />
<meta name="MobileOptimized" content="320" />
<meta name="HandheldFriendly" content="True" />
<meta name="theme-color" content="#121214" />
<meta name="msapplication-TileColor" content="#121214" />
<meta name="referrer" content="no-referrer-when-downgrade" />
<meta name="google" content="notranslate" />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={description} />
@robsonkades
robsonkades / settings.json
Created May 25, 2020 19:41 — forked from diego3g/settings.json
✏️ Minha config do VSCode atualizada
{
"terminal.integrated.fontSize": 14,
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
"editor.tabSize": 2,
"editor.fontSize": 18,
"editor.lineHeight": 26,
"editor.fontFamily": "Fira Code",
@robsonkades
robsonkades / encryption.js
Created May 22, 2020 15:40 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@robsonkades
robsonkades / example-query.js
Created May 22, 2020 12:57 — forked from thetrevorharmon/example-query.js
Query JSON with S3 Select in Node.js
// See tth.im/s3json for a full explanation of this code
const AWS = require('aws-sdk');
const S3 = new AWS.S3();
exports.handler = async (_, context) => {
try {
const query = 'SELECT * FROM s3object[*].results[*] r;';
// test query is against data from https://swapi.co/api/planets/?page=2
@robsonkades
robsonkades / auth.js
Created November 4, 2019 19:58 — forked from toricls/auth.js
Very basic AWS Amplify auth in Vue (signup, signin, signout)
import Amplify, { Auth } from 'aws-amplify';
const types = {
AUTHENTICATE: 'AUTHENTICATE',
SIGNOUT: 'SIGNOUT',
SET_ATTRIBUTES: 'SET_ATTRIBUTES',
};
Amplify.configure({
Auth: {