Skip to content

Instantly share code, notes, and snippets.

View anderjs's full-sized avatar
:electron:
Learn never exhaust the mind

Anderson anderjs

:electron:
Learn never exhaust the mind
View GitHub Profile
import React, { useEffect, useCallback, useMemo } from 'react'
function Devices () {
const [devices, setDevices] = useState()
const [products, setProducts] = useState([])
const [page, setPage] = useState(1)
// Esto se ejecutara una sola vez
@anderjs
anderjs / index.js
Created September 29, 2020 15:32
JSDocs Interface example
/**
* @typedef {Object} Child
* @property {string} node
* * /
/**
* @typedef {Object} Configuration
* @property {string} name
* @property {boolean} execute
* @property {Child []} childs
@anderjs
anderjs / config-override.js
Last active May 31, 2023 03:38
Cache Busting CRA with react-app-rewired
const path = require('path')
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = function (config) {
return merge(config, {
plugins: [
new CleanWebpackPlugin(),
],
import produce from 'immer'
import * as CR from '../actions/classroom'
/**
* @typedef {Object} ClassRoomState
* @property {Array<User>} users
* @property {import ('twilio-video').Room | null} room
* @property {import ('twilio-video').VideoTrack} track
*/
import React, { memo, useState, useEffect, useRef, useCallback } from 'react'
import { Badge as Button, Container } from 'react-bootstrap'
import { Icon } from 'react-icons-kit'
import { ic_volume_up } from 'react-icons-kit/md/ic_volume_up'
import { ic_volume_off } from 'react-icons-kit/md/ic_volume_off'
import { ic_videocam_off } from 'react-icons-kit/md/ic_videocam_off'
import { ic_videocam } from 'react-icons-kit/md/ic_videocam'
import { ic_fullscreen } from 'react-icons-kit/md/ic_fullscreen'
import { ic_screen_share } from 'react-icons-kit/md/ic_screen_share'
import 'assets/css/video.css'
import React, { memo, useReducer, useEffect, useCallback } from 'react'
import { Row, Col } from 'react-bootstrap'
import Video from 'twilio-video'
import * as TWILIO_EVENT from './actions/twilio'
import classRoomReducer, { initialState } from './reducer/classroom'
import {
connectUserToRoom,
disconnectUserToRoom,
setRoomNetwork,
import { useState, useCallback, useMemo } from 'react'
/**
*
* @param {number} initialValue
* @param {number} limit
*/
function useCounter(initialValue, limit) {
const [ state, setState ] = useState({
value: initialValue,
import { useMemo } from 'react'
/**
* Generates an object of query parameters.
* @param {string} url
* @param {string []} dataset
*/
function useQuery (url) {
const queries = useMemo(() => {
const params = new URLSearchParams(url)
import { useEffect, useState } from 'react'
function usePermissions () {
const [permission, setPermission] = useState({})
const getPermissions = useCallback(() => {
fetch('....', { ...headers })
.then(data => data.json())
.then(permissions => setPermission({ ...permissions.response })
.catch(err => // do something with the error)
<b>We use past simple for:</b> <p><b>1. Actions that are perceived as finished at a specific time in the past.</b></p> <div class=row> <div class=col-6 font-italic>I went to London last year.</div> <div class=col-6 font-italic>He got up at 7:30a.m. yesterday</div> </div> <p><b>2. Past habits.</b></p> <div class=row> <div class=col-12 font-italic>When I was a child, I often enjoyed cartoons on TV.</div> </div> <p><b>3. Series of completed actions that happened one after the other in the past.</b></p> <div class=row> <div class=col-12 font-italic>First I switched on the lights, then I got up and got dressed.</div> </div> <p><b>4. An action that interrupted another action that was in progress in the past.</b></p> <div class=row> <div class=col-12 font-italic>While I was reading, the telephone rang.</div> </div> <p><b>Time expressions</b> used in the past simple:</p> <ul class=font-weight-bold> <li> Yesterday </li> <li> Last night/week/month/year </li> <li> In 2008 </li> <li> When I was a kid </li> <li> Two days/