Skip to content

Instantly share code, notes, and snippets.

View toruticas's full-sized avatar

Rafael Mariano toruticas

View GitHub Profile
@toruticas
toruticas / toruticas.zsh-theme
Last active October 7, 2023 08:24
.oh-my-zsh/themes/toruticas.zsh-theme
# Based on gnzhtheme
setopt prompt_subst
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
@toruticas
toruticas / src_SubscriptionConfig.tsx
Created September 19, 2022 05:53
SWR Subscription
import React, { createContext, useRef, useCallback, FC } from "react";
import type { SubscribeFn, Event, Key, Listener } from "./types";
export interface SubscriptionContextType {
subscribe: (key: Key, event: Event, subscription: SubscribeFn) => void;
unsubscribe: (key: Key) => void;
emit: (key: Event, data: any) => void;
}
const SubscriptionContext = createContext<SubscriptionContextType | null>(null);
@toruticas
toruticas / fdignore
Created June 30, 2022 14:21
~/.fdignore
.git
@toruticas
toruticas / CocConfig.json
Last active November 14, 2024 19:16
CoC extensions: ~/.config/coc/extensions/package.json; CoC config: ~/.config/nvim/coc-settings.json
{
"codeLens.enable": false,
"eslint.fixOnSaveTimeout": 1,
"suggest.noselect": false,
"coc.preferences.formatOnSaveFiletypes": ["*"],
"python.venvPath": "${env:HOME}/.pyenv/versions",
"python.formatting.provider": "black",
"python.formatting.provider": "black",
"python.formatting.blackPath": "${env:HOME}/.pyenv/shims/black",
"python.formatting.blackArgs": ["-l 120"],
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'thewtex/tmux-mem-cpu-load'
set -g @plugin 'toruticas/tmux-weather'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Solarized theme
set -g @plugin 'seebi/tmux-colors-solarized'
const { jest: jestConfig } = require('kcd-scripts/config')
module.exports = Object.assign(jestConfig, {
globalSetup: '<rootDir>/src/setupJest',
modulePaths: ['<rootDir>/src/'],
transform: {
...jestConfig.transform,
'\\.tsx?$': 'ts-jest',
'^.+\\.jsx?$': 'babel-jest',
@toruticas
toruticas / .eslintrc.js
Last active December 28, 2020 14:53
Configuration: Prettier + Eslint + TS
module.exports = {
plugins: ['prettier', 'react', '@typescript-eslint'],
extends: [
'./node_modules/kcd-scripts/eslint.js',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
],
rules: {
'prettier/prettier': 'error',
{
"compilerOptions": {
"baseUrl": "src/",
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
const ProfileData: FC = () => {
const { data, error, isValidating, mutate } = useSWR(GITHUB_PROFILE_API)
return (
<div className="ProfileData">
...
{error && (
<div className="spinner">
<AlertIcon />
</div>
import React, { Suspense, ReactNode } from 'react'
import { cache } from 'swr'
import { GITHUB_PROFILE_API } from './api'
import { ProfileData } from './ProfileData'
import { SkeletonLoading } from './SkeletonLoading'
import { ConfusedIcon } from './ConfusedIcon'
import './ErrorBoundary.css'