Skip to content

Instantly share code, notes, and snippets.

View tomasrpita's full-sized avatar
馃幆
Focusing

Tomas R. Pita tomasrpita

馃幆
Focusing
View GitHub Profile
@tomasrpita
tomasrpita / test-socketio.js
Last active December 1, 2023 15:49
JavaScript Code for Generic Socket.IO Client: Establishes and Manages WebSocket Connections
var script = document.createElement('script');
script.src = "https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js";
script.onload = initSocket; // Calls initSocket after the library is loaded
document.head.appendChild(script);
function initSocket() {
// Replace 'backend-url:port' with your actual backend URL and port
var socket = io('http://backend-url:port');
socket.on('connect', function() {
@tomasrpita
tomasrpita / templateSlice.js
Created September 9, 2023 05:57 — forked from Klerith/templateSlice.js
Cascaron para crear Redux Slices r谩pidamente
import { createSlice } from '@reduxjs/toolkit';
export const templateSlice = createSlice({
name: 'name',
initialState: {
counter: 10
},
reducers: {
increment: (state, /* action */ ) => {
//! https://react-redux.js.org/tutorials/quick-start
@tomasrpita
tomasrpita / vite-testing-config.md
Created July 25, 2023 03:24 — forked from Klerith/vite-testing-config.md
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalaci贸n y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@tomasrpita
tomasrpita / .vimrc
Last active May 15, 2020 17:28 — forked from miguelgrinberg/.vimrc
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
let need_to_install_plugins = 1
endif
call plug#begin()