This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A tiny wrapper around fetch(), borrowed from | |
// https://kentcdodds.com/blog/replace-axios-with-a-simple-custom-fetch-wrapper | |
export async function client(endpoint, { body, ...customConfig } = {}) { | |
const headers = { 'Content-Type': 'application/json' } | |
const config = { | |
method: body ? 'POST' : 'GET', | |
...customConfig, | |
headers: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMemo } from "react"; | |
type ListGroupByMap<T> = Map<T[keyof T], T[]>; | |
const useListGroupBy = <T,>(list: T[], typeKey: keyof T): ListGroupByMap<T> => { | |
const updatedListByType = useMemo(() => { | |
const listByType = new Map<T[keyof T], T[]>(); | |
list.forEach((item) => { | |
const itemValue = item[typeKey]; | |
if (listByType.has(itemValue)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"env": { | |
"node": true, | |
"browser": true, | |
"es6": true | |
}, | |
"parser": "@typescript-eslint/parser", | |
"parserOptions": { | |
"ecmaVersion": 2018, | |
"sourceType": "module", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let condition1 = 13 ==='13'; | |
let condition2 = 1 === 1 | |
let condition3 = {} ==={}; | |
let condArray = [ | |
condition1, condition2 | |
] | |
if(!condArray.includes(false)){ | |
console.log('all false') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ctCss= ` | |
/*!========================================================================== | |
#CT.CSS | |
==========================================================================*//*!* ct.css – Let’s take a look inside your <head>… | |
* | |
* © Harry Roberts 2021 – twitter.com/csswizardry*/head{--ct-is-problematic: solid;--ct-is-affected: dashed;--ct-notify: #0bce6b;--ct-warn: #ffa400;--ct-error: #ff4e42}head,head script,head script:not([src])[async],head script:not([src])[defer],head style,head [rel=stylesheet],head script~meta[http-equiv=content-security-policy],head>meta[charset]:not(:nth-child(-n+5)){display:block}head script,head style,head [rel=stylesheet],head title,head script~meta[http-equiv=content-security-policy],head>meta[charset]:not(:nth-child(-n+5)){margin:5px;padding:5px;border-width:5px;background-color:#fff;color:#333}head ::before,head script,head style{font:16px/1.5 monospace,monospace;display:block}head ::before{font-weight:700}head script[src],head link[rel=stylesheet]{border-style:var(--ct-is-prob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var ct = document.createElement('link'); | |
ct.rel = 'stylesheet'; | |
ct.href = 'https://csswizardry.com/ct/ct.css'; | |
document.head.appendChild(ct); | |
}()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jq .devtools.preferences.scriptSnippets "/mnt/c/Users/{myuser}/AppData/Local/Google/Chrome/User Data/{myprofile#}/Preferences" \ | |
| jq '. | fromjson' > bkp_myprofile#.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/* | |
Restoring } key in sublime text for spanish keyboards | |
----------------------------------------------------------------------------- | |
FROM: http://arqex.com/727/restoring-key-in-sublime-text-for-spanish-keyboards | |
*/ | |
{ "keys": ["ctrl+alt+/"], "command": "insert", "args": {"characters": "}"}} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.move = function(from, to) { | |
this.splice(to, 0, this.splice(from, 1)[0]); | |
}; | |
const swapPositions = (array, a ,b) => { | |
[array[a], array[b]] = [array[b], array[a]] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>limpamos angular:</h3> | |
<pre> | |
//inyectamos javascript | |
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script); | |
//Borramos los comments | |
$("*").contents().filter(function(){ return this.nodeType == 8;}).remove(); | |
//luego borramos los atributos |
NewerOlder