Skip to content

Instantly share code, notes, and snippets.

View gustavcaves's full-sized avatar

gustavcaves

View GitHub Profile
@Klerith
Klerith / templateSlice.js
Last active April 25, 2024 17:38
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
@Klerith
Klerith / vite-testing-config.md
Last active May 22, 2024 19:08
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:
@hcosta
hcosta / read-camera.py
Created March 7, 2021 14:51 — forked from bsdnoobz/read-camera.py
Displaying webcam feed using OpenCV and Python+PySide.
#!/usr/bin/env python
from PySide.QtCore import *
from PySide.QtGui import *
import cv2
import sys
class MainApp(QWidget):
def __init__(self):
@Klerith
Klerith / Navbar.js
Last active May 13, 2024 18:00
Un NavBar de Bootstrap rápido para el curso de React de cero a experto
import { Link, NavLink } from 'react-router-dom';
export const Navbar = () => {
return (
<nav className="navbar navbar-expand-sm navbar-dark bg-dark">
<Link
className="navbar-brand"
to="/"
@Klerith
Klerith / heroes-with-desc.js
Last active April 24, 2024 19:55
Una colección de Super Héroes
export const heroes = [
{
'id': 'dc-batman',
'superhero':'Batman',
'publisher':'DC Comics',
'alter_ego':'Bruce Wayne',
'first_appearance':'Detective Comics #27',
'characters':'Bruce Wayne'
},
{

random-messages

Whenever I start a new project, I don't know what to write for the first commit. After doing a “git init” there is technically nothing there...

Install

npm install -g random-msg
@hcosta
hcosta / pagination.html
Last active October 29, 2023 19:43
Menú de paginación con Bootstrap 4 para ListView en Django
<!-- Menú de paginación -->
{% if is_paginated %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item ">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo;</a>
</li>
{% else %}
<li class="page-item disabled">
@hcosta
hcosta / profile_form.html
Last active June 10, 2023 17:35
Revisión del formulario de perfil con avatar
{% extends 'core/base.html' %}
{% load static %}
{% block title %}Perfil{% endblock %}
{% block content %}
<style>.errorlist{color:red;} label{display:none}</style>
<main role="main">
<div class="container">
<div class="row mt-3">
<div class="col-md-9 mx-auto mb-5">
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
@hcosta
hcosta / login.html
Last active October 27, 2023 18:38
Revisión del template para identificarse en el curso Django 2
{% extends 'core/base.html' %}
{% load static %}
{% block title %}Iniciar sesión{% endblock %}
{% block content %}
<style>.errorlist{color:red;}</style>
<main role="main">
<div class="container">
<div class="row mt-3">
<div class="col-md-9 mx-auto mb-5">
<form action="" method="post">{% csrf_token %}
@hcosta
hcosta / custom_ckeditor.md
Last active May 19, 2024 03:18
Código para conseguir ancho adaptativo en django-ckeditor

static/pages/css/custom_ckeditor.css

.django-ckeditor-widget, .cke_editor_id_content {
    width: 100% !important;
    max-width: 821px !important;
}

Inyectar en pages_menu.html